bug fix Chromadb
Browse files- ChromaDBFlow.py +8 -8
ChromaDBFlow.py
CHANGED
|
@@ -122,14 +122,14 @@ class ChromaDBFlow(AtomicFlow):
|
|
| 122 |
raise ValueError(f"content(query) must be a string during read, got {type(content)}: {content}")
|
| 123 |
if content == "":
|
| 124 |
response["retrieved"] = [[""]]
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
|
| 133 |
|
| 134 |
elif operation == "write":
|
| 135 |
if content != "":
|
|
|
|
| 122 |
raise ValueError(f"content(query) must be a string during read, got {type(content)}: {content}")
|
| 123 |
if content == "":
|
| 124 |
response["retrieved"] = [[""]]
|
| 125 |
+
else:
|
| 126 |
+
query = content
|
| 127 |
+
query_result = self.collection.query(
|
| 128 |
+
query_embeddings=embeddings.embed_query(query),
|
| 129 |
+
n_results=self.flow_config["n_results"]
|
| 130 |
+
)
|
| 131 |
+
|
| 132 |
+
response["retrieved"] = [doc for doc in query_result["documents"]]
|
| 133 |
|
| 134 |
elif operation == "write":
|
| 135 |
if content != "":
|