You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/mintlify/reference/camel.agents.chat_agent.mdx
+11-1Lines changed: 11 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -254,11 +254,21 @@ def update_memory(
254
254
255
255
Updates the agent memory with a new message.
256
256
257
+
If the single *message* exceeds the model's context window, it will
258
+
be **automatically split into multiple smaller chunks** before being
259
+
written into memory. This prevents later failures in
260
+
`ScoreBasedContextCreator` where an over-sized message cannot fit
261
+
into the available token budget at all.
262
+
263
+
This slicing logic handles both regular text messages (in the
264
+
`content` field) and long tool call results (in the `result` field of
265
+
a `FunctionCallingMessage`).
266
+
257
267
**Parameters:**
258
268
259
269
-**message** (BaseMessage): The new message to add to the stored messages.
260
270
-**role** (OpenAIBackendRole): The backend role type.
261
-
-**timestamp** (Optional[float], optional): Custom timestamp for the memory record. If None, current timestamp will be used. (default: :obj:`None`)
271
+
-**timestamp** (Optional[float], optional): Custom timestamp for the memory record. If `None`, the current time will be used. (default: :obj:`None`) (default: obj:`None`)
0 commit comments