Skip to content

Commit bb2180e

Browse files
authored
Merge branch 'master' into function_gamma_fix
2 parents ab5fa3b + 8c64c12 commit bb2180e

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

docs/mintlify/reference/camel.agents.chat_agent.mdx

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,7 @@ Class for managing conversations of CAMEL Chat Agents.
258258
- **memory** (AgentMemory, optional): The agent memory for managing chat messages. If `None`, a :obj:`ChatHistoryMemory` will be used. (default: :obj:`None`)
259259
- **message_window_size** (int, optional): The maximum number of previous messages to include in the context window. If `None`, no windowing is performed. (default: :obj:`None`)
260260
- **summarize_threshold** (int, optional): The percentage of the context window that triggers summarization. If `None`, will trigger summarization when the context window is full. (default: :obj:`None`)
261+
- **token_limit** (int, optional): The maximum number of tokens allowed for the context window. If `None`, uses the model's default token limit. This can be used to restrict the context size below the model's maximum capacity. (default: :obj:`None`)
261262
- **output_language** (str, optional): The language to be output by the agent. (default: :obj:`None`)
262263
- **tools** (Optional[List[Union[FunctionTool, Callable]]], optional): List of available :obj:`FunctionTool` or :obj:`Callable`. (default: :obj:`None`) toolkits_to_register_agent (Optional[List[RegisteredAgentToolkit]], optional): List of toolkit instances that inherit from :obj:`RegisteredAgentToolkit`. The agent will register itself with these toolkits, allowing them to access the agent instance. Note: This does NOT add the toolkit's tools to the agent. To use tools from these toolkits, pass them explicitly via the `tools` parameter. (default: :obj:`None`) external_tools (Optional[List[Union[FunctionTool, Callable, Dict[str, Any]]]], optional): List of external tools (:obj:`FunctionTool` or :obj:`Callable` or :obj:`Dict[str, Any]`) bind to one chat agent. When these tools are called, the agent will directly return the request instead of processing it. (default: :obj:`None`)
263264
- **response_terminators** (List[ResponseTerminator], optional): List of :obj:`ResponseTerminator` bind to one chat agent. (default: :obj:`None`)
@@ -386,6 +387,16 @@ def tool_dict(self):
386387

387388
Returns a dictionary of internal tools.
388389

390+
<a id="camel.agents.chat_agent.ChatAgent.token_limit"></a>
391+
392+
### token_limit
393+
394+
```python
395+
def token_limit(self):
396+
```
397+
398+
Returns the token limit for the agent's context window.
399+
389400
<a id="camel.agents.chat_agent.ChatAgent.output_language"></a>
390401

391402
### output_language
@@ -617,6 +628,27 @@ Add a list of tools to the agent.
617628
def _serialize_tool_result(self, result: Any):
618629
```
619630

631+
<a id="camel.agents.chat_agent.ChatAgent._truncate_tool_result"></a>
632+
633+
### _truncate_tool_result
634+
635+
```python
636+
def _truncate_tool_result(self, func_name: str, result: Any):
637+
```
638+
639+
Truncate tool result if it exceeds the maximum token limit.
640+
641+
**Parameters:**
642+
643+
- **func_name** (str): The name of the tool function called.
644+
- **result** (Any): The result returned by the tool execution.
645+
646+
**Returns:**
647+
648+
Tuple[Any, bool]: A tuple containing:
649+
- The (possibly truncated) result
650+
- A boolean indicating whether truncation occurred
651+
620652
<a id="camel.agents.chat_agent.ChatAgent._clean_snapshot_line"></a>
621653

622654
### _clean_snapshot_line

0 commit comments

Comments
 (0)