Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(langchain): correctly identify inputs for batch lcel chain calls #9195

Merged
merged 6 commits into from May 14, 2024

Conversation

sabrenner
Copy link
Contributor

@sabrenner sabrenner commented May 7, 2024

Changes Made

Both batch and invoke calls on LCEL chains for LangChain pass through the same traced method, for code re-use. However, the kwarg for inputs to batch calls is inputs, while for invoke calls is input. This change reflects that, and unit tests have been updated

Motivation

Fix possible breaking customer apps (no reports yet as far as I can tell).

Checklist

  • Change(s) are motivated and described in the PR description
  • Testing strategy is described if automated tests are not included in the PR
  • Risks are described (performance impact, potential for breakage, maintainability)
  • Change is maintainable (easy to change, telemetry, documentation)
  • Library release note guidelines are followed or label changelog/no-changelog is set
  • Documentation is included (in-code, generated user docs, public corp docs)
  • Backport labels are set (if applicable)
  • If this PR changes the public interface, I've notified @DataDog/apm-tees.

Reviewer Checklist

  • Title is accurate
  • All changes are related to the pull request's stated goal
  • Description motivates each change
  • Avoids breaking API changes
  • Testing strategy adequately addresses listed risks
  • Change is maintainable (easy to change, telemetry, documentation)
  • Release note makes sense to a user of the library
  • Author has acknowledged and discussed the performance implications of this PR as reported in the benchmarks PR comment
  • Backport labels are set in a manner that is consistent with the release branch maintenance policy

@datadog-dd-trace-py-rkomorn
Copy link

datadog-dd-trace-py-rkomorn bot commented May 7, 2024

Datadog Report

Branch report: sabrenner/langchain-chain-inputs-fix
Commit report: 1167ddb
Test service: dd-trace-py

✅ 0 Failed, 128 Passed, 319 Skipped, 5m 28.66s Total duration (1m 40.63s time saved)

@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 0% with 11 lines in your changes are missing coverage. Please review.

Project coverage is 26.57%. Comparing base (dac8aa2) to head (8554905).

Files Patch % Lines
ddtrace/contrib/langchain/patch.py 0.00% 8 Missing ⚠️
...ests/contrib/langchain/test_langchain_community.py 0.00% 3 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##             main    #9195       +/-   ##
===========================================
- Coverage   78.53%   26.57%   -51.97%     
===========================================
  Files        1277     1262       -15     
  Lines      120384   119955      -429     
===========================================
- Hits        94543    31876    -62667     
- Misses      25841    88079    +62238     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@sabrenner sabrenner added MLObs ML Observability (LLMObs) backport 2.8 backport 2.9 labels May 8, 2024
@sabrenner sabrenner marked this pull request as ready for review May 8, 2024 13:14
@sabrenner sabrenner requested review from a team as code owners May 8, 2024 13:14
@pr-commenter
Copy link

pr-commenter bot commented May 8, 2024

Benchmarks

Benchmark execution time: 2024-05-14 19:17:55

Comparing candidate commit 1167ddb in PR branch sabrenner/langchain-chain-inputs-fix with baseline commit 853d0ef in branch main.

Found 0 performance improvements and 0 performance regressions! Performance is the same for 209 metrics, 9 unstable metrics.

Copy link
Contributor

@lievan lievan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@sabrenner sabrenner enabled auto-merge (squash) May 8, 2024 18:56
@sabrenner sabrenner merged commit 5148d18 into main May 14, 2024
115 of 116 checks passed
@sabrenner sabrenner deleted the sabrenner/langchain-chain-inputs-fix branch May 14, 2024 19:31
github-actions bot pushed a commit that referenced this pull request May 14, 2024
…9195)

## Changes Made
Both `batch` and `invoke` calls on LCEL chains for LangChain pass
through the same traced method, for code re-use. However, the `kwarg`
for inputs to batch calls is `inputs`, while for invoke calls is
`input`. This change reflects that, and unit tests have been updated

## Motivation
Fix possible breaking customer apps (no reports yet as far as I can
tell).

## Checklist

- [x] Change(s) are motivated and described in the PR description
- [x] Testing strategy is described if automated tests are not included
in the PR
- [x] Risks are described (performance impact, potential for breakage,
maintainability)
- [x] Change is maintainable (easy to change, telemetry, documentation)
- [x] [Library release note
guidelines](https://ddtrace.readthedocs.io/en/stable/releasenotes.html)
are followed or label `changelog/no-changelog` is set
- [x] Documentation is included (in-code, generated user docs, [public
corp docs](https://github.com/DataDog/documentation/))
- [x] Backport labels are set (if
[applicable](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting))
- [x] If this PR changes the public interface, I've notified
`@DataDog/apm-tees`.

## Reviewer Checklist

- [ ] Title is accurate
- [ ] All changes are related to the pull request's stated goal
- [ ] Description motivates each change
- [ ] Avoids breaking
[API](https://ddtrace.readthedocs.io/en/stable/versioning.html#interfaces)
changes
- [ ] Testing strategy adequately addresses listed risks
- [ ] Change is maintainable (easy to change, telemetry, documentation)
- [ ] Release note makes sense to a user of the library
- [ ] Author has acknowledged and discussed the performance implications
of this PR as reported in the benchmarks PR comment
- [ ] Backport labels are set in a manner that is consistent with the
[release branch maintenance
policy](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting)

(cherry picked from commit 5148d18)

This comment was marked as resolved.

Yun-Kim pushed a commit that referenced this pull request May 15, 2024
…[backport 2.9] (#9267)

Backport 5148d18 from #9195 to 2.9.

## Changes Made
Both `batch` and `invoke` calls on LCEL chains for LangChain pass
through the same traced method, for code re-use. However, the `kwarg`
for inputs to batch calls is `inputs`, while for invoke calls is
`input`. This change reflects that, and unit tests have been updated

## Motivation
Fix possible breaking customer apps (no reports yet as far as I can
tell).

## Checklist

- [x] Change(s) are motivated and described in the PR description
- [x] Testing strategy is described if automated tests are not included
in the PR
- [x] Risks are described (performance impact, potential for breakage,
maintainability)
- [x] Change is maintainable (easy to change, telemetry, documentation)
- [x] [Library release note
guidelines](https://ddtrace.readthedocs.io/en/stable/releasenotes.html)
are followed or label `changelog/no-changelog` is set
- [x] Documentation is included (in-code, generated user docs, [public
corp docs](https://github.com/DataDog/documentation/))
- [x] Backport labels are set (if
[applicable](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting))
- [x] If this PR changes the public interface, I've notified
`@DataDog/apm-tees`.

## Reviewer Checklist

- [x] Title is accurate
- [x] All changes are related to the pull request's stated goal
- [x] Description motivates each change
- [x] Avoids breaking
[API](https://ddtrace.readthedocs.io/en/stable/versioning.html#interfaces)
changes
- [x] Testing strategy adequately addresses listed risks
- [x] Change is maintainable (easy to change, telemetry, documentation)
- [x] Release note makes sense to a user of the library
- [x] Author has acknowledged and discussed the performance implications
of this PR as reported in the benchmarks PR comment
- [x] Backport labels are set in a manner that is consistent with the
[release branch maintenance
policy](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting)

Co-authored-by: Sam Brenner <106700075+sabrenner@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 2.9 MLObs ML Observability (LLMObs)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants