Azure / Azure/azure-sdk-for-python
Azure OpenAI Stored Completions does not store (AI Foundry)
- Dominant language
- Python
- Stars
- 5.6k
- Forks
- 3.4k
- Avg merge
- 1d 21h
- Merged PRs (30d)
- 193
Description
- **Package Name**: AZURE OpenAI
- **Package Version**: openai == 2.6.0
- **Operating System**: Windows Server 2025 Datacenter
- **Python Version**: 3.12
**Describe the bug**
If there is an image in the prompt encoded in base64, client.chat.completions.create() provides a chat completion ID when store = True, but retrieving the completion_id returns 404, and completion is not visible in the portal. This may be a feature request, but this is not documented so im reporting as a bug.
**To Reproduce**
Steps to reproduce the behavior:
1. Define AzureOpenAI client:
`client = AzureOpenAI(
api_version=api_version,
azure_endpoint=endpoint,
api_key=subscription_key,
)`
I have tried many combinations of endpoints, API versions, and clients (ie. OpenAI(), AzureOpenAI()) All have this same issue.
2. Sample prompt with image and request a chat completion
```
test_image_base64 = "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z8DwHwAFBQIAX8jx0gAAAABJRU5ErkJggg=="
messages = [
{
"role": "system",
"content": "You are a helpful assistant.",
},
{
"role": "user",
"content": [
{
"type": "text",
"text": "What color would you say this image is?"
},
{
"type": "image_url",
"image_url": {
"url": f"data:image/png;base64,{test_image_base64}"
}
}
]
}
]
response = client.chat.completions.create(
messages=messages,
max_completion_tokens=13107,
temperature=1.0,
top_p=1.0,
frequency_penalty=0.0,
presence_penalty=0.0,
model=deployment,
store=True,
metadata={
"user": "reviewbot",
"category": "testing-with-image",
}
)
response_message = response.choices[0].message
print(f"Response: {response_message.content}")
```
The response returns a completion ID, and completes successfully with no errors.
Stored completion does not appear in portal or via retrieval. When the image is not included in the request the chat completion stores successfully.
**Expected behavior**
I would expect that chats with images would be stored. I understand the issue with storage and a user could send huge images. If the user can fine-tune vision models, i'd think that images could be stored in stored completions.
FWIW the OpenAI API stores prompts with images and you can see the image when reviewing the completion in their portal. I'd want similar function in the AI Foundry portal
Contributor guide
Assessment
This issue has not been assessed yet.