Skip to content

Commit

Permalink
Merge pull request #1045 from WolframResearch/1044-internal-failure-w…
Browse files Browse the repository at this point in the history
…hen-generating-suggestions-without-context

Bugfix: Context can be empty in vector database search
  • Loading branch information
rhennigan authored Jan 21, 2025
2 parents 7dd21e3 + 880c3c1 commit ccadaa5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Source/Chatbook/PromptGenerators/VectorDatabases.wl
Original file line number Diff line number Diff line change
Expand Up @@ -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" ]
]
Expand Down

0 comments on commit ccadaa5

Please sign in to comment.