🐫 CAMEL: The first and the best multi-agent framework. Finding the Scaling Law of Agents. https://www.camel-ai.org
Python agentai-societiesartificial-intelligencecommunicative-aicooperative-aideep-learninglarge-language-modelsmulti-agent-systemsnatural-language-processing
Auto-update documentation after merge
camel-docs-bot105e37e39b50
diff --git a/docs/mintlify/reference/camel.agents.chat_agent.mdx b/docs/mintlify/reference/camel.agents.chat_agent.mdxindex 78485c61e..8899dfce7 100644--- a/docs/mintlify/reference/camel.agents.chat_agent.mdx+++ b/docs/mintlify/reference/camel.agents.chat_agent.mdx@@ -254,11 +254,21 @@ def update_memory(Updates the agent memory with a new message.+If the single *message* exceeds the model's context window, it will+be **automatically split into multiple smaller chunks** before being+written into memory. This prevents later failures in+`ScoreBasedContextCreator` where an over-sized message cannot fit+into the available token budget at all.++This slicing logic handles both regular text messages (in the+`content` field) and long tool call results (in the `result` field of+a `FunctionCallingMessage`).+**Parameters:**- **message** (BaseMessage): The new message to add to the stored messages.- **role** (OpenAIBackendRole): The backend role type.-- **timestamp** (Optional[float], optional): Custom timestamp for the memory record. If None, current timestamp will be used. (default: :obj:`None`)+- **timestamp** (Optional[float], optional): Custom timestamp for the memory record. If `None`, the current time will be used. (default: :obj:`None`) (default: obj:`None`)<a id="camel.agents.chat_agent.ChatAgent.load_memory"></a>diff --git a/docs/mintlify/reference/camel.memories.context_creators.score_based.mdx b/docs/mintlify/reference/camel.memories.context_creators.score_based.mdxindex f2a9b948c..15fea7e99 100644--- a/docs/mintlify/reference/camel.memories.context_creators.score_based.mdx+++ b/docs/mintlify/reference/camel.memories.context_creators.score_based.mdx@@ -83,16 +83,20 @@ API compatibilitydef _group_tool_calls_and_responses(self, units: List[_ContextUnit]):```-Groups tool calls with their corresponding responses.+Groups tool calls with their corresponding responses based on+`tool_call_id`.++This improved logic robustly gathers all messages (assistant requests+and tool responses, including chunks) that share a `tool_call_id`.**Parameters:**-- **units** (List[_ContextUnit]): List of context units to analyze+- **units** (List[_ContextUnit]): List of context units to analyze.**Returns:**- Dict[str, List[_ContextUnit]]: Mapping from tool_call_id to list of-related units (tool call + responses)+ Dict[str, List[_ContextUnit]]: Mapping from `tool_call_id` to a+list of related units.<a id="camel.memories.context_creators.score_based.ScoreBasedContextCreator._truncate_with_tool_call_awareness"></a>@@ -108,16 +112,24 @@ def _truncate_with_tool_call_awareness(```Truncates messages while preserving tool call-response pairs.+This method implements a more sophisticated truncation strategy:+1. It treats tool call groups (request + responses) and standalone+messages as individual items to be included.+2. It sorts all items by score and greedily adds them to the context.+3. **Partial Truncation**: If a complete tool group is too large to+fit,it attempts to add the request message and as many of the most+recent response chunks as the token budget allows.**Parameters:**-- **regular_units** (List[_ContextUnit]): All regular message units-- **tool_call_groups** (Dict[str, List[_ContextUnit]]): Grouped tool calls-- **system_tokens** (int): Tokens used by system message+- **regular_units** (List[_ContextUnit]): All regular message units.+- **tool_call_groups** (Dict[str, List[_ContextUnit]]): Grouped tool calls.+- **system_tokens** (int): Tokens used by the system message.**Returns:**- List[_ContextUnit]: Units that fit within token limit+ List[_ContextUnit]: A list of units that fit within the token+limit.<a id="camel.memories.context_creators.score_based.ScoreBasedContextCreator._extract_system_message"></a>@@ -141,31 +153,6 @@ Extracts the system message from records and validates it.- An empty list, serving as the initial container for regularmessages.-<a id="camel.memories.context_creators.score_based.ScoreBasedContextCreator._truncation_sort_key"></a>--### _truncation_sort_key--```python-def _truncation_sort_key(self, unit: _ContextUnit):-```--Defines the sorting key for the truncation phase.--Sorting priority:-- Primary: Sort by score in descending order (higher scores first).-- Secondary: Sort by timestamp in ascending order (older messages-first when scores are equal).--**Parameters:**--- **unit** (_ContextUnit): A `_ContextUnit` representing a conversation record.--**Returns:**-- Tuple[float, float]:-- Negative score for descending order sorting.-- Timestamp for ascending order sorting.-<a id="camel.memories.context_creators.score_based.ScoreBasedContextCreator._conversation_sort_key"></a>### _conversation_sort_key