Platform for stateful agents: AI with advanced memory that can learn and self-improve over time.
fix: pass llm_config to streaming interface for BYOK error tagging (#10204)
cthomas3cdecd8991c3
diff --git a/letta/adapters/simple_llm_stream_adapter.py b/letta/adapters/simple_llm_stream_adapter.pyindex 4aba6b5d5..af6cf9e61 100644--- a/letta/adapters/simple_llm_stream_adapter.py+++ b/letta/adapters/simple_llm_stream_adapter.py@@ -84,6 +84,7 @@ class SimpleLLMStreamAdapter(LettaLLMStreamAdapter):requires_approval_tools=requires_approval_tools,run_id=self.run_id,step_id=step_id,+ llm_config=self.llm_config,)elif self.llm_config.model_endpoint_type in [ProviderType.openai,diff --git a/letta/interfaces/anthropic_parallel_tool_call_streaming_interface.py b/letta/interfaces/anthropic_parallel_tool_call_streaming_interface.pyindex bde3d6660..e9d4a5902 100644--- a/letta/interfaces/anthropic_parallel_tool_call_streaming_interface.py+++ b/letta/interfaces/anthropic_parallel_tool_call_streaming_interface.py@@ -8,6 +8,7 @@ from typing import TYPE_CHECKING, Optionalif TYPE_CHECKING:from opentelemetry.trace import Span+ from letta.schemas.llm_config import LLMConfigfrom letta.schemas.usage import LettaUsageStatisticsfrom anthropic import AsyncStream@@ -79,10 +80,12 @@ class SimpleAnthropicStreamingInterface:requires_approval_tools: list = [],run_id: str | None = None,step_id: str | None = None,+ llm_config: "LLMConfig | None" = None,):self.json_parser: JSONParser = PydanticJSONParser()self.run_id = run_idself.step_id = step_id+ self.llm_config = llm_config# Premake IDs for database writesself.letta_message_id = Message.generate_id()@@ -284,7 +287,7 @@ class SimpleAnthropicStreamingInterface:from letta.llm_api.anthropic_client import AnthropicClientclient = AnthropicClient()- transformed_error = client.handle_llm_error(e)+ transformed_error = client.handle_llm_error(e, llm_config=self.llm_config)raise transformed_errorfinally:logger.info("AnthropicStreamingInterface: Stream processing complete.")diff --git a/letta/llm_api/anthropic_client.py b/letta/llm_api/anthropic_client.pyindex 46e6ea7c9..344c3000e 100644--- a/letta/llm_api/anthropic_client.py+++ b/letta/llm_api/anthropic_client.py@@ -218,6 +218,7 @@ class AnthropicClient(LLMClientBase):requires_approval_tools=[],run_id=None,step_id=None,+ llm_config=llm_config,)# Get the streaming responsediff --git a/letta/services/summarizer/summarizer.py b/letta/services/summarizer/summarizer.pyindex cd2cb5b19..d7945b824 100644--- a/letta/services/summarizer/summarizer.py+++ b/letta/services/summarizer/summarizer.py@@ -835,6 +835,7 @@ async def _execute_summarizer_request(req_data: dict, req_messages_obj: list[Mesrequires_approval_tools=[],run_id=None,step_id=None,+ llm_config=llm_config,)# AnthropicClient.stream_async sets request_data["stream"] = True internally.