Skip to content

Commit 7e7b91d

Browse files
committed
Fix tests and linting
1 parent 8084a18 commit 7e7b91d

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

sentry_sdk/integrations/langchain.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ def on_tool_end(self, output, *, run_id, **kwargs):
364364
if not span_data:
365365
return
366366
if should_send_default_pii() and self.include_prompts:
367-
set_data_normalized(span_data.span, SPANDATA.AI_RESPONSES, [output])
367+
set_data_normalized(span_data.span, SPANDATA.AI_RESPONSES, output)
368368
span_data.span.__exit__(None, None, None)
369369
del self.span_map[run_id]
370370

sentry_sdk/integrations/openai.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,9 @@ def _calculate_chat_completion_usage(
7878
messages, response, span, streaming_message_responses=None
7979
):
8080
# type: (Iterable[ChatCompletionMessageParam], Any, Span, Optional[List[str]]) -> None
81-
completion_tokens = 0
82-
prompt_tokens = 0
83-
total_tokens = 0
81+
completion_tokens = 0 # type: Optional[int]
82+
prompt_tokens = 0 # type: Optional[int]
83+
total_tokens = 0 # type: Optional[int]
8484
if hasattr(response, "usage"):
8585
if hasattr(response.usage, "completion_tokens") and isinstance(
8686
response.usage.completion_tokens, int

tests/integrations/langchain/test_langchain.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,9 +149,9 @@ def test_langchain_agent(
149149
"You are very powerful"
150150
in chat_spans[0]["data"]["ai.input_messages"][0]["content"]
151151
)
152-
assert "5" in chat_spans[0]["data"]["ai.responses"][0]
152+
assert "5" in chat_spans[0]["data"]["ai.responses"]
153153
assert "word" in tool_exec_span["data"]["ai.input_messages"]
154-
assert "5" in tool_exec_span["data"]["ai.responses"][0]
154+
assert 5 == int(tool_exec_span["data"]["ai.responses"])
155155
assert (
156156
"You are very powerful"
157157
in chat_spans[1]["data"]["ai.input_messages"][0]["content"]

0 commit comments

Comments
 (0)