diff options
| author | A.J. Shulman <Shulman.aj@gmail.com> | 2024-08-29 21:01:29 -0400 |
|---|---|---|
| committer | A.J. Shulman <Shulman.aj@gmail.com> | 2024-08-29 21:01:29 -0400 |
| commit | 3a1d859359b462fc9a9f1c001d6681a8d886f2b6 (patch) | |
| tree | a0969bee2375be2c2d795dcd046de60ed67a3ad5 /src/client/views/nodes/ChatBox/tools | |
| parent | 9be434cddc30baada63aff0c5dae6dbf606f2590 (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.ts | 5 |
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'); } |
