handle no emb situation

This commit is contained in:
William Fu-Hinthorn
2024-11-27 06:40:21 -08:00
parent 9a83dd7900
commit 0ed26a3af9
2 changed files with 4 additions and 2 deletions
@@ -232,7 +232,7 @@ class InMemoryStore(BaseStore):
if not candidates:
results[i] = []
continue
if op.query:
if op.query and queryinmem_store:
query_embedding = queryinmem_store[op.query]
flat_items, flat_vectors = [], []
for item, vectors in candidates:
+3 -1
View File
@@ -382,7 +382,9 @@ async def test_cannot_put_empty_namespace() -> None:
await store.aput(("foo", "langgraph", "foo"), "bar", doc)
assert (await store.aget(("foo", "langgraph", "foo"), "bar")).value == doc # type: ignore[union-attr]
assert (await store.asearch(("foo", "langgraph", "foo")))[0].value == doc
assert (await store.asearch(("foo", "langgraph", "foo"), query="bar"))[
0
].value == doc
await store.adelete(("foo", "langgraph", "foo"), "bar")
assert (await store.aget(("foo", "langgraph", "foo"), "bar")) is None
store.put(("foo", "langgraph", "foo"), "bar", doc)