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

Stream=True incompatible with response_model in Streamlit context #1871

Open
rpvitruvix opened this issue Jan 23, 2025 · 0 comments
Open

Stream=True incompatible with response_model in Streamlit context #1871

rpvitruvix opened this issue Jan 23, 2025 · 0 comments

Comments

@rpvitruvix
Copy link

Similar to issue #1642 but in a Streamlit context.
When using an Agent with both response_model and stream=True, I get:

  1. Error: 'tuple' object has no attribute 'content'
  2. Warning: Failed to convert response to response_model

My setup uses Claude agents configured with:

  • response_model=Article (Pydantic model)
  • stream=True
  • markdown=True
  • debug_mode=True
class Article(BaseModel):
    """Represents a complete article"""
    title: str
    sections: List[Section]
    main_sources: List[Source] = Field(default_factory=list)
    internal_links: List[str] = Field(default_factory=list)

writer_agent = Agent(
    model=Claude(id=CLAUDE_MODEL_ID, api_key=ANTHROPIC_API_KEY),
    team=[planner_agent, researcher_agent, content_agent],
    response_model=Article,
    markdown=True,
    debug_mode=True,
)
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

1 participant