-
Notifications
You must be signed in to change notification settings - Fork 904
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
feat(agents-api): added mmr to chat #1013
Conversation
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
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.
👍 Looks good to me! Reviewed everything up to c00d08d in 24 seconds
More details
- Looked at
45
lines of code in1
files - Skipped
0
files when reviewing. - Skipped posting
3
drafted comments based on config settings.
1. agents-api/agents_api/queries/chat/gather_messages.py:149
- Draft comment:
Ensure that filtering out references without embeddings is the intended behavior, as it might result in an empty list if none have embeddings. - Reason this comment was not posted:
Confidence changes required:50%
The code uses a list comprehension to filterdoc_references
based on the presence of embeddings. This is a temporary fix, but it should be noted that this could potentially remove all references if none have embeddings, which might not be the intended behavior.
2. agents-api/agents_api/queries/chat/gather_messages.py:155
- Draft comment:
Ensurequery_embedding
is always a list or array-like to avoid potential errors withnp.asarray
. - Reason this comment was not posted:
Confidence changes required:50%
The code usesnp.asarray(query_embedding)
which assumesquery_embedding
is a list or array-like. Ifquery_embedding
is not in the expected format, this could raise an error.
3. agents-api/agents_api/queries/chat/gather_messages.py:161
- Draft comment:
Consider using a list comprehension with a condition check instead ofset(indices)
for potentially better performance. - Reason this comment was not posted:
Confidence changes required:33%
The code usesset(indices)
to filterdoc_references
. This is efficient but could be optimized by using a list comprehension directly with a condition check.
Workflow ID: wflow_RJnb9YudrHKaruPp
You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
PR Code Suggestions ✨Explore these optional code suggestions:
|
CI Failure Feedback 🧐(Checks updated until commit e92fb4d)
✨ CI feedback usage guide:The CI feedback tool (
In addition to being automatically triggered, the tool can also be invoked manually by commenting on a PR:
where Configuration options
See more information about the |
Co-authored-by: qodo-merge-pro-for-open-source[bot] <189517486+qodo-merge-pro-for-open-source[bot]@users.noreply.github.com>
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.
👍 Looks good to me! Incremental review on 5608d8e in 31 seconds
More details
- Looked at
1045
lines of code in14
files - Skipped
0
files when reviewing. - Skipped posting
2
drafted comments based on config settings.
1. agents-api/agents_api/queries/chat/gather_messages.py:80
- Draft comment:
The check forif recall:
is redundant because the subsequent checkif recall and recall_options:
already covers the case whererecall
isFalse
. Consider removing the first check to simplify the logic. - Reason this comment was not posted:
Comment was not on a valid diff hunk.
2. agents-api/agents_api/queries/chat/gather_messages.py:161
- Draft comment:
Usingset(indices)
is unnecessary sinceindices
is already a list of unique values. You can directly useindices
in the list comprehension. - Reason this comment was not posted:
Confidence changes required:50%
Ingather_messages.py
, the code usesset(indices)
which is unnecessary sinceindices
is already a list of unique values. This can be simplified by directly usingindices
.
Workflow ID: wflow_O9uUJyIGRVtjV8eW
You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
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.
👍 Looks good to me! Incremental review on 6f1521c in 46 seconds
More details
- Looked at
446
lines of code in9
files - Skipped
0
files when reviewing. - Skipped posting
1
drafted comments based on config settings.
1. agents-api/agents_api/activities/utils.py:81
- Draft comment:
Consider usingyaml.safe_load(s)
instead ofyaml.load(s)
to avoid potential security risks associated with loading YAML data. - Reason this comment was not posted:
Comment was on unchanged code.
Workflow ID: wflow_TKOTdxHdYcqvWyvN
You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
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.
👍 Looks good to me! Incremental review on 9c12ad3 in 1 minute and 1 seconds
More details
- Looked at
588
lines of code in6
files - Skipped
0
files when reviewing. - Skipped posting
1
drafted comments based on config settings.
1. cookbooks/04-hook-generator-trending-reels.py:1
- Draft comment:
The PR description mentions changes ingather_messages.py
related to MMR, but the file is not visible in the diff. Please ensure all relevant files are included in the PR. - Reason this comment was not posted:
Comment did not seem useful.
Workflow ID: wflow_zdtXJKX4W4HTvAEv
You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
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.
👍 Looks good to me! Incremental review on 7412ca2 in 14 seconds
More details
- Looked at
136
lines of code in5
files - Skipped
0
files when reviewing. - Skipped posting
1
drafted comments based on config settings.
1. agents-api/agents_api/queries/executions/list_execution_transitions.py:63
- Draft comment:
The@pg_query(debug=True)
decorator was removed. If debugging is still needed, consider adding a logging mechanism or re-adding the debug flag. - Reason this comment was not posted:
Confidence changes required:50%
The decorator@pg_query(debug=True)
was removed, which might affect debugging capabilities. This change should be noted.
Workflow ID: wflow_dSYhlVyan1bxfsMp
You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
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.
👍 Looks good to me! Incremental review on be69c60 in 16 seconds
More details
- Looked at
16
lines of code in1
files - Skipped
0
files when reviewing. - Skipped posting
0
drafted comments based on config settings.
Workflow ID: wflow_AgYgsQJU0Y35L178
You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
PR Type
Enhancement
Description
Introduced Maximal Marginal Relevance (MMR) to refine document selection.
Filtered document references to ensure valid embeddings for MMR.
Added conditions to enable MMR based on recall options.
Integrated
numpy
for handling embeddings in MMR implementation.Changes walkthrough 📝
gather_messages.py
Implement MMR for document selection in chat
agents-api/agents_api/queries/chat/gather_messages.py
numpy
for embedding handling.Important
Introduces Maximal Marginal Relevance (MMR) in
gather_messages.py
for improved document selection in chat based on recall options.gather_messages()
ingather_messages.py
for document selection based on recall options.doc_references
to ensure embeddings are present before applying MMR.maximal_marginal_relevance()
to select document indices based on query and document embeddings.maximal_marginal_relevance
andnumpy
ingather_messages.py
.get_history
import inutils.py
.hasattr
checks inlifespan()
inapp.py
for state attributes.aembedding()
inlitellm.py
.This description was created by
for be69c60. It will automatically update as commits are pushed.