Platform for stateful agents: AI with advanced memory that can learn and self-improve over time.
fix: Spurious empty chunk warning on Claude (#2476)
Will Sargentfb092d7fa925
diff --git a/letta/server/rest_api/interface.py b/letta/server/rest_api/interface.pyindex 102835d02..d728f60d5 100644--- a/letta/server/rest_api/interface.py+++ b/letta/server/rest_api/interface.py@@ -918,13 +918,15 @@ class StreamingServerInterface(AgentChunkStreamingInterface):# skip if there's a finishreturn Noneelse:- # Example case that would trigger here:- # id='chatcmpl-AKtUvREgRRvgTW6n8ZafiKuV0mxhQ'- # choices=[ChunkChoice(finish_reason=None, index=0, delta=MessageDelta(content=None, tool_calls=None, function_call=None), logprobs=None)]- # created=datetime.datetime(2024, 10, 21, 20, 40, 57, tzinfo=TzInfo(UTC))- # model='gpt-4o-mini-2024-07-18'- # object='chat.completion.chunk'- warnings.warn(f"Couldn't find delta in chunk: {chunk}")+ # Only warn for non-Claude models since Claude commonly has empty first chunks+ if not chunk.model.startswith("claude-"):+ # Example case that would trigger here:+ # id='chatcmpl-AKtUvREgRRvgTW6n8ZafiKuV0mxhQ'+ # choices=[ChunkChoice(finish_reason=None, index=0, delta=MessageDelta(content=None, tool_calls=None, function_call=None), logprobs=None)]+ # created=datetime.datetime(2024, 10, 21, 20, 40, 57, tzinfo=TzInfo(UTC))+ # model='gpt-4o-mini-2024-07-18'+ # object='chat.completion.chunk'+ warnings.warn(f"Couldn't find delta in chunk: {chunk}")return Nonereturn processed_chunk