aiflows.history package

Submodules

aiflows.history.flow_history module

class aiflows.history.flow_history.FlowHistory

Bases: object

Represents a history of messages.

Attributes:

messages (List[Messages]): A list of the messages comprising the history of a flow.

add_message(message: Message) None

Adds a message to the history.

Parameters:

message (Message) – The message to add.

get_last_n_messages(n: int) List[Message]

Returns a list representation of the last n messages in the history.

Parameters:

n (int) – The number of messages to return.

Returns:

The list representation of the last n messages in the history.

Return type:

List[Message]

to_list() List[Dict]

Returns a list representation of the history.

Returns:

The list representation of the history.

Return type:

List[Dict]

to_string() str

Returns a string representation of the history.

Returns:

The string representation of the history.

Return type:

str

Module contents