* Loads the current code index.
()
| 182 | * Loads the current code index. |
| 183 | */ |
| 184 | load() { |
| 185 | return __awaiter(this, void 0, void 0, function* () { |
| 186 | if (!this._config) { |
| 187 | const configPath = path.join(this.folderPath, 'config.json'); |
| 188 | this._config = JSON.parse(yield fs.readFile(configPath, 'utf-8')); |
| 189 | } |
| 190 | if (!this._keys) { |
| 191 | const keysPath = path.join(this.folderPath, 'vectra.keys'); |
| 192 | this._keys = JSON.parse(yield fs.readFile(keysPath, 'utf-8')); |
| 193 | } |
| 194 | if (!this._index) { |
| 195 | const folderPath = path.join(this.folderPath, 'index'); |
| 196 | const embeddings = new vectra_1.OpenAIEmbeddings(Object.assign({ model: 'text-embedding-ada-002' }, this._keys)); |
| 197 | this._index = new vectra_1.LocalDocumentIndex({ |
| 198 | folderPath, |
| 199 | embeddings, |
| 200 | }); |
| 201 | } |
| 202 | return this._index; |
| 203 | }); |
| 204 | } |
| 205 | // LLM-REGION |
| 206 | /** |
| 207 | * Queries the code index. |
no outgoing calls
no test coverage detected