mirror of
https://github.com/hwchase17/langchain.git
synced 2025-06-26 16:43:35 +00:00
community: vectorstores.kdbai - Added support for when no docs are present (#18103)
- **Description:** By default it expects a list but that's not the case in corner scenarios when there is no document ingested(use case: Bootstrap application). \ Hence added as check, if the instance is panda Dataframe instead of list then it will procced with return immediately. - **Issue:** NA - **Dependencies:** NA - **Twitter handle:** jaskiratsingh1 --------- Co-authored-by: Harrison Chase <hw.chase.17@gmail.com>
This commit is contained in:
parent
9b8f6455b1
commit
ce682f5a09
@ -217,10 +217,12 @@ class KDBAI(VectorStore):
|
||||
"""
|
||||
if "n" in kwargs:
|
||||
k = kwargs.pop("n")
|
||||
matches = self._table.search(vectors=[embedding], n=k, filter=filter, **kwargs)[
|
||||
0
|
||||
]
|
||||
docs = []
|
||||
matches = self._table.search(vectors=[embedding], n=k, filter=filter, **kwargs)
|
||||
docs: list = []
|
||||
if isinstance(matches, list):
|
||||
matches = matches[0]
|
||||
else:
|
||||
return docs
|
||||
for row in matches.to_dict(orient="records"):
|
||||
text = row.pop("text")
|
||||
score = row.pop("__nn_distance")
|
||||
|
Loading…
Reference in New Issue
Block a user