Skip to Content

Quick Start

Install

bun add @shipshit/ai

Client-Side Usage

import { useAI } from '@shipshit/ai/react' function ChatPanel() { const { messages, send, isLoading } = useAI({ app: 'sdr', getToken: () => clerk.session?.getToken() ?? null, }) return ( <div> {messages.map(m => <p key={m.content}>{m.content}</p>)} <input onKeyDown={e => { if (e.key === 'Enter') send(e.currentTarget.value) }} /> </div> ) }

Server-Side Usage

import { createServerAI } from '@shipshit/ai/server' const ai = createServerAI({ app: 'sdr', apiSecret: process.env.SHIPSHIT_AI_SECRET!, }) // Index content await ai.index({ id: `lead-${lead.id}`, app: 'sdr', contentType: 'lead', text: `${lead.name} at ${lead.company}`, userId: lead.ownerId, }) // Emit events await ai.emit({ type: 'lead.created', app: 'sdr', data: { leadId: lead.id }, userId: lead.ownerId, })
Last updated on