Skip to content

Commit

Permalink
fix BoxSearchOptions class initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
barduinor committed Sep 4, 2024
1 parent c065e52 commit ed1bb47
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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):
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down

0 comments on commit ed1bb47

Please sign in to comment.