Skip to content

Commit 4740f7c

Browse files
authored
Merge pull request #415 from Scale3-Labs/development
Add `usage` to mistral instrumentation
2 parents 33f36e0 + 8672c8f commit 4740f7c

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

src/langtrace_python_sdk/instrumentation/mistral/patch.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646

4747

4848
def 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))
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "3.3.8"
1+
__version__ = "3.3.9"

0 commit comments

Comments
 (0)