Del via


ChatHistoryChannel Class

An AgentChannel specialization for that acts upon a ChatHistoryHandler.

Note: This class is marked as 'experimental' and may change in the future.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Constructor

ChatHistoryChannel(*, messages: list[ChatMessageContent] = None, system_message: str | None = None)

Keyword-Only Parameters

Name Description
messages
Required
system_message
Required

Methods

get_history

Retrieve the message history specific to this channel.

invoke

Perform a discrete incremental interaction between a single Agent and AgentChat.

invoke_stream

Perform a discrete incremental stream interaction between a single Agent and AgentChat.

receive

Receive the conversation messages.

Do not include messages that only contain file references.

reset

Reset the channel state.

get_history

Retrieve the message history specific to this channel.

async get_history() -> AsyncIterable[ChatMessageContent]

Returns

Type Description

An async iterable of ChatMessageContent.

invoke

Perform a discrete incremental interaction between a single Agent and AgentChat.

async invoke(agent: Agent, **kwargs: Any) -> AsyncIterable[tuple[bool, ChatMessageContent]]

Parameters

Name Description
agent
Required

The agent to interact with.

kwargs
Required

The keyword arguments.

Returns

Type Description

An async iterable of ChatMessageContent.

invoke_stream

Perform a discrete incremental stream interaction between a single Agent and AgentChat.

async invoke_stream(agent: Agent, messages: list[ChatMessageContent], **kwargs: Any) -> AsyncIterable[StreamingChatMessageContent]

Parameters

Name Description
agent
Required

The agent to interact with.

messages
Required

The history of messages in the conversation.

kwargs
Required

The keyword arguments

Returns

Type Description

An async iterable of ChatMessageContent.

receive

Receive the conversation messages.

Do not include messages that only contain file references.

async receive(history: list[ChatMessageContent]) -> None

Parameters

Name Description
history
Required

The history of messages in the conversation.

reset

Reset the channel state.

async reset() -> None

Attributes

ALLOWED_CONTENT_TYPES

ALLOWED_CONTENT_TYPES: ClassVar[tuple[type, ...]] = (<class 'semantic_kernel.contents.image_content.ImageContent'>, <class 'semantic_kernel.contents.function_call_content.FunctionCallContent'>, <class 'semantic_kernel.contents.function_result_content.FunctionResultContent'>, <class 'semantic_kernel.contents.streaming_text_content.StreamingTextContent'>, <class 'semantic_kernel.contents.text_content.TextContent'>)

is_experimental

is_experimental = True

stage_status

stage_status = 'experimental'