mirror of
https://github.com/khoj-ai/khoj.git
synced 2024-11-30 10:53:02 +01:00
Improve structured message truncation in logger
Previously chatml messages were just strings. Since gemini, anthropic models always have messages as list of strings, truncate those strings instead of the list of message content
This commit is contained in:
parent
153ae8bea9
commit
15b0cfa3dd
2 changed files with 2 additions and 2 deletions
|
@ -215,7 +215,7 @@ def converse_anthropic(
|
||||||
|
|
||||||
messages, system_prompt = format_messages_for_anthropic(messages, system_prompt)
|
messages, system_prompt = format_messages_for_anthropic(messages, system_prompt)
|
||||||
|
|
||||||
truncated_messages = "\n".join({f"{message.content[:40]}..." for message in messages})
|
truncated_messages = "\n".join({f"{content[:70]}..." for message in messages for content in message.content})
|
||||||
logger.debug(f"Conversation Context for Claude: {truncated_messages}")
|
logger.debug(f"Conversation Context for Claude: {truncated_messages}")
|
||||||
|
|
||||||
# Get Response from Claude
|
# Get Response from Claude
|
||||||
|
|
|
@ -226,7 +226,7 @@ def converse_gemini(
|
||||||
|
|
||||||
messages, system_prompt = format_messages_for_gemini(messages, system_prompt)
|
messages, system_prompt = format_messages_for_gemini(messages, system_prompt)
|
||||||
|
|
||||||
truncated_messages = "\n".join({f"{message.content[:40]}..." for message in messages})
|
truncated_messages = "\n".join({f"{content[:70]}..." for message in messages for content in message.content})
|
||||||
logger.debug(f"Conversation Context for Gemini: {truncated_messages}")
|
logger.debug(f"Conversation Context for Gemini: {truncated_messages}")
|
||||||
|
|
||||||
# Get Response from Google AI
|
# Get Response from Google AI
|
||||||
|
|
Loading…
Reference in a new issue