diff --git a/Source/Chatbook/PromptGenerators/VectorDatabases.wl b/Source/Chatbook/PromptGenerators/VectorDatabases.wl index 5b9ee51e..1067a13c 100644 --- a/Source/Chatbook/PromptGenerators/VectorDatabases.wl +++ b/Source/Chatbook/PromptGenerators/VectorDatabases.wl @@ -847,13 +847,13 @@ vectorDBSearch[ names: $$dbNames, prompt_, prop: "Values"|"Results" ] := Enclose results = ConfirmMatch[ applyBias[ #, vectorDBSearch[ #, prompt, "Results" ] ] & /@ names, - { { KeyValuePattern[ "Distance" -> $$size ].. }... }, + { { KeyValuePattern[ "Distance" -> $$size ]... }... }, "Results" ]; sorted = SortBy[ Flatten @ results, #Distance & ]; - If[ prop === "Results", + If[ prop === "Results" || sorted === { }, sorted, ConfirmBy[ DeleteDuplicates @ Lookup[ sorted, "Value" ], ListQ, "Values" ] ]