Overview
The @reverbia/sdk/react package provides a collection of React hooks
designed to simplify building AI features in your applications. These hooks
abstract away the complexity of managing streaming responses, loading states,
authentication, and real-time updates, letting you focus on creating great
user experiences.
Why Use These Hooks?
Building AI-powered interfaces involves handling many concerns: streaming responses token-by-token, managing conversation state, coordinating tool execution, processing file attachments, and more. These hooks provide production-ready abstractions that handle these complexities out of the box.
Key benefits:
- Streaming-first: Built-in support for real-time streaming with automatic UI updates as content arrives
- State management: Automatic handling of loading states, errors, and request lifecycle
- File processing: Extract text from PDFs and images (OCR) to provide document context to your AI
- Memory & context: Extract and retrieve relevant memories using semantic search to make your AI context-aware
- Wallet-based encryption: Secure data encryption using wallet signatures for Web3 applications
Quick Start
import { useChat } from "@reverbia/sdk/react";
function ChatComponent() {
const { isLoading, sendMessage, stop } = useChat({
getToken: async () => getAuthToken(),
onData: (chunk) => setResponse((prev) => prev + chunk),
});
const handleSend = async () => {
await sendMessage({
messages: [{ role: "user", content: [{ type: "text", text: input }] }],
model: "gpt-4o-mini",
});
};
return (
<div>
<button onClick={handleSend} disabled={isLoading}>Send</button>
{isLoading && <button onClick={stop}>Stop</button>}
</div>
);
}Encryption
| Function | Description |
|---|---|
| decryptData | Decrypts data using AES-GCM with the stored encryption key. |
| decryptDataBatch | Batch decrypt multiple values efficiently with a single key lookup. Much faster than calling decryptData for each value individually. |
| encryptData | Encrypts data using AES-GCM with the stored encryption key. |
| encryptDataBatch | Batch encrypt multiple values efficiently with a single key lookup. Much faster than calling encryptData for each value individually. |
Hooks
| Name | Description |
|---|---|
| UseEncryptionResult | Result returned by the useEncryption hook. |
| UseOCRResult | Result returned by the useOCR hook. |
| UsePdfResult | Result returned by the usePdf hook. |
| UseVoiceOptions | Options for the useVoice hook. |
| UseVoiceResult | Result returned by the useVoice hook. |
| useBackup | Unified React hook for backup and restore functionality. |
| useBackupAuth | Hook to access unified backup authentication state and methods. |
| useChat | A React hook for managing chat completions with authentication. |
| useCredits | React hook for managing credits: checking balance, claiming daily credits, browsing packs, and purchasing credits. |
| useDropboxAuth | Hook to access Dropbox authentication state and methods. |
| useDropboxBackup | React hook for Dropbox backup and restore functionality. |
| useEncryption | Hook that provides encryption key management for securing local data. |
| useFiles | A React hook for managing files (images, videos, audio, documents). |
| useGoogleDriveAuth | Hook to access Google Drive authentication state and methods. |
| useGoogleDriveBackup | React hook for Google Drive backup and restore functionality. |
| useICloudAuth | Hook to access iCloud authentication state and methods. |
| useICloudBackup | React hook for iCloud backup and restore functionality. |
| useMemoryStorage | A React hook that wraps useMemory with automatic memory persistence using WatermelonDB. |
| useModels | React hook for fetching available LLM models. Automatically fetches all available models. |
| useOCR | React hook for extracting text from images using OCR. |
| usePdf | React hook for extracting text from PDF files. |
| useProjects | A React hook for managing projects (conversation groups). |
| useSettings | A React hook for managing user settings with automatic persistence using WatermelonDB. |
| useSubscription | React hook for managing subscription status and billing operations. Provides methods to check status, upgrade, manage billing, cancel, and renew subscriptions. |
| useTools | React hook for fetching and caching server-side tools. |
| useVoice | React hook for recording voice and transcribing it on-device using Whisper. |
Other
BACKUP_DRIVE_CONVERSATIONS_FOLDER
Renames and re-exports DEFAULT_DRIVE_CONVERSATIONS_FOLDER
BACKUP_DRIVE_ROOT_FOLDER
Renames and re-exports DEFAULT_DRIVE_ROOT_FOLDER
BACKUP_ICLOUD_FOLDER
Renames and re-exports DEFAULT_ICLOUD_BACKUP_FOLDER
DEFAULT_DROPBOX_FOLDER
Renames and re-exports DEFAULT_BACKUP_FOLDER