mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-11 22:51:28 +00:00
fix: make it clearer to the llm that a compaction happened
This commit is contained in:
parent
cd56c10b41
commit
2c4d6cb343
2 changed files with 7 additions and 3 deletions
|
|
@ -169,7 +169,6 @@ def _append_compaction_output(
|
|||
"type": "compaction",
|
||||
"id": "cmp_" + uuid.uuid4().hex,
|
||||
"encrypted_content": encoded_content,
|
||||
"created_by": None,
|
||||
}
|
||||
if existing_output:
|
||||
return [existing_output[0], compaction_item] + list(existing_output[1:])
|
||||
|
|
|
|||
|
|
@ -390,8 +390,13 @@ class LiteLLMCompletionResponsesConfig:
|
|||
else:
|
||||
decoded_content = compaction_item.get("content", "")
|
||||
messages.append(
|
||||
ChatCompletionUserMessage(
|
||||
role="user", content=decoded_content
|
||||
ChatCompletionSystemMessage(
|
||||
role="system",
|
||||
content=(
|
||||
"The following is a summary of the prior conversation history, "
|
||||
"which was compacted to save context space. Treat this as established "
|
||||
"context, not as a new user message:\n\n" + decoded_content
|
||||
),
|
||||
)
|
||||
)
|
||||
if last_compaction_idx > 0:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue