feat: add tracing to streaming interface (#2477)

This commit is contained in:
cthomas
2025-05-27 16:20:05 -07:00
committed by GitHub
parent bedc05d95c
commit 871e171b44
3 changed files with 5 additions and 1 deletions

View File

@@ -11,6 +11,7 @@ from letta.schemas.message import Message
from letta.schemas.openai.chat_completion_response import FunctionCall, ToolCall
from letta.server.rest_api.json_parser import OptimisticJSONParser
from letta.streaming_utils import JSONInnerThoughtsExtractor
from letta.tracing import trace_method
class OpenAIStreamingInterface:
@@ -64,6 +65,7 @@ class OpenAIStreamingInterface:
function=FunctionCall(arguments=self.current_function_arguments, name=function_name),
)
@trace_method
async def process(self, stream: AsyncStream[ChatCompletionChunk]) -> AsyncGenerator[LettaMessage, None]:
"""
Iterates over the OpenAI stream, yielding SSE events.