Platform for stateful agents: AI with advanced memory that can learn and self-improve over time.
feat: add more trace methods (#2471)
Sarah Wooders4cc075f1fcc1
diff --git a/letta/llm_api/anthropic_client.py b/letta/llm_api/anthropic_client.pyindex b81967d42..eefee9651 100644--- a/letta/llm_api/anthropic_client.py+++ b/letta/llm_api/anthropic_client.py@@ -288,6 +288,7 @@ class AnthropicClient(LLMClientBase):token_count -= 8return token_count+ @trace_methoddef handle_llm_error(self, e: Exception) -> Exception:if isinstance(e, anthropic.APIConnectionError):logger.warning(f"[Anthropic] API connection error: {e.__cause__}")diff --git a/letta/llm_api/openai_client.py b/letta/llm_api/openai_client.pyindex d0633238d..919120941 100644--- a/letta/llm_api/openai_client.py+++ b/letta/llm_api/openai_client.py@@ -279,6 +279,7 @@ class OpenAIClient(LLMClientBase):return chat_completion_response+ @trace_methodasync def stream_async(self, request_data: dict, llm_config: LLMConfig) -> AsyncStream[ChatCompletionChunk]:"""Performs underlying asynchronous streaming request to OpenAI and returns the async stream iterator.@@ -290,6 +291,7 @@ class OpenAIClient(LLMClientBase):)return response_stream+ @trace_methoddef handle_llm_error(self, e: Exception) -> Exception:"""Maps OpenAI-specific errors to common LLMError types.