Skip to content

Latest commit

 

History

History
55 lines (41 loc) · 1.06 KB

File metadata and controls

55 lines (41 loc) · 1.06 KB

@ainative/ai-kit-react API Reference

React hooks and components for AI Kit

Installation

npm install @ainative/ai-kit-react

Overview

The React package provides:

  • Hooks: useAIStream, useConversation
  • Components: ChatInterface, MessageList, UsageDashboard, CodeBlock
  • Component Registry: Custom tool result rendering

Modules

Quick Start

import { useAIStream } from '@ainative/ai-kit-react';

function ChatApp() {
  const {
    messages,
    isStreaming,
    send,
    reset
  } = useAIStream({
    endpoint: '/api/chat',
    model: 'gpt-4'
  });

  return (
    <div>
      {messages.map(msg => (
        <div key={msg.id}>{msg.content}</div>
      ))}
      <button onClick={() => send('Hello!')}>Send</button>
    </div>
  );
}

See Also