Skip to content

Commit 2415970

Browse files
committed
revert(examples): remove ElevenLabs realtime demo
1 parent 3e53cae commit 2415970

5 files changed

Lines changed: 8 additions & 46 deletions

File tree

examples/ai-e2e-next/.env.local.example

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,6 @@
22
# Then get your OpenAI API Key here: https://platform.openai.com/account/api-keys
33
OPENAI_API_KEY=xxxxxxx
44

5-
# Required for the ElevenLabs provider in the realtime example.
6-
# Create an agent at https://elevenlabs.io/app and copy its Agent ID.
7-
ELEVENLABS_API_KEY=xxxxxxx
8-
ELEVENLABS_AGENT_ID=xxxxxxx
9-
105
# You must first create an OpenAI Assistant here: https://platform.openai.com/assistants
116
# Then get your Assistant ID here: https://platform.openai.com/assistants
127
ASSISTANT_ID=xxxxxxx

examples/ai-e2e-next/app/api/realtime/[...path]/route.ts

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { openai } from '@ai-sdk/openai';
22
import { google } from '@ai-sdk/google';
33
import { xai } from '@ai-sdk/xai';
4-
import { elevenLabs } from '@ai-sdk/elevenlabs';
54
import {
65
experimental_getRealtimeToolDefinitions as getRealtimeToolDefinitions,
76
gateway,
@@ -52,10 +51,6 @@ const providers: Record<string, { factory: RealtimeFactory; model: string }> = {
5251
factory: xai.experimental_realtime,
5352
model: 'grok-voice-latest',
5453
},
55-
elevenlabs: {
56-
factory: elevenLabs.experimental_realtime,
57-
model: process.env.ELEVENLABS_AGENT_ID ?? '',
58-
},
5954
gateway: {
6055
factory: gateway.experimental_realtime,
6156
model: 'openai/gpt-realtime-2',
@@ -80,13 +75,6 @@ export async function POST(
8075
const toolDefs = await getRealtimeToolDefinitions({ tools });
8176

8277
const { factory, model } = providers[provider] ?? providers.openai;
83-
if (!model) {
84-
return Response.json(
85-
{ error: `Missing model configuration for provider: ${provider}` },
86-
{ status: 400 },
87-
);
88-
}
89-
9078
const tokenResult = await factory.getToken({
9179
model,
9280
sessionConfig: { ...sessionConfig, tools: toolDefs },

examples/ai-e2e-next/app/realtime/page.tsx

Lines changed: 8 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,9 @@ import { experimental_useRealtime } from '@ai-sdk/react';
44
import { openai } from '@ai-sdk/openai';
55
import { google } from '@ai-sdk/google';
66
import { xai } from '@ai-sdk/xai';
7-
import { elevenLabs } from '@ai-sdk/elevenlabs';
87
import { useState, useRef, useEffect, useMemo } from 'react';
98

10-
type Provider = 'openai' | 'google' | 'xai' | 'elevenlabs';
9+
type Provider = 'openai' | 'google' | 'xai';
1110

1211
type VoiceOption = { id: string; label: string };
1312

@@ -24,7 +23,6 @@ const PROVIDER_CONFIG: Record<
2423
createModel: (
2524
modelId: string,
2625
) => ReturnType<typeof openai.experimental_realtime>;
27-
usesAgentConfiguration?: boolean;
2826
sessionConfigOverrides?: Record<string, unknown>;
2927
}
3028
> = {
@@ -61,17 +59,6 @@ const PROVIDER_CONFIG: Record<
6159
staticVoices: toVoiceOptions(['ara', 'eve', 'leo', 'rex', 'sal']),
6260
createModel: modelId => xai.experimental_realtime(modelId),
6361
},
64-
elevenlabs: {
65-
label: 'ElevenLabs',
66-
defaultModel: 'configured-agent',
67-
staticVoices: [],
68-
createModel: modelId => elevenLabs.experimental_realtime(modelId),
69-
usesAgentConfiguration: true,
70-
sessionConfigOverrides: {
71-
inputAudioFormat: { type: 'audio/pcm', rate: 16000 },
72-
outputAudioFormat: { type: 'audio/pcm', rate: 16000 },
73-
},
74-
},
7562
};
7663

7764
export default function RealtimePage() {
@@ -145,7 +132,7 @@ export default function RealtimePage() {
145132
style={selectStyle}
146133
>
147134
{currentVoices.length === 0 ? (
148-
<option>Agent default</option>
135+
<option>No voices available</option>
149136
) : (
150137
currentVoices.map(v => (
151138
<option key={v.id} value={v.id}>
@@ -198,16 +185,12 @@ function RealtimeChat({
198185

199186
const sessionConfig = useMemo(
200187
() => ({
201-
...(config.usesAgentConfiguration
202-
? {}
203-
: {
204-
instructions:
205-
'You are a helpful assistant. Be concise. ' +
206-
'You have access to tools for weather and dice rolling.',
207-
inputAudioTranscription: {},
208-
...(voice ? { voice } : {}),
209-
turnDetection: { type: 'server-vad' as const },
210-
}),
188+
instructions:
189+
'You are a helpful assistant. Be concise. ' +
190+
'You have access to tools for weather and dice rolling.',
191+
inputAudioTranscription: {},
192+
voice,
193+
turnDetection: { type: 'server-vad' as const },
211194
...config.sessionConfigOverrides,
212195
}),
213196
[voice, config],

examples/ai-e2e-next/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
"@ai-sdk/azure": "workspace:*",
1515
"@ai-sdk/cohere": "workspace:*",
1616
"@ai-sdk/deepseek": "workspace:*",
17-
"@ai-sdk/elevenlabs": "workspace:*",
1817
"@ai-sdk/fireworks": "workspace:*",
1918
"@ai-sdk/google": "workspace:*",
2019
"@ai-sdk/google-vertex": "workspace:*",

pnpm-lock.yaml

Lines changed: 0 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)