OpenPipe/ART

Only works with AsyncOpenAI client, not synchronous OpenAI client

Closed this issue · 2 comments

Tested in Jupyter Notebook with openpipe-art[backend]==0.4.7 as well as by using 2048.ipynb in colab.
If you replace "from openai import AsyncOpenAI" with "from openai import OpenAI", "AsyncOpenAI" with "OpenAI" and "await client.chat.completions.create" with "client.chat.completions.create" in the rollout cell of 2048.ipynb, training cell will freeze permanently.
It matters, because some agentic frameworks like Qwen-Agent use synchronous OpenAI client. Therefore, it's impossible use Qwen-Agent with ART TrainableModel endpoints.
I have not managed to find any workaround yet. I would also appreciate any feedback if I’m doing something wrong.

Using an asynchronous methods where possible is highly encouraged because you'll want to do multiple rollouts simultaneously. If you want to use a synchronous package like Qwen-Agent, you may want to use a thread or process executor so that one request doesn't block your entire script.

Yep, executing Qwen-Agent with "await asyncio.to_thread" indeed works. So, I guess this is solved. Thanks, @bradhilton