-
Notifications
You must be signed in to change notification settings - Fork 15
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 incorrect impl of flow (streaming gen.) for local LLMs #381
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
e880af2
improve and fix local llm generation as flow
Intex32 b1d9a89
Merge branch 'main' into local-llm-improvements
Intex32 3a166fd
change reduce to reduceNotNull to avoid exception
Intex32 3c725f0
Merge remote-tracking branch 'origin/local-llm-improvements' into loc…
Intex32 9e2f8f2
addressing comment regarding thread instantiation
Intex32 d1bd6ba
Merge branch 'main' into local-llm-improvements
raulraja 7f3c69a
Merge branch 'main' into local-llm-improvements
Intex32 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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.
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.
Is there a better way to achieve the same as the
onEach
andfold
? Currently, each item is emitted to another outer flow.This is required because we have to
fold
the flow and get the full generated string in order to add it to the memory. On the other hand, we want to pass each item forward to the caller of the function so that they can do whatever the want to do with it.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.
It kind-of depends on the desired behavior of the resulting
Flow
.onEach
will back-pressure thefold
, so the resultingFlow
can still back-pressure thefold
which is desired.onEach
is the same ofmap { f(it); it }
.My concern is that
fold
will take everything in memory, but I guess that's inherit toMemoryManagement.addMemoriesAfterStream
. Just going by the name it sounds like it puts everything in memory anyway.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.
Yes, the goal is indeed to get the full string of generated text and store in the conversation history. At the same time I want to forward every individual item to the outer flow.
I came to the conclusion there is no better way.
If you have time, can you explain what you mean by the terminology of back-pressure?
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.
@Intex32 I explain back-pressure a little bit here. https://youtu.be/n724AdSAkOI☺️
Let me know if this clears it up for you, if not we can discuss it further
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.
@nomisRev I have more questions than before 😂. I especially liked the part where you talked about back pressure.
The pen has some classy dance moves tbh.