[BUG] Native OpenAI async streaming does not send response_model as response_format
维护者通常 1 天内回复
评估
调研方向
阅读 lib/crewai/src/crewai/llms/providers/openai/completion.py,并比较 _ahandle_streaming_completion 与 _handle_streaming_completion。找到测试 test_openai_streaming_with_response_model,检查它如何覆盖异步路径。完成的标准是异步流式请求将 response_model 的架构作为 response_format 包含在内,并且有测试验证请求参数。
由索引模型根据 Issue 内容生成。
描述
Description
OpenAICompletion._ahandle_streaming_completion ignores the per-call response_model when it builds the request. In llms/providers/openai/completion.py the if response_model: branch calls self._get_async_client().chat.completions.create(**params), and params come from _prepare_completion_params, which only sets response_format from self.response_format. The sync twin (_handle_streaming_completion) uses beta.chat.completions.stream(..., response_format=response_model). So await llm.acall(..., response_model=M) with streaming sends an unconstrained request and usually gets prose back instead of an instance of M.
Steps to Reproduce
- Create
LLM(model="openai/gpt-4o", stream=True)with the native OpenAI provider. - Mock or inspect
llm._async_client.chat.completions.createand callawait llm.acall(messages, response_model=SomeModel). - The kwargs passed to
createcontain noresponse_format.
Expected behavior
The structured-output schema of response_model is sent, as on the sync path.
Screenshots/Code snippets
Related, on the LiteLLM path (llm.py): #9283 and PR #9284. This issue is the native OpenAI async path only.
Evidence
Code reading of lib/crewai/src/crewai/llms/providers/openai/completion.py at 97f2424 (async streaming handler vs the sync one). I can send a fix with a test next to test_openai_streaming_with_response_model.
Operating System
Linux (Debian-based)
Python Version
3.12
crewAI Version
1.15.45 (origin/main at 97f2424)
crewAI Tools Version
Not relevant
Virtual Environment
uv
- 主要语言
- Python
- 星标
- 61.2k
- 派生
- 9.2k
- 平均合并
- 1 天 14 小时
- 30 天内合并 PR
- 180
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
crewAIInc/crewAI 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 76/100
维护者通常 1 天内回复
-
[FEATURE] Add Straitly as a native OpenAI-compatible LLM provider可能已有人在做 @HashimSyedUBC 于 2 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
[BUG] Native OpenAI sync streaming with response_model returns an empty string and emits no completed event when the parse is missing可能已有人在做 @basil-k-aji-dev 于 2 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 1 天内回复
-
[BUG] Native Azure provider ignores the seed setting可能已有人在做 @basil-k-aji-dev 于 2 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 82/100
crewAIInc/crewAI#9787 · 1 条评论 ·
维护者通常 1 天内回复
-
[BUG] LiteLLM path reports 0 cached and reasoning tokens in the usage summary可能已有人在做 @basil-k-aji-dev 于 2 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 78/100
fedora-infra/anitya#2272 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 80/100
unitaryfoundation/mitiq#3205 ·
维护者通常 6 天内回复
-
[Bug]: Index worker test drops empty Git config values on Windows可能已有人在做 @xiaoyesoso 今天认领。 未关闭triage/confirmed
难度 2/5 1-3 小时 新手友好度 82/100
agentscope-ai/agentscope#4377 · 2 条评论 ·
维护者通常 2 天内回复
-
area/config comp/agent P2 type/perf
难度 2/5 1-3 小时 新手友好度 75/100
NousResearch/hermes-agent#161039 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
astral-sh/ty-pre-commit#46 ·