Skip to content

Langchain bug fix#1

Open
sgoel-nr wants to merge 29 commits intomainfrom
sgoel/langchain-bug-fix
Open

Langchain bug fix#1
sgoel-nr wants to merge 29 commits intomainfrom
sgoel/langchain-bug-fix

Conversation

@sgoel-nr
Copy link
Owner

@sgoel-nr sgoel-nr commented Nov 13, 2025

Summary

This PR addresses several bugs related to LangChain integration in the New Relic Python Agent, specifically focusing on message timestamp handling and role assignments for chat completion events.

Changes

Message Timestamp Handling

  • Fixed request message timestamp preservation for LangChain chat completion messages
  • Ensured proper timestamp propagation to LlmChatCompletionMessage events
  • Corrected request timestamp handling for LlmChatCompletionSummary table entries

Role Assignment

  • Implemented default role assignment for input/output messages within LangChain
  • Ensures consistent role metadata across chat completion events

Bedrock Integration

  • Bedrock methods are properly integrated with the LangChain instrumentation

@github-actions
Copy link

github-actions bot commented Nov 13, 2025

MegaLinter analysis: Success

Descriptor Linter Files Fixed Errors Warnings Elapsed time
✅ ACTION actionlint 7 0 0 0.88s
✅ MARKDOWN markdownlint 7 0 0 0 1.14s
✅ PYTHON ruff 949 0 0 0 0.86s
✅ PYTHON ruff-format 949 0 0 0 0.31s
✅ YAML prettier 15 0 0 0 1.36s
✅ YAML v8r 15 0 0 5.99s
✅ YAML yamllint 15 0 0 0.6s

See detailed reports in MegaLinter artifacts

MegaLinter is graciously provided by OX Security

lrafeei and others added 22 commits November 14, 2025 10:47
* Skip hypercorn tests for v0.18

* Remove tornadomaster for 3.14
…elic#1582)

Bumps the github_actions group with 5 updates in the / directory:

| Package | From | To |
| --- | --- | --- |
| [actions/checkout](https://github.com/actions/checkout) | `5.0.0` | `5.0.1` |
| [docker/metadata-action](https://github.com/docker/metadata-action) | `5.8.0` | `5.9.0` |
| [docker/setup-qemu-action](https://github.com/docker/setup-qemu-action) | `3.6.0` | `3.7.0` |
| [astral-sh/setup-uv](https://github.com/astral-sh/setup-uv) | `7.1.2` | `7.1.3` |
| [github/codeql-action](https://github.com/github/codeql-action) | `4.31.2` | `4.31.3` |



Updates `actions/checkout` from 5.0.0 to 5.0.1
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](actions/checkout@08c6903...93cb6ef)

Updates `docker/metadata-action` from 5.8.0 to 5.9.0
- [Release notes](https://github.com/docker/metadata-action/releases)
- [Commits](docker/metadata-action@c1e5197...318604b)

Updates `docker/setup-qemu-action` from 3.6.0 to 3.7.0
- [Release notes](https://github.com/docker/setup-qemu-action/releases)
- [Commits](docker/setup-qemu-action@2910929...c7c5346)

Updates `astral-sh/setup-uv` from 7.1.2 to 7.1.3
- [Release notes](https://github.com/astral-sh/setup-uv/releases)
- [Commits](astral-sh/setup-uv@8585678...5a7eac6)

Updates `github/codeql-action` from 4.31.2 to 4.31.3
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](github/codeql-action@0499de3...014f16e)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: 5.0.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github_actions
- dependency-name: docker/metadata-action
  dependency-version: 5.9.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: github_actions
- dependency-name: docker/setup-qemu-action
  dependency-version: 3.7.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: github_actions
- dependency-name: astral-sh/setup-uv
  dependency-version: 7.1.3
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github_actions
- dependency-name: github/codeql-action
  dependency-version: 4.31.3
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github_actions
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
* Runner instrumentation in asyncio

* Clean up asyncio instrumentation

* Add asyncio tests for loop_factory

* Modify uvicorn test for loop_factory

* Fix linter errors

* [MegaLinter] Apply linters fixes

* Apply suggestions from code review

---------

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Co-authored-by: Tim Pansino <timpansino@gmail.com>
* Correct code for Sanic instrumentation

* Correct handling of headers in ASGIWebTransaction

* Correct handling of headers in ASGIBrowserMiddleware

* Add regression test for ASGI headers issues

---------

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
* Add more formatting to custom event validatators

* Add streamed responses to converse mock server

* Add streaming fixtures for testing for converse

* Rename other bedrock test files

* Add tests for converse streaming

* Instrument converse streaming

* Move GeneratorProxy adjacent functions to mixin

* Fix checking of supported models

* Reorganize converse error tests

* Port new converse botocore tests to aiobotocore

* Instrument response streaming in aiobotocore converse

* Fix suggestions from code review

* Port in converse changes from strands PR

* Delete commented code

---------

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
* Add new Redis methods

* Add RedisCluster methods to ignore list
Bumps the github_actions group with 3 updates: [actions/checkout](https://github.com/actions/checkout), [astral-sh/setup-uv](https://github.com/astral-sh/setup-uv) and [github/codeql-action](https://github.com/github/codeql-action).


Updates `actions/checkout` from 5.0.1 to 6.0.0
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](actions/checkout@93cb6ef...1af3b93)

Updates `astral-sh/setup-uv` from 7.1.3 to 7.1.4
- [Release notes](https://github.com/astral-sh/setup-uv/releases)
- [Commits](astral-sh/setup-uv@5a7eac6...1e862df)

Updates `github/codeql-action` from 4.31.3 to 4.31.5
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](github/codeql-action@014f16e...fdbfb4d)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: 6.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: github_actions
- dependency-name: astral-sh/setup-uv
  dependency-version: 7.1.4
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github_actions
- dependency-name: github/codeql-action
  dependency-version: 4.31.5
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github_actions
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…t are

recorded as LlmChatCompletionMessage event types.
and having timestamp in there caused a problem. As a quick test,
only add the request timestamp after the wrapped function has been
invoked.
* Add more formatting to custom event validatators

* Add streamed responses to converse mock server

* Add streaming fixtures for testing for converse

* Rename other bedrock test files

* Add tests for converse streaming

* Instrument converse streaming

* Move GeneratorProxy adjacent functions to mixin

* Fix checking of supported models

* Reorganize converse error tests

* Port new converse botocore tests to aiobotocore

* Instrument response streaming in aiobotocore converse

* Fix suggestions from code review

* Port in converse changes from strands PR

* Delete commented code

---------

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
@sgoel-nr sgoel-nr force-pushed the sgoel/langchain-bug-fix branch 2 times, most recently from 3112b8c to 689e520 Compare November 25, 2025 06:26
* Add more formatting to custom event validatators

* Add streamed responses to converse mock server

* Add streaming fixtures for testing for converse

* Rename other bedrock test files

* Add tests for converse streaming

* Instrument converse streaming

* Move GeneratorProxy adjacent functions to mixin

* Fix checking of supported models

* Reorganize converse error tests

* Port new converse botocore tests to aiobotocore

* Instrument response streaming in aiobotocore converse

* Fix suggestions from code review

* Port in converse changes from strands PR

* Delete commented code

---------

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
@sgoel-nr sgoel-nr force-pushed the sgoel/langchain-bug-fix branch from 2c036ac to af6385d Compare November 25, 2025 06:57
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.

5 participants