aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/chatbot/vectorstore
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2024-09-30 12:19:22 -0400
committerbobzel <zzzman@gmail.com>2024-09-30 12:19:22 -0400
commit139a3cb0b3b081c270187e9b4ca281d04ca923bf (patch)
treedd952f65f1bb53c29059fa22c2a38db8e0c47c47 /src/client/views/nodes/chatbot/vectorstore
parent04f1047d81bba00f9258543a8171683bce5272bb (diff)
upate AJ assistant from master and fix some lint errors
Diffstat (limited to 'src/client/views/nodes/chatbot/vectorstore')
-rw-r--r--src/client/views/nodes/chatbot/vectorstore/Vectorstore.ts13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/client/views/nodes/chatbot/vectorstore/Vectorstore.ts b/src/client/views/nodes/chatbot/vectorstore/Vectorstore.ts
index 07a2b73bc..9575277f7 100644
--- a/src/client/views/nodes/chatbot/vectorstore/Vectorstore.ts
+++ b/src/client/views/nodes/chatbot/vectorstore/Vectorstore.ts
@@ -1,11 +1,11 @@
-import { Pinecone, Index, IndexList, PineconeRecord, RecordMetadata, QueryResponse } from '@pinecone-database/pinecone';
+import { Index, IndexList, Pinecone, PineconeRecord, QueryResponse, RecordMetadata } from '@pinecone-database/pinecone';
import { CohereClient } from 'cohere-ai';
import { EmbedResponse } from 'cohere-ai/api';
import dotenv from 'dotenv';
-import { RAGChunk, AI_Document, CHUNK_TYPE } from '../types/types';
import { Doc } from '../../../../../fields/Doc';
import { CsvCast, PDFCast, StrCast } from '../../../../../fields/Types';
import { Networking } from '../../../../Network';
+import { AI_Document, CHUNK_TYPE, RAGChunk } from '../types/types';
dotenv.config();
@@ -103,8 +103,8 @@ export class Vectorstore {
const { jobId } = await Networking.PostToServer('/createDocument', { file_path: local_file_path });
// Poll the server for progress updates.
- let inProgress: boolean = true;
- let result: any = null;
+ const inProgress = true;
+ let result: (AI_Document & { doc_id: string }) | null = null; // bcz: is this the correct type??
while (inProgress) {
// Polling interval for status updates.
await new Promise(resolve => setTimeout(resolve, 2000));
@@ -127,6 +127,9 @@ export class Vectorstore {
progressCallback(progress, step);
}
}
+ if (!result) {
+ throw new Error('no result received...'); // bcz: is this an Error?
+ }
// Once completed, process the document and add it to the vectorstore.
console.log('Document JSON:', result);
@@ -175,7 +178,7 @@ export class Vectorstore {
* Indexes the processed document by uploading the document's vector chunks to the Pinecone index.
* @param document The processed document containing its chunks and metadata.
*/
- private async indexDocument(document: any) {
+ private async indexDocument(document: AI_Document) {
console.log('Uploading vectors to content namespace...');
// Prepare Pinecone records for each chunk in the document.