Ich versuche, die von Azure OpenAI bereitgestellte Batch Processing -API zu verwenden. I followed the official documentation here:
https://learn.microsoft.com/en-us/azure ... requisites
Steps I've genommen:
[*] Erstellt einen azure openai Service in der ESTUS-Region. Foundry .
Eine Batch-Datei mit dem bereitgestellten Python-Skript hochgeladen.
Code: Select all
import os
from openai import AzureOpenAI
from datetime import datetime
client = AzureOpenAI(
api_key=os.getenv("AZURE_OPENAI_API_KEY"),
api_version="2025-03-01-preview",
azure_endpoint=os.getenv("AZURE_OPENAI_ENDPOINT")
)
# Upload a file with a purpose of "batch"
file = client.files.create(
file=open("test.jsonl", "rb"),
purpose="batch",
extra_body={"expires_after": {"seconds": 1209600, "anchor": "created_at"}} # 14 days
)
print(file.model_dump_json(indent=2))
print(f"File expiration: {datetime.fromtimestamp(file.expires_at) if file.expires_at is not None else 'Not set'}")
file_id = file.id
< /code>
Ausgabe: < /h3>
{
"id": "file-267bb8d68906437a865e645a755d0f69",
"bytes": 596,
"created_at": 1745922716,
"filename": "test.jsonl",
"object": "file",
"purpose": "batch",
"status": "processed",
"status_details": null
}
< /code>
Dann erstellte ich einen Stapeljob: < /h3>
# Submit a batch job with the file
batch_response = client.batches.create(
input_file_id=file_id,
endpoint="/chat/completions",
completion_window="24h",
extra_body={"output_expires_after": {"seconds": 1209600, "anchor": "created_at"}} # 14 days
)
# Save batch ID for later use
batch_id = batch_response.id
print(batch_response.model_dump_json(indent=2))
< /code>
Auftreten: < /h3>
BadRequestError: Error code: 400 - {
'errors': {
'data': [
{
'code': 'model_not_found',
'message': "The provided model deployment 'REPLACE-WITH-MODEL-DEPLOYMENT-NAME' does not exist in the AOAI resource. Valid deployments are 'gpt-4o-mini-bt, gpt-4o-bt'. Learn more: https://aka.ms/aoai_batch/errors.",
'line': None,
'param': None
}
],
'object': 'list'
}
}
i Erstellte Bereitstellungen mit dem Namen GPT-4O-Mini-BT und gpt-4o-bt auf Azure Foundry. Die Ursache für diesen Fehler und wie kann ich ihn beheben?>