Skip to content

Commit 787bf58

Browse files
do not gate token assertions and typo
1 parent 94bdcb1 commit 787bf58

1 file changed

Lines changed: 5 additions & 8 deletions

File tree

tests/integrations/langchain/test_langchain.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ def test_langchain_create_agent(
128128
)
129129
events = capture_events()
130130

131-
model_repsonse = get_model_response(
131+
model_response = get_model_response(
132132
nonstreaming_responses_model_response,
133133
serialize_pydantic=True,
134134
request_headers={
@@ -152,7 +152,7 @@ def test_langchain_create_agent(
152152
with patch.object(
153153
llm.client._client._client,
154154
"send",
155-
return_value=model_repsonse,
155+
return_value=model_response,
156156
) as _:
157157
with start_transaction():
158158
agent.invoke(
@@ -171,12 +171,9 @@ def test_langchain_create_agent(
171171
assert len(chat_spans) == 1
172172
assert chat_spans[0]["origin"] == "auto.ai.langchain"
173173

174-
# Token usage is only available in newer versions of langchain (v0.2+)
175-
# where usage_metadata is supported on AIMessageChunk
176-
if "gen_ai.usage.input_tokens" in chat_spans[0]["data"]:
177-
assert chat_spans[0]["data"]["gen_ai.usage.input_tokens"] == 10
178-
assert chat_spans[0]["data"]["gen_ai.usage.output_tokens"] == 20
179-
assert chat_spans[0]["data"]["gen_ai.usage.total_tokens"] == 30
174+
assert chat_spans[0]["data"]["gen_ai.usage.input_tokens"] == 10
175+
assert chat_spans[0]["data"]["gen_ai.usage.output_tokens"] == 20
176+
assert chat_spans[0]["data"]["gen_ai.usage.total_tokens"] == 30
180177

181178
if send_default_pii and include_prompts:
182179
assert (

0 commit comments

Comments
 (0)