Skip to content

armgit / camel

Public Imported from GitHub
0

🐫 CAMEL: The first and the best multi-agent framework. Finding the Scaling Law of Agents. https://www.camel-ai.org

Auto-update documentation after merge

camel-docs-bot835cdfa82fd8
diff --git a/docs/mintlify/reference/camel.memories.context_creators.score_based.mdx b/docs/mintlify/reference/camel.memories.context_creators.score_based.mdx
index f9665a2f4..f2a9b948c 100644
--- a/docs/mintlify/reference/camel.memories.context_creators.score_based.mdx
+++ b/docs/mintlify/reference/camel.memories.context_creators.score_based.mdx
@@ -62,6 +62,8 @@ Key strategies:
3. Final output maintains chronological order and in history memory,
the score of each message decreases according to keep_rate. The
newer the message, the higher the score.
+4. Tool calls and their responses are kept together to maintain
+API compatibility
**Parameters:**
@@ -73,6 +75,50 @@ newer the message, the higher the score.
- Ordered list of OpenAI messages
- Total token count of the final context
+<a id="camel.memories.context_creators.score_based.ScoreBasedContextCreator._group_tool_calls_and_responses"></a>
+
+### _group_tool_calls_and_responses
+
+```python
+def _group_tool_calls_and_responses(self, units: List[_ContextUnit]):
+```
+
+Groups tool calls with their corresponding responses.
+
+**Parameters:**
+
+- **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)
+
+<a id="camel.memories.context_creators.score_based.ScoreBasedContextCreator._truncate_with_tool_call_awareness"></a>
+
+### _truncate_with_tool_call_awareness
+
+```python
+def _truncate_with_tool_call_awareness(
+ self,
+ regular_units: List[_ContextUnit],
+ tool_call_groups: Dict[str, List[_ContextUnit]],
+ system_tokens: int
+):
+```
+
+Truncates messages while preserving tool call-response pairs.
+
+**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
+
+**Returns:**
+
+ List[_ContextUnit]: Units that fit within token limit
+
<a id="camel.memories.context_creators.score_based.ScoreBasedContextCreator._extract_system_message"></a>
### _extract_system_message