Open Tamsen1995 opened 1 month ago
from openai import OpenAI
client = OpenAI(
base_url=<DEPLOYMENT_ENDPOINT>,
api_key=<API_KEY_FOR_DEPLOYMENT>
)
completion = client.chat.completions.create(
model="<ONLINE_MODEL_ID>",
messages=[
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "What is the top news about Gen AI today?"}
]
)
print(completion.choices[0].message)
Stretch Goal:
Functional Requirements
[x] User Input Handling:
[x] Query Extraction and Validation:
[x] SerpApi Integration:
[x] OpenAI Integration:
Non-Functional Requirements
[ ] Performance:
[ ] Scalability:
[ ] Security:
[ ] Maintainability:
Error Handling and Logging
[ ] Error Responses:
[ ] Logging:
API Endpoint Requirements
[x] Chat Completions Endpoint:
/chat/completions
.[ ] Request and Response Structure:
model
field specifying the OpenAI model to use.messages
field containing a list of messages with roles and content.query
field may be included for additional search context.response
field containing the OpenAI-generated content.Configuration and Environment
.env
file for local development with placeholders for required environment variables.Documentation
Deployment