* Queries the code index. * @param query Text to query the index with. * @param options Optional. Options to use when querying the index. * @returns Found documents.
(query: string, options?: DocumentQueryOptions)
| 262 | * @returns Found documents. |
| 263 | */ |
| 264 | public async query(query: string, options?: DocumentQueryOptions): Promise<LocalDocumentResult[]> { |
| 265 | if (!await this.isCreated()) { |
| 266 | throw new Error('Index has not been created yet. Please run `codepilot create` first.'); |
| 267 | } |
| 268 | if (!await this.hasKeys()) { |
| 269 | throw new Error("A local vectra.keys file couldn't be found. Please run `codepilot set --key <your OpenAI key>`."); |
| 270 | } |
| 271 | |
| 272 | // Query document index |
| 273 | const index = await this.load(); |
| 274 | return await index.queryDocuments(query, options); |
| 275 | } |
| 276 | |
| 277 | // LLM-REGION |
| 278 |
no test coverage detected