4646
4747
4848def chat_complete (original_method , version , tracer , is_async = False , is_streaming = False ):
49-
49+
5050 def traced_method (wrapped , instance , args , kwargs ):
5151 service_provider = SERVICE_PROVIDERS ["MISTRAL" ]
5252 llm_prompts = []
@@ -65,7 +65,6 @@ def traced_method(wrapped, instance, args, kwargs):
6565
6666 attributes = LLMSpanAttributes (** span_attributes )
6767
68-
6968 span = tracer .start_span (
7069 name = get_span_name (APIS [api ]["METHOD" ]),
7170 kind = SpanKind .CLIENT ,
@@ -87,7 +86,6 @@ def traced_method(wrapped, instance, args, kwargs):
8786 span .set_status (StatusCode .OK )
8887 span .end ()
8988 return result
90-
9189
9290 except Exception as error :
9391 span .record_exception (error )
@@ -186,7 +184,6 @@ def _set_response_attributes(span, kwargs, result):
186184 for choice in result .choices
187185 ]
188186 set_event_completion (span , responses )
189-
190187 # Get the usage
191188 if hasattr (result , "usage" ) and result .usage is not None :
192- set_usage_attributes (span , result .usage )
189+ set_usage_attributes (span , dict ( result .usage ) )
0 commit comments