agentskit.js
Examples

RAG Chat

Retrieval-Augmented Generation — chat with your documents. Show citations, source references, and document context alongside AI responses.

Retrieval-Augmented Generation — chat with your documents. Show citations, source references, and document context alongside AI responses.

Knowledge Base Chat
Context: 3 documents loaded
Loaded Documents
api-docs.md
12.4 KB
changelog.md
8.1 KB
faq.md
5.7 KB
Assistant
Hi! I'm connected to your knowledge base. Ask me anything about the API, recent changes, or common questions.

With AgentsKit

import { useChat, ChatContainer, Message, InputBar } from '@agentskit/react'

function RAGChat() {
  const chat = useChat({
    adapter: myRAGAdapter,
    initialMessages: [{
      id: 'sys', role: 'system',
      content: 'Answer based on the provided documents. Cite sources.',
      status: 'complete', createdAt: new Date()
    }],
  })
  return (
    <ChatContainer>
      {chat.messages.map(msg => (
        <Message key={msg.id} message={msg} />
      ))}
      <InputBar chat={chat} placeholder="Ask about your documents..." />
    </ChatContainer>
  )
}
✎ Edit this page on GitHub·Found a problem? Open an issue →·How to contribute →

On this page