Skip to content

Support passing arbitrary kwargs through VectorSearchRetrieverTool #105

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

Merged
merged 10 commits into from
May 6, 2025

Conversation

annzhang-db
Copy link
Contributor

@annzhang-db annzhang-db commented Apr 30, 2025

Description of Changes

  • Add support for passing arbitrary kwargs through to VS similarity_search
  • The user can either pass in kwargs during initialization, which will get passed all the way through, or pass in at query time
  • In order for the LLM to be able to pass through arguments at query time, the user will have to update the args schema/tool spec/description appropriately for their use case.

How is this tested?

  • Unit tests
  • Manual tests

OpenAI:
Screenshot 2025-05-06 at 2 39 34 PM

LlamaIndex:
Screenshot 2025-05-06 at 2 29 09 PM

Langchain:
Screenshot 2025-05-06 at 3 03 07 PM

Signed-off-by: Ann Zhang <ann.zhang@databricks.com>
Signed-off-by: Ann Zhang <ann.zhang@databricks.com>
@@ -304,24 +304,6 @@ def test_similarity_search_hybrid(index_name: str) -> None:
assert all(["id" in d.metadata for d in search_result])


def test_similarity_search_both_filter_and_filters_passed() -> None:
Copy link
Contributor Author

@annzhang-db annzhang-db May 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deleting this test since now we are passing kwargs through, so both filter and filters would show up. We are instead trusting that the arguments passed through are meaningful and correct.

Signed-off-by: Ann Zhang <ann.zhang@databricks.com>
@annzhang-db annzhang-db changed the title draft Support passing arbitrary kwargs through VectorSearchRetrieverTool May 1, 2025
Signed-off-by: Ann Zhang <ann.zhang@databricks.com>
Signed-off-by: Ann Zhang <ann.zhang@databricks.com>
Signed-off-by: Ann Zhang <ann.zhang@databricks.com>
@annzhang-db annzhang-db requested a review from bbqiu May 6, 2025 19:24
Signed-off-by: Ann Zhang <ann.zhang@databricks.com>
@annzhang-db annzhang-db requested review from aravind-segu and removed request for bbqiu May 6, 2025 21:42
Copy link
Contributor

@aravind-segu aravind-segu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for the tests. Had a quick question

Signed-off-by: Ann Zhang <ann.zhang@databricks.com>
Signed-off-by: Ann Zhang <ann.zhang@databricks.com>
@annzhang-db annzhang-db merged commit b89ba70 into main May 6, 2025
6 checks passed
@annzhang-db annzhang-db deleted the kwargs branch May 6, 2025 23:52
annzhang-db added a commit that referenced this pull request May 7, 2025
)

Signed-off-by: Ann Zhang <ann.zhang@databricks.com>
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.

2 participants