MCPcopy Create free account
hub / github.com/Coneja-Chibi/CarrotKernel / apiQueryCollection

Function apiQueryCollection

fullsheet-rag.js:429–453  ·  view source on GitHub ↗

* Query a vector collection

(collectionId, searchText, topK, threshold = 0.2)

Source from the content-addressed store, hash-verified

427 * Query a vector collection
428 */
429async function apiQueryCollection(collectionId, searchText, topK, threshold = 0.2) {
430 ensureVectorConfig();
431
432 const args = await getAdditionalVectorArgs([searchText]);
433
434 const response = await fetch('/api/vector/query', {
435 method: 'POST',
436 headers: getRequestHeaders(),
437 credentials: 'same-origin',
438 body: JSON.stringify({
439 ...getVectorsRequestBody(args),
440 collectionId: collectionId,
441 searchText: searchText,
442 topK: topK,
443 source: getVectorSettings().source,
444 threshold: threshold,
445 }),
446 });
447
448 if (!response.ok) {
449 throw new Error(`Failed to query collection ${collectionId}`);
450 }
451
452 return await response.json();
453}
454
455/**
456 * Delete specific hashes from a vector collection

Callers 1

queryRAGFunction · 0.85

Calls 4

ensureVectorConfigFunction · 0.85
getAdditionalVectorArgsFunction · 0.85
getVectorsRequestBodyFunction · 0.85
getVectorSettingsFunction · 0.85

Tested by

no test coverage detected