Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 19 additions & 12 deletions .github/workflows/testsPython.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
33 changes: 33 additions & 0 deletions Lab03/request.json
Original file line number Diff line number Diff line change
@@ -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"
}
11 changes: 11 additions & 0 deletions Lab03/weather.py
Original file line number Diff line number Diff line change
@@ -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}))
2 changes: 1 addition & 1 deletion app/tests/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Loading