Skip to content

@sqlrooms/ai-rag / createRagTool

Function: createRagTool()

createRagTool(): Tool<{ query: string; database?: string; topK: number; }, RagToolLlmResult>

Create a RAG (Retrieval Augmented Generation) tool for AI.

This tool allows the AI to search through embedded documentation to find relevant context before answering questions.

Returns

Tool<{ query: string; database?: string; topK: number; }, RagToolLlmResult>

Example

typescript
const store = createRoomStore({
  slices: [
    createRagSlice({embeddingsDatabases: [...]}),
    createAiSlice({
      tools: {
        rag: createRagTool(),
      }
    })
  ]
});