Skip to content

Commit d6910d2

Browse files
Merge branch 'webb/langchain/tool-test' into webb/langchain/text-completion
2 parents 8e2cec9 + 3891d5d commit d6910d2

2 files changed

Lines changed: 7 additions & 4 deletions

File tree

tests/conftest.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1039,7 +1039,10 @@ def inner(events, include_event_type=True):
10391039

10401040
@pytest.fixture
10411041
def get_model_response():
1042-
def inner(response_content, serialize_pydantic=False, request_headers={}):
1042+
def inner(response_content, serialize_pydantic=False, request_headers=None):
1043+
if request_headers is None:
1044+
request_headers = {}
1045+
10431046
model_request = HttpxRequest(
10441047
"POST",
10451048
"/responses",

tests/integrations/langchain/test_langchain.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -411,9 +411,6 @@ def test_tool_execution_span(
411411
assert chat_spans[1]["origin"] == "auto.ai.langchain"
412412
assert tool_exec_span["origin"] == "auto.ai.langchain"
413413

414-
# We can't guarantee anything about the "shape" of the langchain execution graph
415-
assert len(list(x for x in tx["spans"] if x["op"] == "gen_ai.chat")) > 0
416-
417414
# Token usage is only available in newer versions of langchain (v0.2+)
418415
# where usage_metadata is supported on AIMessageChunk
419416
if "gen_ai.usage.input_tokens" in chat_spans[0]["data"]:
@@ -808,6 +805,9 @@ def test_langchain_openai_tools_agent(
808805
# Verify that available tools are always recorded regardless of PII settings
809806
for chat_span in chat_spans:
810807
tools_data = chat_span["data"][SPANDATA.GEN_AI_REQUEST_AVAILABLE_TOOLS]
808+
assert tools_data is not None, (
809+
"Available tools should always be recorded regardless of PII settings"
810+
)
811811
assert "get_word_length" in tools_data
812812

813813

0 commit comments

Comments
 (0)