Azure / Azure/azure-sdk-for-python

Incorrect `unresolved-attribute` for Azure AI Inference's `ChatCompletionsClient`

Offen
#45,339 2 Kommentare 0 Reaktionen 1 zugewiesene Person Beansprucht von @dargilco Auf GitHub ansehen
AI Model Inference customer-reported needs-team-attention question Service Attention
Vorherrschende Sprache
Python
Sterne
5.6k
Forks
3.4k
Ø Merge
2 T.
Gemergte PRs (30 T.)
217

Beschreibung

- **Package Name**: `azure-ai-inference`
- **Package Version**: `1.0.0b9`
- **Operating System**: Windows
- **Python Version**: `3.13`

**Describe the bug**

As stated [in this issue](https://github.com/astral-sh/ty/issues/2898), `ty` complains that `ChatCompletionsClient` does not have a `complete` attribute.

**To Reproduce**

Here's a minimal example that should show the problem in VS Code, or when doing `ty check`:

```python
from azure.ai.inference.aio import ChatCompletionsClient
from azure.ai.inference.models import UserMessage
from azure.core.credentials import AzureKeyCredential

async def mcp_client(token: str, prompt: str):
client = ChatCompletionsClient(
endpoint="https://models.github.ai/inference",
credential=AzureKeyCredential(token),
)
messages = [UserMessage(content=prompt)]
response = await client.complete(model="openai/gpt-4o-mini", messages=messages)
return response

if __name__ == "__main__":
import asyncio

token = "github_pat_###"
response = asyncio.run(mcp_client(token, "What is the capital of France?"))
print(response.choices[0].message.content)
```

**Expected behavior**

Since the class `ChatCompletionsClient` does have the `complete` attribute (and indeed, the code runs fine), this error should not happen. As mentioned in the referenced issue, it seems that this might be due to the particular implementation of the class.

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.