Skip to content

fix(langchain): Use gen_ai.tool.definitions attribute when data collection is enabled - #7204

Open
ericapisani wants to merge 1 commit into
masterfrom
py-2734-update-tool-definition-attr-langchain
Open

fix(langchain): Use gen_ai.tool.definitions attribute when data collection is enabled#7204
ericapisani wants to merge 1 commit into
masterfrom
py-2734-update-tool-definition-attr-langchain

Conversation

@ericapisani

Copy link
Copy Markdown
Member

When data_collection is configured, tool definitions should be set on GEN_AI_TOOL_DEFINITIONS instead of the legacy GEN_AI_REQUEST_AVAILABLE_TOOLS attribute, matching the updated gen-ai semantic conventions. The legacy attribute is still used when data_collection is not configured.

Also gate the response tool calls recorded in on_llm_end on the outputs setting rather than inputs, since they are part of the model's response.

Refs PY-2734
Refs #7200

…lection is enabled

When `data_collection` is configured, tool definitions should be set on
`GEN_AI_TOOL_DEFINITIONS` instead of the legacy `GEN_AI_REQUEST_AVAILABLE_TOOLS`
attribute, matching the updated gen-ai semantic conventions. The legacy
attribute is still used when `data_collection` is not configured.

Also gate the response tool calls recorded in `on_llm_end` on the `outputs`
setting rather than `inputs`, since they are part of the model's response.

Refs PY-2734
Refs #7200
@ericapisani
ericapisani requested a review from a team as a code owner August 14, 2026 13:05
@linear-code

linear-code Bot commented Aug 14, 2026

Copy link
Copy Markdown

PY-2734

@github-actions

Copy link
Copy Markdown
Contributor

Codecov Results 📊

113283 passed | ⏭️ 6769 skipped | Total: 120052 | Pass Rate: 94.36% | Execution Time: 411m 16s

📊 Comparison with Base Branch

Metric Change
Total Tests 📈 +129
Passed Tests 📈 +126
Failed Tests 📉 -1
Skipped Tests 📈 +4

➖ Removed Tests (1)

View removed tests
  • test_span_streaming_quart_auth_user_id[42-True]
    • File: tests.integrations.quart.test_quart

All tests are passing successfully.

✅ Patch coverage is 100.00%. Project has 2493 uncovered lines.
❌ Project coverage is 90.19%. Comparing base (base) to head (head).

Coverage diff
@@            Coverage Diff             @@
##          main       #PR       +/-##
==========================================
- Coverage    90.20%    90.19%    -0.01%
==========================================
  Files          193       193         —
  Lines        25423     25422        -1
  Branches      9336      9336         —
==========================================
+ Hits         22933     22929        -4
- Misses        2490      2493        +3
- Partials      1436      1441        +5

Generated by Codecov Action

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant