Azure / Azure/azure-sdk-for-python

AiProjectClient: Python Unexpected type error when I copy and paste the official example

Offen
#43,618 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
AI Projects Client customer-reported needs-team-attention question Service Attention
Vorherrschende Sprache
Python
Sterne
5.6k
Forks
3.4k
Ø Merge
2 T. 2 Std.
Gemergte PRs (30 T.)
213

Beschreibung

- **Package Name**: azure.ai.projects
- **Package Version**: 1.0.0
- **Operating System**: Darwin 25.0.0
- **Python Version**: 3.11.14

**Describe the bug**
Hello,

if I copy and paste the example AiProjectClient example from https://learn.microsoft.com/en-us/python/api/overview/azure/ai-projects-readme?view=azure-python-preview#getting-started into my IntelliJ IDEA the code works fine, but I get a **python type error**. We usually do not allow type errors within our build pipeline.

```
Unexpected type(s):
(Any, DefaultAzureCredential)
Possible type(s):
(str, TokenCredential)
(str, TokenCredential)
```

**To Reproduce**
Steps to reproduce the behavior:
1. Copy and paste the code from the example
2. IDEA warns about the wrong type

**Expected behavior**
AiProjectClient constructor accepts `DefaultAzureCredential` type.

**Screenshots**
Image

**Additional context**
The problem was already mentioned within [#DefaultAzur](https://github.com/azure/azure-sdk-for-python/issues/41505) where [MiaMeyerMakes](https://github.com/MiaMeyerMakes)
[on Jun 17](https://github.com/Azure/azure-sdk-for-python/issues/41505#issuecomment-2980012562) mentioned that the type error still exists. But the issue was closed without solving the type error.

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Beginnen Sie mit dem offiziellen azure.ai.projects README-getting-started-Beispiel und den Typinformationen des AiProjectClient-Konstruktors. Reproduzieren Sie die Warnung in IntelliJ IDEA mit DefaultAzureCredential, vergleichen Sie sie mit dem vom Konstruktor akzeptierten TokenCredential-Typ und bestätigen Sie, dass das Beispiel keinen Typfehler mehr erzeugt.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
azure, python
Bereich
api
Issue-Typ
Bug
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
38/100

Neue Issues direkt in Ihr Postfach

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