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

Method getOrCreateLanceTable

core/indexing/docs/DocsService.ts:1071–1116  ·  view source on GitHub ↗
({
    initializationVector,
    startUrl,
  }: {
    initializationVector: number[];
    startUrl: string;
  })

Source from the content-addressed store, hash-verified

1069 }
1070
1071 private async getOrCreateLanceTable({
1072 initializationVector,
1073 startUrl,
1074 }: {
1075 initializationVector: number[];
1076 startUrl: string;
1077 }) {
1078 const lance = await this.initLanceDb();
1079 if (!lance) {
1080 throw new Error("LanceDB not available on this platform");
1081 }
1082
1083 const conn = await lance.connect(getLanceDbPath());
1084 const tableNames = await conn.tableNames();
1085 const { provider } = await this.getEmbeddingsProvider();
1086
1087 if (!provider) {
1088 throw new Error(
1089 "Could not retrieve @docs Lance Table: no embeddings provider specified",
1090 );
1091 }
1092
1093 const tableNameFromEmbeddingsProvider =
1094 await this.getLanceTableName(provider);
1095
1096 if (!tableNames.includes(tableNameFromEmbeddingsProvider)) {
1097 if (initializationVector) {
1098 await this.createLanceDocsTable(
1099 conn,
1100 initializationVector,
1101 tableNameFromEmbeddingsProvider,
1102 );
1103 } else {
1104 console.trace(
1105 "No existing Lance DB docs table was found and no initialization " +
1106 "vector was passed to create one",
1107 );
1108 }
1109 }
1110
1111 const table = await conn.openTable(tableNameFromEmbeddingsProvider);
1112
1113 this.lanceTableNamesSet.add(tableNameFromEmbeddingsProvider);
1114
1115 return table;
1116 }
1117
1118 // Methods for adding individual docs
1119 private async addToLance({

Callers 4

getDetailsMethod · 0.95
retrieveChunksMethod · 0.95
getIndexedPagesMethod · 0.95
addToLanceMethod · 0.95

Calls 6

initLanceDbMethod · 0.95
getEmbeddingsProviderMethod · 0.95
getLanceTableNameMethod · 0.95
createLanceDocsTableMethod · 0.95
getLanceDbPathFunction · 0.90
addMethod · 0.65

Tested by

no test coverage detected