Fix get_documents_ids_distances return error when n_results = 0 (#2347)
This commit is contained in:
parent
07a4f0569f
commit
0dbc3d9b2c
1 changed files with 1 additions and 1 deletions
|
@ -50,7 +50,7 @@ class ChromaCollector(Collecter):
|
||||||
def get_documents_ids_distances(self, search_strings: list[str], n_results: int):
|
def get_documents_ids_distances(self, search_strings: list[str], n_results: int):
|
||||||
n_results = min(len(self.ids), n_results)
|
n_results = min(len(self.ids), n_results)
|
||||||
if n_results == 0:
|
if n_results == 0:
|
||||||
return [], []
|
return [], [], []
|
||||||
|
|
||||||
result = self.collection.query(query_texts=search_strings, n_results=n_results, include=['documents', 'distances'])
|
result = self.collection.query(query_texts=search_strings, n_results=n_results, include=['documents', 'distances'])
|
||||||
documents = result['documents'][0]
|
documents = result['documents'][0]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue