File tree Expand file tree Collapse file tree 2 files changed +39
-2
lines changed
Expand file tree Collapse file tree 2 files changed +39
-2
lines changed Original file line number Diff line number Diff line change @@ -216,14 +216,24 @@ def _parse_model_response(
216216 ):
217217 tool_calls = [call .model_dump () for call in choice .message .tool_calls ]
218218
219- extra = {"response_id" : response .id }
219+ extra : dict [ str , t . Any ] = {"response_id" : response .id }
220220 if hasattr (response , "provider" ):
221221 extra ["provider" ] = response .provider
222222 if (
223223 hasattr (choice .message , "provider_specific_fields" )
224224 and choice .message .provider_specific_fields is not None
225225 ):
226226 extra .update (choice .message .provider_specific_fields )
227+ if (
228+ hasattr (choice .message , "reasoning_content" )
229+ and choice .message .reasoning_content is not None
230+ ):
231+ extra ["reasoning_content" ] = choice .message .reasoning_content
232+ if (
233+ hasattr (choice .message , "thinking_blocks" )
234+ and choice .message .thinking_blocks is not None
235+ ):
236+ extra ["thinking_blocks" ] = choice .message .thinking_blocks
227237
228238 message = Message (
229239 role = "assistant" ,
Original file line number Diff line number Diff line change 1+ import typing as t
2+
13import logfire_api
24
35Span = logfire_api .LogfireSpan
46
5- tracer = logfire_api .Logfire (otel_scope = "rigging" )
7+
8+ class Tracer (logfire_api .Logfire ):
9+ def span (
10+ self ,
11+ msg_template : str ,
12+ / ,
13+ * ,
14+ _tags : t .Sequence [str ] | None = None ,
15+ _span_name : str | None = None ,
16+ _level : t .Any | None = None ,
17+ _links : t .Any = (),
18+ ** attributes : t .Any ,
19+ ) -> logfire_api .LogfireSpan :
20+ # Pass msg_template as the span name
21+ # to avoid weird fstring behaviors
22+ return super ().span (
23+ msg_template ,
24+ _tags = _tags ,
25+ _span_name = msg_template ,
26+ _level = _level ,
27+ _links = _links ,
28+ ** attributes ,
29+ )
30+
31+
32+ tracer = Tracer (otel_scope = "rigging" )
You can’t perform that action at this time.
0 commit comments