Skip to content
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

async 支持吗 #388

Open
NXL333 opened this issue Nov 5, 2024 · 2 comments
Open

async 支持吗 #388

NXL333 opened this issue Nov 5, 2024 · 2 comments

Comments

@NXL333
Copy link

NXL333 commented Nov 5, 2024

async 支持吗???completion = client.chat.completions.create(
model=model,
messages=messages,
temperature=temperature,
max_tokens=max_tokens,
stream=True
)
assistant_response = ""
for chunk in completion:
assistant_response += chunk.choices[0].delta.content
history[-1][-1] = assistant_response
yield history,chunk_show,支持异步流式调用吗,谢谢

@tuhahaha
Copy link
Collaborator

您好,目前这个框架没有适配异步调用,因为异步涉及的改动会比较多...

@VxCoder
Copy link

VxCoder commented Dec 5, 2024

整个过程封装成一个函数,再通过asyncio的asyncio.get_event_loop().run_in_executor 可以初步实现异步效果

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants