Skip to content

Commit 98a90f7

Browse files
committed
Merge branch 'development' of github.com:Scale3-Labs/langtrace-python-sdk into ali/bedrock-refactor
2 parents 545859b + 12807d6 commit 98a90f7

File tree

3 files changed

+15
-10
lines changed

3 files changed

+15
-10
lines changed

src/langtrace_python_sdk/instrumentation/autogen/patch.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -92,13 +92,16 @@ def traced_method(wrapped, instance, args, kwargs):
9292
set_span_attributes(span, attributes)
9393
set_event_completion(span, [{"role": "assistant", "content": result}])
9494
if llm_config:
95-
total_cost, response_model = list(instance.get_total_usage().keys())
96-
set_span_attribute(
97-
span, SpanAttributes.LLM_RESPONSE_MODEL, response_model
98-
)
99-
set_usage_attributes(
100-
span, instance.get_total_usage().get(response_model)
101-
)
95+
if instance.get_total_usage() is not None:
96+
total_cost, response_model = list(
97+
instance.get_total_usage().keys()
98+
)
99+
set_span_attribute(
100+
span, SpanAttributes.LLM_RESPONSE_MODEL, response_model
101+
)
102+
set_usage_attributes(
103+
span, instance.get_total_usage().get(response_model)
104+
)
102105

103106
return result
104107

src/langtrace_python_sdk/instrumentation/weaviate/patch.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,9 @@
4949
def extract_inputs(args, kwargs):
5050
extracted_params = {}
5151
kwargs_without_properties = {
52-
k: v for k, v in kwargs.items() if k not in ["properties", "fusion_type", "filters"]
52+
k: v
53+
for k, v in kwargs.items()
54+
if k not in ["properties", "fusion_type", "filters"]
5355
}
5456
extracted_params.update(extract_input_params(args, kwargs_without_properties))
5557
if kwargs.get("filters", None):
@@ -94,7 +96,7 @@ def aggregate_responses(result):
9496
# For single object responses
9597
all_responses = get_response_object_attributes(result)
9698

97-
return json.dumps(all_responses)
99+
return json.dumps(all_responses, default=str)
98100

99101

100102
def get_response_object_attributes(response_object):
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "3.3.19"
1+
__version__ = "3.3.21"

0 commit comments

Comments
 (0)