Skip to Content
SdkReactOverview

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

FunctionDescription
decryptDataDecrypts data using AES-GCM with the stored encryption key.
decryptDataBatchBatch decrypt multiple values efficiently with a single key lookup. Much faster than calling decryptData for each value individually.
encryptDataEncrypts data using AES-GCM with the stored encryption key.
encryptDataBatchBatch encrypt multiple values efficiently with a single key lookup. Much faster than calling encryptData for each value individually.

Hooks

NameDescription
UseEncryptionResultResult returned by the useEncryption hook.
UseOCRResultResult returned by the useOCR hook.
UsePdfResultResult returned by the usePdf hook.
UseVoiceOptionsOptions for the useVoice hook.
UseVoiceResultResult returned by the useVoice hook.
useBackupUnified React hook for backup and restore functionality.
useBackupAuthHook to access unified backup authentication state and methods.
useChatA React hook for managing chat completions with authentication.
useCreditsReact hook for managing credits: checking balance, claiming daily credits, browsing packs, and purchasing credits.
useDropboxAuthHook to access Dropbox authentication state and methods.
useDropboxBackupReact hook for Dropbox backup and restore functionality.
useEncryptionHook that provides encryption key management for securing local data.
useFilesA React hook for managing files (images, videos, audio, documents).
useGoogleDriveAuthHook to access Google Drive authentication state and methods.
useGoogleDriveBackupReact hook for Google Drive backup and restore functionality.
useICloudAuthHook to access iCloud authentication state and methods.
useICloudBackupReact hook for iCloud backup and restore functionality.
useMemoryStorageA React hook that wraps useMemory with automatic memory persistence using WatermelonDB.
useModelsReact hook for fetching available LLM models. Automatically fetches all available models.
useOCRReact hook for extracting text from images using OCR.
usePdfReact hook for extracting text from PDF files.
useProjectsA React hook for managing projects (conversation groups).
useSettingsA React hook for managing user settings with automatic persistence using WatermelonDB.
useSubscriptionReact hook for managing subscription status and billing operations. Provides methods to check status, upgrade, manage billing, cancel, and renew subscriptions.
useToolsReact hook for fetching and caching server-side tools.
useVoiceReact 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

Last updated on