Skip to content

Python: [Feature]: ChatAgent run should yield a Generic AgentRunResponse for response_format types #3091

@tonybaloney

Description

@tonybaloney

Language

Python

Type of Issue

Feature Request

agent-framework-core

1.0.0b251223

agent-framework-azure-ai

1.0.0b251223

Description

My Agent Framework run is all beautifully typed with the exception of ChatAgent.run

Code Sample

response = await self.agent.run(message, response_format=StockItemCollection)

response.value # has type of Unknown

The AgentRunResponse type should have a generic overload for response_format:

async def run(
        self,
        messages: str | ChatMessage | list[str] | list[ChatMessage] | None = None,
        *,
        thread: AgentThread | None = None,
        allow_multiple_tool_calls: bool | None = None,
        frequency_penalty: float | None = None,
        logit_bias: dict[str | int, float] | None = None,
        max_tokens: int | None = None,
        metadata: dict[str, Any] | None = None,
        model_id: str | None = None,
        presence_penalty: float | None = None,
        response_format: TRes | None = None,
        seed: int | None = None,
        stop: str | Sequence[str] | None = None,
        store: bool | None = None,
        temperature: float | None = None,
        tool_choice: ToolMode | Literal["auto", "required", "none"] | dict[str, Any] | None = None,
        tools: ToolProtocol
        | Callable[..., Any]
        | MutableMapping[str, Any]
        | list[ToolProtocol | Callable[..., Any] | MutableMapping[str, Any]]
        | None = None,
        top_p: float | None = None,
        user: str | None = None,
        additional_chat_options: dict[str, Any] | None = None,
        **kwargs: Any,
    ) -> AgentRunResponse[TRes]:

Where TRes is the type of response_format, then AgentRunResponse types the value field as TRes.

Metadata

Metadata

Labels

agentsIssues related to single agentsenhancementNew feature or requestpythonv1.0Features being tracked for the version 1.0 GA

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions