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

improve langchain prompting using native messages #1194

Merged
merged 4 commits into from
Jun 13, 2024

Conversation

nicoloboschi
Copy link
Contributor

@nicoloboschi nicoloboschi commented Jun 11, 2024

Currently when using LangChain chain as eval, the messages are serialized as json in the llm prompt, giving really bad results.
Instead langchain llm offers a method predict_messages that handles the prompt in a more performant way.

Changes:

  • Switches to the native langchain prompting for messages

This directly impact all the builtin feedback functions


🚀 This description was created by Ellipsis for commit 30ddaac

Summary:

Enhances LangChain prompting by using native predict_messages and a new helper function _convert_message for message conversion.

Key points:

  • Removed JSON serialization in message prompting
  • Added _convert_message to convert dict to BaseMessage
  • Used predict_messages for better performance

Generated with ❤️ by ellipsis.dev

@dosubot dosubot bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Jun 11, 2024
Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

❌ Changes requested. Reviewed everything up to 30ddaac in 1 minute and 50 seconds

More details
  • Looked at 45 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 0 drafted comments based on config settings.

Workflow ID: wflow_XUxQ4UyEIADJVjfl


Want Ellipsis to fix these issues? Tag @ellipsis-dev in a comment. You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Jun 11, 2024
@sfc-gh-jreini sfc-gh-jreini merged commit 0ab806a into truera:main Jun 13, 2024
3 checks passed
@sfc-gh-jreini sfc-gh-jreini mentioned this pull request Jun 21, 2024
sfc-gh-dhuang pushed a commit that referenced this pull request Jun 28, 2024
Co-authored-by: Josh Reini <josh.reini@snowflake.com>
sfc-gh-dhuang pushed a commit that referenced this pull request Jul 1, 2024
Co-authored-by: Josh Reini <josh.reini@snowflake.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm This PR has been approved by a maintainer size:S This PR changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants