fix(thread_manager): reduce maximum message content length from 300k to 200k characters to prevent context overload

This commit is contained in:
sharath 2025-05-29 15:50:29 +00:00
parent 0bfd7ecb3f
commit c14a2e4cb4
No known key found for this signature in database
1 changed files with 1 additions and 1 deletions

View File

@ -337,7 +337,7 @@ Here are the XML tools available with examples:
if message_id:
msg["content"] = msg["content"][:10000] + "... (truncated)" + f"\n\nThis message is too long, use the expand-message tool with message_id \"{message_id}\" to see the full message" # Truncate the message
else:
msg["content"] = msg["content"][:300000] + f"\n\nThis message is too long, repeat relevant information in your response to remember it" # Truncate to 300k characters to avoid overloading the context at once, but don't truncate otherwise
msg["content"] = msg["content"][:200000] + f"\n\nThis message is too long, repeat relevant information in your response to remember it" # Truncate to 300k characters to avoid overloading the context at once, but don't truncate otherwise
compressed_total_token_count = token_counter(model=llm_model, messages=prepared_messages)
logger.info(f"token_compression: {uncompressed_total_token_count} -> {compressed_total_token_count}") # Log the token compression for debugging later