Async streaming ignores response_model and returns raw text
Maintainer thường phản hồi trong vòng 1 ngày
@laoyyu đang làm issue này rồi.
Từ ngày 9/11/2026.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 25/100
Hướng nghiên cứu
Read lib/crewai/src/crewai/llm.py, comparing _ahandle_streaming_response with _handle_streaming_response and how the sync path uses InternalInstructor. Reproduce with LLM.acall(..., response_model=Answer) and confirm the async result is raw text. Done means async streaming returns the serialized structured response; a linked open pull request is already addressing this issue.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Description
LLM.acall(..., response_model=...) with stream=True returns the raw streamed string instead of the validated model.
The sync path (_handle_streaming_response) converts the accumulated text through InternalInstructor and returns model_dump_json() when a response_model is configured, but the async twin (_ahandle_streaming_response) accepts the same response_model argument and never uses it.
Steps to reproduce
from pydantic import BaseModel
from crewai import LLM
class Answer(BaseModel):
answer: str
llm = LLM(model="gpt-4o-mini", stream=True)
sync = llm.call("What is 6 * 7?", response_model=Answer) # '{"answer": "42"}'
async_ = await llm.acall("What is 6 * 7?", response_model=Answer) # 'The answer is 42.' (raw text)
Expected behavior
Both code paths should return the serialized structured response; async streaming should not silently downgrade to unstructured text. Any downstream Answer.model_validate_json(result) then fails with a JSON decode error even though the model answered correctly.
Environment
- crewai: current
main(lib/crewai/src/crewai/llm.py,_ahandle_streaming_response)
- Ngôn ngữ chính
- Python
- Star
- 60.6k
- Fork
- 9.1k
- Merge trung bình
- 1 ngày 9 giờ
- Pull request đã merge (30 ngày)
- 218
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của crewAIInc/crewAI
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Feature request: GoldenDirectiveTool (harmonic relationship score, full vs cropped reporting)Đang mởfeature-request
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
crewAIInc/crewAI#9200 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[FEATURE] Docs: ApifyActorsTool example with a typed-input ActorCó thể đã có người làm @johnisanerd đã nhận 1 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
crewAIInc/crewAI#9132 · 5 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[BUG] Scrape tools reject the documented cookies mapping and drop cookies when the URL is passed at runtimeCó thể đã có người làm @Luckyou-d đã nhận 7 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
[BUG] OpenAI-compatible embedding model alias breaks embedder constructionCó thể đã có người làm @gokay-ai đã nhận 13 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
crewAIInc/crewAI#8761 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của crewAIInc/crewAI
Issue tương tự
-
question
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 68/100
vllm-project/vime#524 ·
Maintainer thường phản hồi trong vòng 7 ngày
-
WOPI editor page is scrollable by a few pixels, which breaks scrolling in the document (Firefox)Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
suitenumerique/drive#969 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
no retries on HTTP 5xx errorsĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 67/100
theupdateframework/python-tuf#3044 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
FAIRmat-NFDI/pynxtools#861 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
NVIDIA/nsight-python#88 ·
Maintainer thường phản hồi trong vòng 1 ngày