Skip to content

AsyncOpenAI is not work #122

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
lq9958 opened this issue Mar 13, 2025 · 9 comments
Closed

AsyncOpenAI is not work #122

lq9958 opened this issue Mar 13, 2025 · 9 comments
Labels
bug Something isn't working

Comments

@lq9958
Copy link

lq9958 commented Mar 13, 2025

method AsyncOpenAI is not work, can not use other LLMs

@lq9958 lq9958 added the bug Something isn't working label Mar 13, 2025
@venvoyv
Copy link

venvoyv commented Mar 13, 2025

Yes, it didn't work during my test either. I tested Aliyun's and Deepseek's, and neither seemed to work.

@moseshu
Copy link

moseshu commented Mar 13, 2025

can you show your code?read the doc
it works for me
https://openai.github.io/openai-agents-python/config/

@venvoyv
Copy link

venvoyv commented Mar 13, 2025

你能展示你的代码吗?阅读文档, 它对我有用 https://openai.github.io/openai-agents-python/config/

Could you share the code you used to call the third-party API for us to learn from? Thank you.

@YidaHu
Copy link

YidaHu commented Mar 13, 2025

from agents import set_default_openai_client
external_client = AsyncOpenAI(
    api_key='sk-xxxxxx',
    base_url='https://xxxx.xxx.com/compatible-mode/v1/',
)
set_default_openai_client(external_client)

@sanjeev-kumar-4
Copy link

What is there is no api key required. Am using an azure endpoint.

@georg-wolflein
Copy link

georg-wolflein commented Mar 13, 2025

@sanjeev-kumar-4 In addition, you need to set_default_openai_api("chat_completions") and disable tracing (use_for_tracing=False).
This worked for me for using Azure:

from openai import AsyncAzureOpenAI
from agents import set_default_openai_client, set_default_openai_api
client = AsyncAzureOpenAI(
    api_key='xxxxxx',
    base_url='https://xxxx.openai.azure.com/',
    api_version="2024-05-01-preview",
)
set_default_openai_client(client, use_for_tracing=False)
set_default_openai_api("chat_completions")

@rm-openai
Copy link
Collaborator

There's some documentation here: https://openai.github.io/openai-agents-python/models/#using-other-llm-providers

I tested the samples with claude and together AI, and they both worked. If it isn't working for you, please let me know what issues you ran into.

@lq9958
Copy link
Author

lq9958 commented Mar 14, 2025

can you show your code?read the doc it works for me https://openai.github.io/openai-agents-python/config/

sorry, I have changed the default settings, now,it's worked !!
change default settings

@lq9958
Copy link
Author

lq9958 commented Mar 14, 2025

There's some documentation here: https://openai.github.io/openai-agents-python/models/#using-other-llm-providers

I tested the samples with claude and together AI, and they both worked. If it isn't working for you, please let me know what issues you ran into.

I modified the default configuration and it works now, thanks!

@lq9958 lq9958 closed this as completed Mar 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

7 participants