-
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
New strategy for collecting messages and improvements to ReAct agent and message passing #305
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
…-agent # Conflicts: # core/src/commonMain/kotlin/com/xebia/functional/xef/llm/Chat.kt # core/src/commonMain/kotlin/com/xebia/functional/xef/prompt/expressions/Expression.kt
javipacheco
reviewed
Aug 9, 2023
javipacheco
changed the title
Improvements to ReAct agent and message passing
New strategy for collecting messages and improvements to ReAct agent and message passing
Aug 9, 2023
jackcviers-contractor
suggested changes
Aug 9, 2023
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.
Most of this is comments, except the fold right.
core/src/commonMain/kotlin/com/xebia/functional/xef/llm/Chat.kt
Outdated
Show resolved
Hide resolved
core/src/commonMain/kotlin/com/xebia/functional/xef/llm/Chat.kt
Outdated
Show resolved
Hide resolved
reasoning/src/commonMain/kotlin/com/xebia/functional/xef/reasoning/tools/ReActAgent.kt
Show resolved
Hide resolved
Montagon
reviewed
Aug 10, 2023
Montagon
previously approved these changes
Aug 10, 2023
Montagon
approved these changes
Aug 10, 2023
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.
🚀
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.
This PR contains a new strategy for collecting messages by the maximum tokens for the model.
Basically, when we have to send messages to OpenAI we can get the messages from 3 places:
New Messages
: they are the messages that we are sending. These messages always should be sent if you don't have tokens for this, we will receive anAIError
exceptionHistory
: they are the previous messages in the conversationContext
: they are documents in theVectorStore
, for example, if you loaded a PDFIn the new strategy,
fitMessagesByTokens
method, we are calculating the remaining messages, removing the tokens for the OpenAI response and the tokens for the new messages that are required.When we have the remaining token, we are using 50% of the token for the history messages and the other 50% for the documents in the
VectorStore
In future PRs, we can add the percentage for every context in the
PromptConfiguration