Convo
dopus.core.Convo
A class to manage the conversational context window.
Attributes:
| Name | Type | Description |
|---|---|---|
__messages |
List[Dict[str, Any]]
|
A list of messages. |
add_tool_call
Adds a tool call and its result to the conversation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
metadata |
Dict[str, Any]
|
Metadata about the tool call. |
required |
result |
Any
|
The result of the tool call. |
required |
append
Appends a message to the conversation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
role |
str
|
The role of the message sender (e.g., 'user', 'assistant'). |
required |
message |
Dict[str, Any]
|
The message content. |
required |
msg_type |
str
|
The type of the message. Defaults to "default". |
'default'
|
get_all_of_type
Retrieves all messages of a specific type.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
msg_type |
str
|
The type of messages to retrieve. |
required |
Returns:
| Type | Description |
|---|---|
List[Dict[str, Any]]
|
List[Dict[str, Any]]: A list of messages of the specified type. |
remove_all_of_type
Removes all messages of a specific type.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
msg_type |
str
|
The type of messages to remove. |
required |