Hi Greg Coyle
I am able to replicate 404 errors with 2024-11-20 version
but succeeds with 2024-10-21 Api version as mentioned in API-version document.
Here was my sample code which is giving outputs
import os
import base64
from openai import AzureOpenAI
endpoint = os.getenv("ENDPOINT_URL", "<endpointurl>")
deployment = os.getenv("DEPLOYMENT_NAME", "gpt-4o")
subscription_key = os.getenv("AZURE_OPENAI_API_KEY", "<apikey>")
# Initialize Azure OpenAI Service client with key-based authentication
client = AzureOpenAI(
azure_endpoint=endpoint,
api_key=subscription_key,
api_version="2024-10-21",
)
# IMAGE_PATH = "YOUR_IMAGE_PATH"
# encoded_image = base64.b64encode(open(IMAGE_PATH, 'rb').read()).decode('ascii')
#Prepare the chat prompt
chat_prompt = [
{
"role": "system",
"content": [
{
"type": "text",
"text": "You are an AI assistant that helps people find information."
}
]
}
]
# Include speech result if speech is enabled
messages = chat_prompt
# Generate the completion
completion = client.chat.completions.create(
model=deployment,
messages=messages,
max_tokens=800,
temperature=0.7,
top_p=0.95,
frequency_penalty=0,
presence_penalty=0,
stop=None,
stream=False
)
print(completion.to_json())
Hope that helps.
Thank you.