diff --git a/llama-index-integrations/tools/llama-index-tools-box/llama_index/tools/box/search/base.py b/llama-index-integrations/tools/llama-index-tools-box/llama_index/tools/box/search/base.py index 5cfe7d3d0c3cd..b29cdcd0aeb2b 100644 --- a/llama-index-integrations/tools/llama-index-tools-box/llama_index/tools/box/search/base.py +++ b/llama-index-integrations/tools/llama-index-tools-box/llama_index/tools/box/search/base.py @@ -58,6 +58,32 @@ class BoxSearchOptions: limit: Optional[int] = None offset: Optional[int] = None + def __init__( + self, + scope: Optional[SearchForContentScope] = None, + file_extensions: Optional[List[str]] = None, + created_at_range: Optional[List[str]] = None, + updated_at_range: Optional[List[str]] = None, + size_range: Optional[List[int]] = None, + owner_user_ids: Optional[List[str]] = None, + recent_updater_user_ids: Optional[List[str]] = None, + ancestor_folder_ids: Optional[List[str]] = None, + content_types: Optional[List[SearchForContentContentTypes]] = None, + limit: Optional[int] = None, + offset: Optional[int] = None, + ) -> None: + self.scope = scope + self.file_extensions = file_extensions + self.created_at_range = created_at_range + self.updated_at_range = updated_at_range + self.size_range = size_range + self.owner_user_ids = owner_user_ids + self.recent_updater_user_ids = recent_updater_user_ids + self.ancestor_folder_ids = ancestor_folder_ids + self.content_types = content_types + self.limit = limit + self.offset = offset + class BoxSearchToolSpec(BaseToolSpec): """ diff --git a/llama-index-integrations/tools/llama-index-tools-box/tests/test_tools_box_search.py b/llama-index-integrations/tools/llama-index-tools-box/tests/test_tools_box_search.py index 8f46cb31ef582..95e2f69b93f0c 100644 --- a/llama-index-integrations/tools/llama-index-tools-box/tests/test_tools_box_search.py +++ b/llama-index-integrations/tools/llama-index-tools-box/tests/test_tools_box_search.py @@ -19,6 +19,17 @@ def test_box_tool_search(box_client_ccg_integration_testing: BoxClient): assert len(docs) > 0 +def test_box_tool_search_options(box_client_ccg_integration_testing: BoxClient): + options = BoxSearchOptions(file_extensions=["pdf"]) + options.limit = 5 + + box_tool = BoxSearchToolSpec(box_client_ccg_integration_testing, options=options) + + query = "sample" + docs = box_tool.box_search(query=query) + assert len(docs) > 0 + + def test_box_tool_search_agent(box_client_ccg_integration_testing: BoxClient): test_data = get_testing_data() openai_api_key = test_data["openai_api_key"]