AgentContext#

class council.contexts.AgentContext(chat_history: ChatHistory)[source]#

Bases: object

Class representing the execution context of an Agent.

chatHistory#

The chat history.

Type:

ChatHistory

chainHistory#

The chain history for each Chain.

Type:

Dict[str, List[ChainHistory]]

evaluationHistory#

The iteration history of evaluated agent messages.

Type:

List[List[ScoredChatMessage]]

__init__(chat_history: ChatHistory)[source]#

Initializes the AgentContext with the provided chat history.

Parameters:

chat_history (ChatHistory) – The chat history.

last_chain_history_iteration(chain_name: str) ChainHistory | None[source]#

Retrieves the last iteration of the specified chain’s history.

Parameters:

chain_name (str) – The name of the chain.

Returns:

The last iteration of the specified chain’s history,

or None if the history is empty.

Return type:

Optional[ChainHistory]

Raises:

None

last_evaluator_iteration() List[ScoredChatMessage] | None[source]#

Retrieves the last iteration of the evaluator’s history.

Returns:

The last iteration of the evaluator’s history,

or None if the history is empty.

Return type:

Optional[List[ScoredChatMessage]]

new_chain_context(name: str) ChainContext[source]#

Creates a new chain context for the specified chain name.

Parameters:

name (str) – The name of the chain.

Returns:

The new chain context.

Return type:

ChainContext