Skip to content

Commit 76b4ed9

Browse files
Change top_k value (#62)
1 parent e50268a commit 76b4ed9

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/unstract/sdk/index.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@
2323
from unstract.sdk.x2txt import X2Text
2424

2525

26+
class Constants:
27+
TOP_K = 5
28+
29+
2630
class 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]:

0 commit comments

Comments
 (0)