-
-
Notifications
You must be signed in to change notification settings - Fork 334
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 magic commands when using non-chat providers w/ history #1075
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dlqqq
changed the title
Fixes context generation for non-chat providers.
Fix generation when using Nov 1, 2024
BaseLLM
providers with context in magic commands
dlqqq
changed the title
Fix generation when using
Fix generation when using context with non-chat providers in magic commands
Nov 1, 2024
BaseLLM
providers with context in magic commands
dlqqq
changed the title
Fix generation when using context with non-chat providers in magic commands
Fix magic commands when using non-chat providers w/ history
Nov 1, 2024
When we're calling provider.generate, ultimately we're calling the generate function as specified in langchain_core.language_models.llms.BaseLLM. This function expects a list of string prompts, where each should have a separate generation performed for it - this being to allow taking advantage of batch processing where possible. The bug here is that we pass in each message from the context as a separate generation question, rather than combining them together into a single prompt including both the context and human message. The edit here concatenates them all with two new lines between each message and ensures that we pass only a single element list to the generate function.
for more information, see https://pre-commit.ci
dlqqq
force-pushed
the
bugfix/context_generation
branch
from
November 1, 2024 22:03
1ffba23
to
1678eb1
Compare
dlqqq
approved these changes
Nov 1, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great catch, thank you! The explanation you included w/ your PR description is precisely correct. I love how you also described why this PR fixes it.
@meeseeksdev please backport to v3-dev |
meeseeksmachine
pushed a commit
to meeseeksmachine/jupyter-ai
that referenced
this pull request
Nov 1, 2024
…roviders w/ history
dlqqq
pushed a commit
that referenced
this pull request
Nov 1, 2024
…/ history (#1080) Co-authored-by: Alan Meeson <alanmeeson@users.noreply.github.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When we're calling provider.generate, ultimately we're calling the generate function as specified in langchain_core.language_models.llms.BaseLLM. This function expects a list of string prompts, where each should have a separate generation performed for it - this being to allow taking advantage of batch processing where possible.
The bug here is that we pass in each message from the context as a separate generation question, rather than combining them together into a single prompt including both the context and human message.
The edit here concatenates them all with two new lines between each message and ensures that we pass only a single element list to the generate function.