Skip to content

Commit d2a66df

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

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

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: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,9 +149,10 @@ 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+
print("Responses are: ", chat_spans[0]["data"]["ai.responses"])
153+
assert "5" in chat_spans[0]["data"]["ai.responses"]
153154
assert "word" in tool_exec_span["data"]["ai.input_messages"]
154-
assert "5" in tool_exec_span["data"]["ai.responses"][0]
155+
assert "5" in tool_exec_span["data"]["ai.responses"]
155156
assert (
156157
"You are very powerful"
157158
in chat_spans[1]["data"]["ai.input_messages"][0]["content"]

0 commit comments

Comments
 (0)