aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/ChatBox/tools
diff options
context:
space:
mode:
authorA.J. Shulman <Shulman.aj@gmail.com>2024-08-29 21:01:29 -0400
committerA.J. Shulman <Shulman.aj@gmail.com>2024-08-29 21:01:29 -0400
commit3a1d859359b462fc9a9f1c001d6681a8d886f2b6 (patch)
treea0969bee2375be2c2d795dcd046de60ed67a3ad5 /src/client/views/nodes/ChatBox/tools
parent9be434cddc30baada63aff0c5dae6dbf606f2590 (diff)
added loop summary and updated type for RAG tool output
Diffstat (limited to 'src/client/views/nodes/ChatBox/tools')
-rw-r--r--src/client/views/nodes/ChatBox/tools/RAGTool.ts5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/client/views/nodes/ChatBox/tools/RAGTool.ts b/src/client/views/nodes/ChatBox/tools/RAGTool.ts
index fcd0ea43f..fe8deae6b 100644
--- a/src/client/views/nodes/ChatBox/tools/RAGTool.ts
+++ b/src/client/views/nodes/ChatBox/tools/RAGTool.ts
@@ -4,6 +4,7 @@ import { RAGChunk } from '../types';
import * as fs from 'fs';
import { Networking } from '../../../../Network';
import { file } from 'jszip';
+import { ChatCompletion, ChatCompletionContentPart, ChatCompletionMessageParam } from 'openai/resources';
export class RAGTool extends BaseTool<{ hypothetical_document_chunk: string }> {
constructor(private vectorstore: Vectorstore) {
@@ -118,10 +119,10 @@ export class RAGTool extends BaseTool<{ hypothetical_document_chunk: string }> {
return formatted_chunks;
}
- async getFormattedChunks(relevantChunks: RAGChunk[]): Promise<{ type: string; text?: string; image_url?: { url: string } }[]> {
+ async getFormattedChunks(relevantChunks: RAGChunk[]): Promise<ChatCompletionContentPart[]> {
try {
const { formattedChunks } = await Networking.PostToServer('/formatChunks', { relevantChunks });
- console.log('Formatted Chunks:', formattedChunks);
+
if (!formattedChunks) {
throw new Error('Failed to format chunks');
}