react-ai-assist
TypeScript icon, indicating that this package has built-in type declarations

0.0.26 • Public • Published

Introduction

AI-Assistant helps adding AI capabilities to your React SPA applications while keeping your data secure and private.

License

MIT License.

Features

Usage

You can use the AiAssistant component to add AI capabilities to your React SPA applications directly.

import { AiAssistant } from 'react-ai-assistant';
import 'react-ai-assist/dist/index.css';

<AiAssistant 
  modelProvider="openai"
  model="gpt-4o"
  apiKey="your-api-key"
  welcomeMessage="Hello, how can I help you today?"
  instructions="You are a helpful assistant."
  functions={[]}
/>

See an example:

kepler.gl AI Assistant (kepler.gl) GeoDa.AI AI Assistant (geoda.ai)
Screenshot 2024-12-08 at 9 12 22 PM Screenshot 2024-12-08 at 9 13 43 PM

Screenshot to Ask

Click to watch the video Screenshot 2024-12-08 at 9 13 43 PM

Talk to Ask

Click to watch the video Screenshot 2024-12-08 at 9 13 43 PM

Installation

npm install react-ai-assistant

Usage

import { AiAssistant } from 'react-ai-assistant';
import 'react-ai-assist/dist/index.css';

<AiAssistant 
  modelProvider="openai"
  model="gpt-4o"
  apiKey="your-api-key"
  welcomeMessage="Hello, how can I help you today?"
  instructions="You are a helpful assistant."
  functions={[]}
/>

You can use useAssistant hook to get the assistant instance directly.

import { useAssistant } from 'react-ai-assistant';

const {initializeAssistant, addAdditionalContext} = useAssistant(assistantProps);

The package provides utiles to manage the assistant state.

For example, you can use it to create a configuration UI for your assistant:

Screenshot 2024-12-08 at 9 12 49 PM

Tutorial

See the example for more details.

Package Sidebar

Install

npm i react-ai-assist

Weekly Downloads

495

Version

0.0.26

License

MIT

Unpacked Size

9.63 MB

Total Files

52

Last publish

Collaborators

  • lixun910