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

core: Fix IndexError when trim_messages invoked with empty list #26896

Merged
merged 1 commit into from
Sep 26, 2024

Conversation

sudosays
Copy link
Contributor

This prevents trim_messages from raising an IndexError when invoked with include_system=True, strategy="last", and an empty message list.

Fixes #26895

Dependencies: none

This prevents `trim_messages` from raising an `IndexError` when invoked
with `include_system=True`, `strategy="last"`, and an empty message list
Copy link

vercel bot commented Sep 26, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
langchain ⬜️ Ignored (Inspect) Visit Preview Sep 26, 2024 0:50am

@dosubot dosubot bot added size:S This PR changes 10-29 lines, ignoring generated files. Ɑ: core Related to langchain-core 🤖:bug Related to a bug, vulnerability, unexpected error with an existing feature labels Sep 26, 2024
@eyurtsev eyurtsev self-assigned this Sep 26, 2024
@dosubot dosubot bot added the lgtm PR looks good. Use to confirm that a PR is ready for merging. label Sep 26, 2024
@eyurtsev eyurtsev merged commit 121e79b into langchain-ai:master Sep 26, 2024
85 checks passed
@eyurtsev
Copy link
Collaborator

Thank you @sudosays

Sheepsta300 pushed a commit to Sheepsta300/langchain that referenced this pull request Oct 1, 2024
…angchain-ai#26896)

This prevents `trim_messages` from raising an `IndexError` when invoked
with `include_system=True`, `strategy="last"`, and an empty message
list.

Fixes langchain-ai#26895

Dependencies: none
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🤖:bug Related to a bug, vulnerability, unexpected error with an existing feature Ɑ: core Related to langchain-core lgtm PR looks good. Use to confirm that a PR is ready for merging. size:S This PR changes 10-29 lines, ignoring generated files.
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

trim_messages causes an IndexError when invoked with strategy="last", include_system=True, and empty messages
2 participants