Python: fix: Remove await from synchronous get_openai_client call in AzureAIC… - #2349
Python: fix: Remove await from synchronous get_openai_client call in AzureAIC…#2349Kurt (q33566) wants to merge 2 commits into
Conversation
…lient The method in is synchronous. Awaiting it caused a TypeError.
There was a problem hiding this comment.
Pull Request Overview
This PR fixes a TypeError caused by incorrectly awaiting a synchronous method call. The get_openai_client() method from AIProjectClient is synchronous, but was being called with await, causing a runtime error.
Key Changes:
- Removed
awaitkeyword fromself.project_client.get_openai_client()call in theinitialize_client()method
Eduard van Valkenburg (eavanvalkenburg)
left a comment
There was a problem hiding this comment.
This also requires a minimum version of the aiprojectclient dependency, please update that as well
Got it. I have added the minimum version requirement to release azure-ai-projects_2.0.0b2 describe this as a breking change.
|
|
Let me fix the tests quickly; we need to merge this as soon as possible. |
|
Kurt (@q33566) Thanks for your contribution. I fixed the tests and updated the dependency in correct place in the following PR: #2358. I will close this PR to proceed with another one. Thanks again! |
Pull request was closed
…lient
The
get_openai_clientmethod is synchronous. Awaiting it caused a TypeError.get_openai_clientimplementation in azure-sdk-for-pythonresolve #2338
Result
Before the fix
samples/getting_started/agents/azure_ai/azure_ai_basic.pygot type error.After the fix
samples/getting_started/agents/azure_ai/azure_ai_basic.pygot correct result.Contribution Checklist