Skip to content

Python: clients: Combine get_response methods with stream parameter and TypedDict #3617

@eavanvalkenburg

Description

@eavanvalkenburg

Consider combining get_response and get_streaming_response methods into one, using a stream parameter. Also consider using a generic TypedDict for provider-specific parameters.

File: python/packages/core/agent_framework/_clients.py
Location: ChatClientProtocol protocol, get_response method (Lines ~93-96)

Proposal:

  1. Use stream: bool parameter to combine both methods (while keeping agent.run and agent.run_stream separate)
  2. Use a generic TypedDict as kwargs to allow provider-specific parameters
  3. This could support type checking and IDE autocompletion
  4. Users could provide their own TypedDict

Extracted from #3096
Parent issue: #3575

Metadata

Metadata

Labels

pythonv1.0Features being tracked for the version 1.0 GA

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions