From 8798989c410accd0839084f966c4ec3eb596b8cd Mon Sep 17 00:00:00 2001 From: leonbi100 Date: Fri, 20 Dec 2024 15:07:32 -0500 Subject: [PATCH] Add new test checking tool descriptions --- .../test_vector_search_retriever_tool.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/integrations/langchain/tests/unit_tests/test_vector_search_retriever_tool.py b/integrations/langchain/tests/unit_tests/test_vector_search_retriever_tool.py index 5868da6..3dd1855 100644 --- a/integrations/langchain/tests/unit_tests/test_vector_search_retriever_tool.py +++ b/integrations/langchain/tests/unit_tests/test_vector_search_retriever_tool.py @@ -86,3 +86,20 @@ def test_vector_search_retriever_tool_combinations( assert isinstance(vector_search_tool, BaseTool) result = vector_search_tool.invoke("Databricks Agent Framework") assert result is not None + + +@pytest.mark.parametrize("index_name", ALL_INDEX_NAMES) +def test_vector_search_retriever_tool_description_generation(index_name: str) -> None: + vector_search_tool = init_vector_search_tool(index_name) + assert vector_search_tool.name != "" + assert vector_search_tool.description != "" + assert vector_search_tool.name == index_name + assert ( + "A vector search-based retrieval tool for querying indexed embeddings." + in vector_search_tool.description + ) + assert vector_search_tool.args_schema.model_fields["query"] is not None + assert vector_search_tool.args_schema.model_fields["query"].description == ( + "The string used to query the index with and identify the most similar " + "vectors and return the associated documents." + )