diff --git a/.github/workflows/testsPython.yml b/.github/workflows/testsPython.yml index 452f71d..3b74d73 100644 --- a/.github/workflows/testsPython.yml +++ b/.github/workflows/testsPython.yml @@ -36,12 +36,8 @@ env: python-version: "3.13" jobs: - # Job #1: Run Python unit tests - # - # This job will run on an Ubuntu runner and execute the Python - # tests by using a custom action located in ./.github/actions/tests/python. python-unit-tests: - runs-on: ubuntu-latest # the runner (remote machine) will use Ubuntu OS + runs-on: ubuntu-latest steps: - name: Checkout code id: checkout @@ -62,18 +58,29 @@ jobs: mysql-charset: "${{ secrets.MYSQL_CHARSET }}" codecov-token: "${{ secrets.CODECOV_TOKEN }}" - # Job #2: Notifications (Mini-capstone assignment) - # This job will run after the Python unit tests and - # is scaffolded to facilitate sending notifications based - # on the test results. + jobs: + python-unit-tests: + runs-on: ubuntu-latest + steps: + # your test steps here... + notifications: needs: python-unit-tests runs-on: ubuntu-latest + steps: - name: Notify on test results run: | if [ "${{ needs.python-unit-tests.result }}" == "success" ]; then - echo "success notifications go here" + echo "TESTS PASSED" + echo "Repository: ${{ github.repository }}" + echo "Triggered by: ${{ github.actor }}" + echo "Commit: ${{ github.sha }}" + echo "Check logs: https://github.com/${{ github.repository }}/actions" else - echo "failure notifications go here" - fi + echo "TESTS FAILED" + echo "Repository: ${{ github.repository }}" + echo "Triggered by: ${{ github.actor }}" + echo "Commit: ${{ github.sha }}" + echo "Check logs: https://github.com/${{ github.repository }}/actions" + fi \ No newline at end of file diff --git a/Lab03/request.json b/Lab03/request.json new file mode 100644 index 0000000..8831b41 --- /dev/null +++ b/Lab03/request.json @@ -0,0 +1,33 @@ +{ + "model": "gpt-4-turbo", + "temperature": 0.5, + "max_tokens": 1024, + "messages": [ + { "role": "system", "content": "You are a helpful travel assistant." }, + { "role": "user", "content": "I am traveling to Vancouver tomorrow. What should I pack?" } + ], + "tools": [ + { + "type": "function", + "function": { + "name": "get_weather", + "description": "Retrieve the current weather for a given location.", + "parameters": { + "type": "object", + "properties": { + "location": { + "type": "string", + "description": "Name of the city" + }, + "unit": { + "type": "string", + "enum": ["celsius", "fahrenheit"] + } + }, + "required": ["location"] + } + } + } + ], + "tool_choice": "auto" +} \ No newline at end of file diff --git a/Lab03/weather.py b/Lab03/weather.py new file mode 100644 index 0000000..5463c0b --- /dev/null +++ b/Lab03/weather.py @@ -0,0 +1,11 @@ +import json + +def get_weather(location: str, unit: str = "celsius"): + dummy_data = { + "Vancouver": {"celsius": "8°C", "fahrenheit": "46°F"}, + "Paris": {"celsius": "12°C", "fahrenheit": "54°F"} + } + return dummy_data.get(location, {"celsius": "N/A", "fahrenheit": "N/A"})[unit] + +result = get_weather("Vancouver", "celsius") +print(json.dumps({"celsius": result})) \ No newline at end of file diff --git a/app/tests/const.py b/app/tests/const.py index 286cd1c..84bc8a9 100644 --- a/app/tests/const.py +++ b/app/tests/const.py @@ -13,4 +13,4 @@ if PYTHON_ROOT not in sys.path: sys.path.append(PYTHON_ROOT) # noqa: E402 -__all__ = ["HERE", "PROJECT_ROOT", "PYTHON_ROOT"] +__all__ = ["HERE", "PROJECT_ROOT", "PYTHON_ROOT"] \ No newline at end of file