Azure / Azure/azure-sdk-for-python

Error "Invalid URL (POST /v1/chat/completions)" when using gpt-4o-mini with azure-ai-inference library

Aperta
#40,757 2 commenti 1 reazione 1 assegnatario Rivendicata da @trangevi Vedi su GitHub
AI Model Inference Client customer-reported needs-team-attention question Service Attention
Lingua principale
Python
Stelle
5.6k
Fork
3.4k
Merge medio
2g 2h
PR unite (30g)
213

Descrizione

- **Package Name**: azure-ai-inference
- **Package Version**: 1.0.0b9
- **Python Version**: 3.11

**Describe the bug**
When attempting to use the gpt-4o-mini model (Deployment type: Standard) with ChatCompletionsClient, an error occurs:
```bash
Error: (None) Invalid URL (POST /v1/chat/completions)
Code: None
Message: Invalid URL (POST /v1/chat/completions)
```

**To Reproduce**
Steps to reproduce the behavior:
1. Set the environment variables AZURE_INFERENCE_ENDPOINT and AZURE_INFERENCE_KEY correctly.
2. Run the following code:
```python
import os
from azure.ai.inference import ChatCompletionsClient
from azure.core.credentials import AzureKeyCredential
from azure.ai.inference.models import SystemMessage, UserMessage

try:
client = ChatCompletionsClient(
endpoint=os.getenv("AZURE_INFERENCE_ENDPOINT"),
credential=AzureKeyCredential(os.getenv("AZURE_INFERENCE_KEY")),
)

response = client.complete(
messages=[
SystemMessage(content="You are a helpful assistant."),
UserMessage(content="What is the capital of France?"),
],
model="gpt-4o-mini",
)

print("azure-ai-inference response:", response.choices[0].message.content)

except Exception as e:
print(f"Error: {e}")
```

**Expected behavior**
I expected the API call to succeed and return a chat completion response from the gpt-4o-mini model, similar to how it works with other models like gpt-4o.

**Screenshots**
N/A (Error is text-based and printed to console)

**Additional context**
- I have verified that the endpoint and key are correct.
- The same code structure works with other models.
- The same model works when using the AzureOpenAI library

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.