@originalvoices/ai-sdk
v0.2.0
Published
Vercel AI SDK tool that provides access to OriginalVoices' network of Digital Twins for real-time audience research
Maintainers
Readme
OriginalVoices AI SDK
Vercel AI SDK tool that provides access to OriginalVoices' network of Digital Twins for real-time audience research.
Installation
npm install @originalvoices/ai-sdkPeer Dependencies: This package requires ai (^6.0.0) and zod (^4.0.0) as peer dependencies. If you're using the Vercel AI SDK, you likely already have these installed.
Setup
Get your API key from OriginalVoices
Set your API key as an environment variable:
ORIGINALVOICES_API_KEY=your_api_key_hereUsage
With Vercel AI SDK
import { generateText } from 'ai';
import { askTwins } from '@originalvoices/ai-sdk';
const result = await generateText({
model: YOUR_MODEL, // e.g., openai('gpt-4o'), anthropic('claude-3-5-sonnet'), etc.
tools: { askTwins },
prompt: 'I want to understand what influences UK fitness enthusiasts aged 18-30 when buying new running shoes',
});
console.log(result.text);Tool: askTwins
Trigger an OriginalVoices Twin interaction to gather insights from a specific audience. Twins are AI-powered digital personas representing real audience segments.
Input Parameters
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| audience | string | Yes | The specific demographic or target group the Twin should address |
| questions | string[] | Yes | A list of specific inquiries or prompts for the Twin to process |
Response
{
data: {
answers: Array<Array<{
answer: string;
confidence: number;
}>>;
};
requestId: string;
}Examples
See the examples directory for more usage examples.
# Run the example (requires ORIGINALVOICES_API_KEY to be set)
npx tsx examples/askTwins.example.tsDevelopment
# Install dependencies
npm install
# Build
npm run build
# Watch mode
npm run devLinks
- OriginalVoices - Get your API key
- Vercel AI SDK - AI SDK documentation
- GitHub Repository
License
MIT © OriginalVoices
