Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix: Context can be empty in vector database search #1045

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Source/Chatbook/PromptGenerators/VectorDatabases.wl
Original file line number Diff line number Diff line change
@@ -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" ]
]

Unchanged files with check annotations Beta

ImageSize -> Automatic ],
Initialization :> None, (* needed for Deinitialization to run *)
Deinitialization :>
If[ TrueQ[ Wolfram`LLMFunctions`Common`Private`$LastLLMKitRequest[ "ConnectionQ" ] ],

Check notice on line 1162 in Source/Chatbook/PreferencesContent.wl

GitHub Actions / Build

CodeInspector/PrivateContextSymbol

The symbol ``Wolfram`LLMFunctions`Common`Private`$LastLLMKitRequest`` is in a private context (L1162,C32) (CodeInspectionFileIssue/PrivateContextSymbol:249335430)
SessionSubmit @ Wolfram`LLMFunctions`Common`Private`teardownLLMListener[ ]

Check notice on line 1163 in Source/Chatbook/PreferencesContent.wl

GitHub Actions / Build

CodeInspector/PrivateContextSymbol

The symbol ``Wolfram`LLMFunctions`Common`Private`teardownLLMListener`` is in a private context (L1163,C41) (CodeInspectionFileIssue/PrivateContextSymbol:249335430)
]
];
We need to coerce the cloud to send the evaluation through the kernel instead of the JS evaluator.
We accomplish this with a hack: include an unknown symbol with no side effects. *)
(
CloudSystem`Private`NoValue`Cloud25777;

Check notice on line 619 in Source/Chatbook/UI.wl

GitHub Actions / Build

CodeInspector/PrivateContextSymbol

The symbol ``CloudSystem`Private`NoValue`Cloud25777`` is in a private context (L619,C3) (CodeInspectionFileIssue/PrivateContextSymbol:10507-10534)
NotebookDelete[ EvaluationCell[ ] ] ),
Appearance -> "Suppressed",
BaselinePosition -> Baseline,