sinsintro-ai-assistant-dh
Version:
A single npm package providing a React-based voice assistant with OpenAI function-calling, purely client-side.
21 lines (18 loc) • 526 B
JavaScript
// src/backend/index.js
import { AIAssistant } from './assistant.js';
/**
* createAssistant
* Creates an AIAssistant instance for client-side usage
*
* @param {object} options
* @param {string} options.apiKey
* @param {Array} options.functions
*/
export async function createAssistant({ apiKey, functions = [] }) {
if (!apiKey) {
throw new Error('No OpenAI API key provided.');
}
// Return the AIAssistant
const assistant = new AIAssistant(apiKey, functions);
return assistant;
}