mirror of
https://github.com/CopilotKit/CopilotKit.git
synced 2026-09-14 16:26:20 +08:00
7673b8dfb8
CI build runners use a Node with native TypeScript stripping enabled (process.features.typescript), so tsdown selects its native ESM config loader. That loader cannot resolve the extensionless relative import "../../scripts/tsdown-exports" in each tsdown.config.ts, so every package build failed with "Cannot find module" — cascading into the unit, runtime, and all integration jobs (which run the build first). Local builds used tsdown's bundler loader instead, which is why this passed pre-push. Ship the shared helper as scripts/tsdown-exports.mjs (real ESM) plus a hand-written tsdown-exports.d.mts, imported with the explicit .mjs extension. This resolves under the native loader, tsdown's bundler loader, and tsc alike. The generated exports are unchanged — package.json maps stay identical. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@copilotkit/voice
Audio transcription providers for CopilotKit.
Setup
pnpm add @copilotkit/voice openai
import { CopilotRuntime, createCopilotEndpoint } from "@copilotkit/runtime";
import { TranscriptionServiceOpenAI } from "@copilotkit/voice";
import OpenAI from "openai";
const runtime = new CopilotRuntime({
agents: { default: yourAgent },
transcriptionService: new TranscriptionServiceOpenAI({
openai: new OpenAI({ apiKey: process.env.OPENAI_API_KEY }),
}),
});
Once configured, the chat UI shows a microphone button. Users can record audio, which gets transcribed and inserted into the input field as text.
TranscriptionServiceOpenAI
Uses OpenAI Whisper for transcription.
new TranscriptionServiceOpenAI({
openai: new OpenAI({ apiKey: "..." }), // required
model: "whisper-1", // default
language: "en", // optional, ISO-639-1 code
prompt: "Technical discussion context", // optional, helps with domain terms
temperature: 0, // optional, 0 = deterministic
});
Custom providers
Extend TranscriptionService from runtime:
import {
TranscriptionService,
TranscribeFileOptions,
} from "@copilotkit/runtime";
class MyTranscriptionService extends TranscriptionService {
async transcribeFile(options: TranscribeFileOptions): Promise<string> {
// options.audioFile, options.mimeType, options.size
return "transcribed text";
}
}