phanikumv commented on code in PR #77139:
URL: https://github.com/apache/airflow/pull/77139#discussion_r4631098374
##########
providers/openai/src/airflow/providers/openai/hooks/openai.py:
##########
@@ -209,9 +215,14 @@ def get_conn(self) -> OpenAI:
* ``"api_key"`` -- use the API key from the connection password (or
``openai_client_kwargs``).
* ``"workload_identity"`` -- exchange a short-lived identity token for
API access using the
OpenAI client's workload identity support. See
:meth:`_build_workload_identity`.
+
+ :param async_client: Return an ``AsyncOpenAI`` instead, for sync code
that passes one to
+ an async library. The connection lookup blocks, so in async code
use :meth:`aget_conn`.
+ Each call builds a new client.
Review Comment:
```suggestion
Each call builds a new client. Use the client inside one event
loop: get a new client for each ``asyncio.run`` or ``run_durably_sync`` call.
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]