MCPcopy
hub / github.com/continuedev/continue / retrieveChunks

Method retrieveChunks

core/indexing/docs/DocsService.ts:824–854  ·  view source on GitHub ↗
(
    startUrl: string,
    vector: number[],
    nRetrieve: number,
    isRetry: boolean = false,
  )

Source from the content-addressed store, hash-verified

822 }
823 // This function attempts to retrieve chunks by vector similarity
824 async retrieveChunks(
825 startUrl: string,
826 vector: number[],
827 nRetrieve: number,
828 isRetry: boolean = false,
829 ): Promise<Chunk[]> {
830 // Get the appropriate embeddings provider
831 const { provider } = await this.getEmbeddingsProvider();
832 if (!provider) {
833 return [];
834 }
835
836 // Lance doesn't have an embeddingsprovider column, instead it includes it in the table name
837 const table = await this.getOrCreateLanceTable({
838 initializationVector: vector,
839 startUrl,
840 });
841
842 let docs: LanceDbDocsRow[] = [];
843 try {
844 docs = await table
845 .search(vector)
846 .limit(nRetrieve)
847 .where(`starturl = '${startUrl}'`)
848 .execute();
849 } catch (e: any) {
850 console.warn("Error retrieving chunks from LanceDB", e);
851 }
852
853 return docs.map(this.lanceDBRowToChunk);
854 }
855
856 async getIndexedPages(startUrl: string): Promise<Set<string>> {
857 try {

Callers 1

Calls 5

getEmbeddingsProviderMethod · 0.95
getOrCreateLanceTableMethod · 0.95
executeMethod · 0.80
warnMethod · 0.80
searchMethod · 0.65

Tested by

no test coverage detected