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

fix(agents-api): Add limit to kNN search. Update search_docs_by_embedding.py #761

Merged
merged 2 commits into from
Oct 28, 2024

Conversation

creatorrr
Copy link
Contributor

@creatorrr creatorrr commented Oct 28, 2024

Important

Adds a limit to kNN search in search_docs_by_embedding to enhance diversity based on mmr_strength.

  • Behavior:
    • Adds a limit to kNN search in search_docs_by_embedding to retrieve k*(3 if mmr_strength else 1) candidates for diversity.
    • Adjusts the limit in both the search_query and normal_interim_query sections.
  • Misc:
    • Updates comments to reflect the new limit logic.

This description was created by Ellipsis for edc471d. It will automatically update as commits are pushed.

Copy link
Contributor

sweep-ai bot commented Oct 28, 2024

Hey @creatorrr, here are examples of how you can ask me to improve this pull request:

@Sweep Fix the CI errors.
@Sweep Add unit tests for `search_docs_by_embedding` that verify:
1. The kNN search limit is correctly set to `k*3` when `mmr_strength` is non-zero
2. The kNN search limit is correctly set to `k` when `mmr_strength` is zero
3. The diversity of results improves when using the increased limit with `mmr_strength`

📖 For more information on how to use Sweep, please read our documentation.

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.

👍 Looks good to me! Reviewed everything up to edc471d in 12 seconds

More details
  • Looked at 22 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 1 drafted comments based on config settings.
1. agents-api/agents_api/models/docs/search_docs_by_embedding.py:213
  • Draft comment:
    The docstring is outdated. It should reflect the new logic for the limit parameter, which now depends on mmr_strength.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The PR introduces a change to the limit in the kNN search query to account for MMR strength. This change is applied in multiple places, but the logic is consistent and correct. However, the docstring is outdated and does not reflect the new logic for the limit parameter.

Workflow ID: wflow_phC67VO9fQgUx0Qk


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

@creatorrr creatorrr merged commit 2b74ef9 into dev Oct 28, 2024
12 of 14 checks passed
@creatorrr creatorrr deleted the x/add-limit-to-knn-search branch October 28, 2024 19:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant