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
17 changes: 17 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
OPENAI_API_KEY=ADD-YOUR-OPENAI_API_KEY-HERE
REPO_NAME=agentic-ai-workflow
DOCKERHUB_USERNAME=lpm0073

# These settings are probably fine to leave as-is.
ENVIRONMENT=local
DOCKERHUB_ACCESS_TOKEN=ADD-YOUR-DOCKERHUB_ACCESS_TOKEN-HERE
LLM_TOOL_CHOICE=required
LOGGING_LEVEL=20
MYSQL_HOST=sql.lawrencemcdaniel.com
MYSQL_PORT=3306
MYSQL_USER=smarter_test_user
MYSQL_PASSWORD=smarter_test_user
MYSQL_DATABASE=smarter_test_db
MYSQL_CHARSET=utf8mb4
PYTHONPATH=./venv:./
CODECOV_TOKEN=ADD-YOUR-CODECOV_TOKEN-HERE
57 changes: 50 additions & 7 deletions .github/workflows/testsPython.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,54 @@ jobs:
notifications:
needs: python-unit-tests
runs-on: ubuntu-latest
if: always() # ← ensures this job runs even when tests fail
steps:
- name: Notify on test results
run: |
if [ "${{ needs.python-unit-tests.result }}" == "success" ]; then
echo "success notifications go here"
else
echo "failure notifications go here"
fi
- name: Notify Slack on success
if: needs.python-unit-tests.result == 'success'
uses: slackapi/slack-github-action@v1.27.0
with:
payload: |
{
"text": "*Tests Passed!*",
"attachments": [
{
"color": "#36A64F",
"fields": [
{ "title": "Repository", "value": "${{ github.repository }}", "short": true },
{ "title": "Branch", "value": "${{ github.ref_name }}", "short": true },
{ "title": "Python Version", "value": "${{ env.python-version }}", "short": true },
{ "title": "Triggered by", "value": "${{ github.actor }}", "short": true },
{ "title": "Commit", "value": "${{ github.sha }}", "short": false },
{ "title": "View Run", "value": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}", "short": false }
]
}
]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK

- name: Notify Slack on failure
if: needs.python-unit-tests.result != 'success'
uses: slackapi/slack-github-action@v1.27.0
with:
payload: |
{
"text": "*Tests Failed!*",
"attachments": [
{
"color": "#FF0000",
"fields": [
{ "title": "Repository", "value": "${{ github.repository }}", "short": true },
{ "title": "Branch", "value": "${{ github.ref_name }}", "short": true },
{ "title": "Python Version", "value": "${{ env.python-version }}", "short": true },
{ "title": "Triggered by", "value": "${{ github.actor }}", "short": true },
{ "title": "Commit", "value": "${{ github.sha }}", "short": false },
{ "title": "View Run", "value": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}", "short": false }
]
}
]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ dist
*.tfstate
*.tfstate.*
.terraform/
.env
#.env
lambda_dist_pkg
*.zip
__pycache__
Expand Down
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
"cornflakes.linter.executablePath": "venv/bin/flake8",
"[python]": {
"editor.defaultFormatter": "ms-python.black-formatter"
}
},
"python-envs.defaultEnvManager": "ms-python.python:venv"
}
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Agentic AI Workflow Example
# Agentic AI Workflow Example by Salma Lalji e

[![FullStackWithLawrence](https://a11ybadges.com/badge?text=FullStackWithLawrence&badgeColor=orange&logo=youtube&logoColor=282828)](https://www.youtube.com/@FullStackWithLawrence)<br>
[![OpenAI](https://a11ybadges.com/badge?logo=openai)](https://platform.openai.com/)
Expand All @@ -15,6 +15,7 @@ A Python command-line application that demonstrates how to use OpenAI Api functi

- how to use Docker Compose to containerize your project
- how to leverage Pydantic for constructing complex JSON objects
- Docker debugging

Python code is [located here](./app/)

Expand Down
52 changes: 52 additions & 0 deletions app/openai_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import os
from openai import OpenAI
from dotenv import load_dotenv

load_dotenv()


client = OpenAI(api_key=os.getenv("OPENAI_API_KEY"))

messages = [
{
"role": "system",
"content": "You are a helpful assistant that can call tools."
},
{
"role": "user",
"content": "Give me a list of available AI courses."
}
]

response = client.chat.completions.create(
model="gpt-4.1-mini",
messages=messages,
temperature=0.7
)
print(response.choices[0].message.content)

from pydantic import BaseModel, Field
from typing import List, Optional, Literal

class GetCoursesRequest(BaseModel):
topics: List[str] = Field(..., description="List of course topics to retrieve")
max_cost: float = Field(0.0, ge=0, description="Maximum budget for the courses")
difficulty: Optional[Literal["beginner", "intermediate", "advanced"]] = Field(
None,
description="Optional difficulty level of the courses"
)



print(GetCoursesRequest.model_json_schema())
def make_get_courses_tool():
return {
"type": "function",
"function": {
"name": "get_courses",
"description": "Retrieve a list of courses that match given topics.",
"parameters": GetCoursesRequest.model_json_schema(),
},
}

print(make_get_courses_tool())
Loading