-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsearch_options.py
48 lines (39 loc) · 1.12 KB
/
search_options.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import os
from dotenv import load_dotenv
from langchain_box.blob_loaders import BoxBlobLoader
from langchain_box.utilities import (
BoxAuth,
BoxAuthType,
BoxSearchOptions,
DocumentFiles,
SearchTypeFilter
)
load_dotenv("../config/.ccg.env")
load_dotenv("../config/.box.env")
box_client_id=os.getenv("BOX_CLIENT_ID")
box_client_secret=os.getenv("BOX_CLIENT_SECRET")
box_user_id=os.getenv("BOX_USER_ID")
box_folder_id = os.getenv("BOX_FOLDER_ID")
auth = BoxAuth(
auth_type= BoxAuthType.CCG,
box_client_id=box_client_id,
box_client_secret=box_client_secret,
box_user_id=box_user_id
)
box_search_options = BoxSearchOptions(
ancestor_folder_ids=[box_folder_id],
search_type_filter=[SearchTypeFilter.FILE_CONTENT],
created_date_range=["2023-01-01T00:00:00-07:00", "2024-08-01T00:00:00-07:00,"],
file_extensions=[DocumentFiles.DOCX, DocumentFiles.PDF],
k=200,
size_range=[1,1000000],
updated_data_range=None
)
loader = BoxBlobLoader(
box_auth=auth,
query="Victor",
box_search_options=box_search_options
)
blobs = []
for blob in loader.yield_blobs():
print(blob)