File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change 2323from unstract .sdk .x2txt import X2Text
2424
2525
26+ class Constants :
27+ TOP_K = 5
28+
29+
2630class Index :
2731 def __init__ (self , tool : BaseTool ):
2832 # TODO: Inherit from StreamMixin and avoid using BaseTool
@@ -73,7 +77,7 @@ def query_index(
7377 query_embedding = embedding .get_query_embedding (" " ),
7478 doc_ids = [doc_id ],
7579 filters = filters ,
76- similarity_top_k = 10000 ,
80+ similarity_top_k = Constants . TOP_K ,
7781 )
7882 except Exception as e :
7983 self .tool .stream_log (
@@ -400,9 +404,7 @@ def index_file(
400404 output_file_path = output_file_path ,
401405 )
402406
403- @deprecated (
404- "Deprecated class and method. Use Index and query_index() instead"
405- )
407+ @deprecated ("Deprecated class and method. Use Index and query_index() instead" )
406408 def get_text_from_index (
407409 self , embedding_type : str , vector_db : str , doc_id : str
408410 ) -> Optional [str ]:
You can’t perform that action at this time.
0 commit comments