You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
The only way to utilize Async clients for OpenAI 1.x in guardrails is to wrap it as a custom llm. This is because our identification criteria for OpenAI v1.x functions are weak and rely on the static exported methods.
Expected behavior
User should be able to use async clients in the same way as synchronous clients.
Library version:
0.4.2
Additional context
There are ways to identify a function as belonging to an OpenAI 1.x client without necessitating they are one of the static methods, but it relies heavily on reflection:
fromopenaiimportAsyncClient, resourcesasync_client=AsyncClient()
llm_api=async_client.chat.completions.createapi_self=getattr(llm_api, "__self__", None)
llm_api_is_async_chat_completions=isinstance(api_self, resources.chat.completions.AsyncCompletions)
print("Llm Api Is Async Chat Completions: ", llm_api_is_async_chat_completions)
Additionally, the way we do things know (re-building the client), we would have to access private attributes:
Describe the bug
The only way to utilize Async clients for OpenAI 1.x in guardrails is to wrap it as a custom llm. This is because our identification criteria for OpenAI v1.x functions are weak and rely on the static exported methods.
To Reproduce
Expected behavior
User should be able to use async clients in the same way as synchronous clients.
Library version:
0.4.2
Additional context
There are ways to identify a function as belonging to an OpenAI 1.x client without necessitating they are one of the static methods, but it relies heavily on reflection:
Additionally, the way we do things know (re-building the client), we would have to access private attributes:
Also see additional context here: #681
The text was updated successfully, but these errors were encountered: