Skip to main content

agenthub.monologue_agent.utils.monologue

Monologue Objects

class Monologue()

The monologue is a representation for the agent's internal monologue where it can think. The agent has the capability of using this monologue for whatever it wants.

__init__

def __init__()

Initialize the empty list of thoughts

add_event

def add_event(t: dict)

Adds an event to memory if it is a valid event.

Arguments:

  • t (dict): The thought that we want to add to memory

Raises:

  • AgentEventTypeError: If t is not a dict

get_thoughts

def get_thoughts()

Get the current thoughts of the agent.

Returns:

  • List: The list of thoughts that the agent has.

get_total_length

def get_total_length()

Gives the total number of characters in all thoughts

Returns:

  • Int: Total number of chars in thoughts.

condense

def condense(llm: LLM)

Attempts to condense the monologue by using the llm

Arguments:

  • llm (LLM): llm to be used for summarization

Raises:

  • Exception: the same exception as it got from the llm or processing the response