Skip to content

Commit 392008a

Browse files
authored
No need to make get_openai_client() on the async AIProjectClient an "async" method. It does not make any network calls. (#43991)
1 parent 4f07ea0 commit 392008a

26 files changed

+200
-184
lines changed

sdk/ai/azure-ai-projects/CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
# Release History
22

3+
## 2.0.0b2 (Unreleased)
4+
5+
### Features Added
6+
7+
### Breaking changes
8+
9+
* `get_openai_client()` method on the asynchronous AIProjectClient is no longer an "async" method.
10+
11+
### Bugs Fixed
12+
13+
### Sample updates
14+
315
## 2.0.0b1 (2025-11-11)
416

517
### Features added
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
directory: specification/ai/Azure.AI.Projects
2+
commit: 78bfd335c31b8764578cfb9840f3b74349c10354
3+
repo: Azure/azure-rest-api-specs-pr
4+
additionalDirectories:

sdk/ai/azure-ai-projects/azure/ai/projects/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@
66
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
77
# --------------------------------------------------------------------------
88

9-
VERSION = "2.0.0b1"
9+
VERSION = "2.0.0b2"

sdk/ai/azure-ai-projects/azure/ai/projects/aio/_patch.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import os
1111
import logging
1212
from typing import List, Any, TYPE_CHECKING
13-
from azure.core.tracing.decorator_async import distributed_trace_async
13+
from azure.core.tracing.decorator import distributed_trace
1414
from azure.core.credentials_async import AsyncTokenCredential
1515
from ._client import AIProjectClient as AIProjectClientGenerated
1616
from .._patch import _patch_user_agent
@@ -95,8 +95,8 @@ def __init__(self, endpoint: str, credential: AsyncTokenCredential, **kwargs: An
9595

9696
self.telemetry = TelemetryOperations(self) # type: ignore
9797

98-
@distributed_trace_async
99-
async def get_openai_client(self, **kwargs: Any) -> "AsyncOpenAI": # type: ignore[name-defined] # pylint: disable=too-many-statements
98+
@distributed_trace
99+
def get_openai_client(self, **kwargs: Any) -> "AsyncOpenAI": # type: ignore[name-defined] # pylint: disable=too-many-statements
100100
"""Get an authenticated AsyncOpenAI client from the `openai` package.
101101
102102
Keyword arguments are passed to the AsyncOpenAI client constructor.

sdk/ai/azure-ai-projects/azure/ai/projects/models/_models.py

Lines changed: 120 additions & 120 deletions
Large diffs are not rendered by default.

sdk/ai/azure-ai-projects/samples/agents/sample_agent_basic_async.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ async def main() -> None:
4646

4747
async with project_client:
4848

49-
openai_client = await project_client.get_openai_client()
49+
openai_client = project_client.get_openai_client()
5050

5151
agent = await project_client.agents.create_version(
5252
agent_name="MyAgent",

sdk/ai/azure-ai-projects/samples/agents/sample_agent_retrieve_basic_async.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ async def main():
4747
)
4848

4949
async with project_client:
50-
openai_client = await project_client.get_openai_client()
50+
openai_client = project_client.get_openai_client()
5151

5252
# Retrieves latest version of an existing Agent
5353
agent = await project_client.agents.get(agent_name=agent_name)

sdk/ai/azure-ai-projects/samples/agents/sample_agent_structured_output_async.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ async def main() -> None:
6666

6767
async with project_client:
6868

69-
openai_client = await project_client.get_openai_client()
69+
openai_client = project_client.get_openai_client()
7070

7171
agent = await project_client.agents.create_version(
7272
agent_name="MyAgent",

sdk/ai/azure-ai-projects/samples/agents/sample_mcp_tool_async_.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ async def main():
7979
)
8080
async with project_client:
8181
# Create a vector store
82-
openai_client = await project_client.get_openai_client()
82+
openai_client = project_client.get_openai_client()
8383
vector_store = await openai_client.vector_stores.create(
8484
name="sample_vector_store",
8585
)

sdk/ai/azure-ai-projects/samples/agents/sample_workflow_multi_agent_async.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ async def main():
4848
)
4949

5050
async with project_client:
51-
openai_client = await project_client.get_openai_client()
51+
openai_client = project_client.get_openai_client()
5252

5353
teacher_agent = await project_client.agents.create_version(
5454
agent_name="teacher-agent",

0 commit comments

Comments
 (0)