Skip to content

Commit a0f88b0

Browse files
committed
ref
1 parent e78f0ab commit a0f88b0

File tree

1 file changed

+14
-18
lines changed

1 file changed

+14
-18
lines changed

examples/speech/agent-eleven-labs-speech-sts.php

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -24,27 +24,23 @@
2424

2525
require_once dirname(__DIR__).'/bootstrap.php';
2626

27-
$eventDispatcher = new EventDispatcher();
28-
$eventDispatcher->addSubscriber(new SpeechProviderListener([
29-
new ElevenLabsSpeechProvider(new SpeechAwarePlatform(
30-
PlatformFactory::create(
31-
apiKey: env('ELEVEN_LABS_API_KEY'),
32-
httpClient: http_client(),
33-
),
34-
speechConfiguration: new SpeechConfiguration(
35-
ttsModel: 'eleven_multilingual_v2',
36-
ttsVoice: 'Dslrhjl3ZpzrctukrQSN', // Brad (https://elevenlabs.io/app/voice-library?voiceId=Dslrhjl3ZpzrctukrQSN)
37-
sttModel: 'eleven_multilingual_v2'
38-
)),
39-
),
40-
], [
41-
new ElevenLabsSpeechListener(PlatformFactory::create(
27+
$speechAwarePlatform = new SpeechAwarePlatform(
28+
PlatformFactory::create(
4229
apiKey: env('ELEVEN_LABS_API_KEY'),
4330
httpClient: http_client(),
44-
speechConfiguration: new SpeechConfiguration(
45-
sttModel: 'scribe_v1'
46-
)),
4731
),
32+
new SpeechConfiguration(
33+
ttsModel: 'eleven_multilingual_v2',
34+
ttsVoice: 'Dslrhjl3ZpzrctukrQSN', // Brad (https://elevenlabs.io/app/voice-library?voiceId=Dslrhjl3ZpzrctukrQSN)
35+
sttModel: 'eleven_multilingual_v2'
36+
),
37+
);
38+
39+
$eventDispatcher = new EventDispatcher();
40+
$eventDispatcher->addSubscriber(new SpeechProviderListener([
41+
new ElevenLabsSpeechProvider($speechAwarePlatform),
42+
], [
43+
new ElevenLabsSpeechListener($speechAwarePlatform),
4844
]));
4945

5046
$platform = OpenAiPlatformFactory::create(env('OPENAI_API_KEY'), httpClient: http_client(), eventDispatcher: $eventDispatcher);

0 commit comments

Comments
 (0)