agora-agents 2.0.0 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (218) hide show
  1. package/README.md +38 -9
  2. package/dist/cjs/BaseClient.js +2 -2
  3. package/dist/cjs/agentkit/Agent.d.ts +49 -9
  4. package/dist/cjs/agentkit/Agent.js +92 -7
  5. package/dist/cjs/agentkit/AgentSession.d.ts +3 -3
  6. package/dist/cjs/agentkit/AgentSession.js +8 -7
  7. package/dist/cjs/agentkit/__tests__/type-safety.test.js +23 -3
  8. package/dist/cjs/agentkit/constants.d.ts +5 -4
  9. package/dist/cjs/agentkit/constants.js +5 -4
  10. package/dist/cjs/agentkit/index.d.ts +1 -1
  11. package/dist/cjs/agentkit/types.d.ts +50 -35
  12. package/dist/cjs/agentkit/vendors/avatar.d.ts +3 -1
  13. package/dist/cjs/agentkit/vendors/avatar.js +3 -1
  14. package/dist/cjs/agentkit/vendors/llm.d.ts +18 -8
  15. package/dist/cjs/agentkit/vendors/llm.js +83 -15
  16. package/dist/cjs/agentkit/vendors/mllm.d.ts +16 -0
  17. package/dist/cjs/agentkit/vendors/mllm.js +11 -7
  18. package/dist/cjs/agentkit/vendors/stt.d.ts +29 -11
  19. package/dist/cjs/agentkit/vendors/stt.js +74 -53
  20. package/dist/cjs/agentkit/vendors/tts.d.ts +70 -22
  21. package/dist/cjs/agentkit/vendors/tts.js +67 -34
  22. package/dist/cjs/api/resources/agents/client/Client.d.ts +3 -2
  23. package/dist/cjs/api/resources/agents/client/Client.js +3 -2
  24. package/dist/cjs/api/resources/agents/client/requests/StartAgentsRequest.d.ts +8 -331
  25. package/dist/cjs/api/resources/agents/client/requests/StartAgentsRequest.js +0 -107
  26. package/dist/cjs/api/types/AmazonAsr.d.ts +10 -0
  27. package/dist/cjs/api/types/AmazonAsr.js +3 -0
  28. package/dist/cjs/api/types/AmazonAsrParams.d.ts +19 -0
  29. package/dist/cjs/api/types/AmazonAsrParams.js +3 -0
  30. package/dist/cjs/api/types/AmazonTtsParams.d.ts +19 -5
  31. package/dist/cjs/api/types/AmazonTtsParams.js +11 -0
  32. package/dist/cjs/api/types/AresAsr.d.ts +10 -0
  33. package/dist/cjs/api/types/AresAsr.js +3 -0
  34. package/dist/cjs/api/types/AresAsrParams.d.ts +4 -0
  35. package/dist/cjs/api/types/AresAsrParams.js +3 -0
  36. package/dist/cjs/api/types/Asr.d.ts +31 -0
  37. package/dist/cjs/api/types/Asr.js +3 -0
  38. package/dist/cjs/api/types/AsrLanguage.d.ts +36 -0
  39. package/dist/cjs/api/types/AsrLanguage.js +39 -0
  40. package/dist/cjs/api/types/AssemblyAiAsr.d.ts +10 -0
  41. package/dist/cjs/api/types/AssemblyAiAsr.js +3 -0
  42. package/dist/cjs/api/types/AssemblyAiAsrParams.d.ts +13 -0
  43. package/dist/cjs/api/types/AssemblyAiAsrParams.js +3 -0
  44. package/dist/cjs/api/types/CartesiaTtsOutputFormat.d.ts +11 -0
  45. package/dist/cjs/api/types/CartesiaTtsOutputFormat.js +3 -0
  46. package/dist/cjs/api/types/CartesiaTtsParams.d.ts +9 -4
  47. package/dist/cjs/api/types/CartesiaTtsVoice.d.ts +2 -0
  48. package/dist/cjs/api/types/DeepgramAsr.d.ts +12 -0
  49. package/dist/cjs/api/types/DeepgramAsr.js +3 -0
  50. package/dist/cjs/api/types/DeepgramAsrParams.d.ts +17 -0
  51. package/dist/cjs/api/types/DeepgramAsrParams.js +3 -0
  52. package/dist/cjs/api/types/DeepgramTtsParams.d.ts +2 -2
  53. package/dist/cjs/api/types/ElevenLabsTtsParams.d.ts +13 -1
  54. package/dist/cjs/api/types/FishAudioTtsParams.d.ts +5 -1
  55. package/dist/cjs/api/types/GoogleAsr.d.ts +10 -0
  56. package/dist/cjs/api/types/GoogleAsr.js +3 -0
  57. package/dist/cjs/api/types/GoogleAsrParams.d.ts +17 -0
  58. package/dist/cjs/api/types/GoogleAsrParams.js +3 -0
  59. package/dist/cjs/api/types/GoogleTtsAudioConfig.d.ts +11 -0
  60. package/dist/cjs/api/types/GoogleTtsAudioConfig.js +3 -0
  61. package/dist/cjs/api/types/GoogleTtsParams.d.ts +7 -8
  62. package/dist/cjs/api/types/GoogleTtsVoiceSelectionParams.d.ts +9 -0
  63. package/dist/cjs/api/types/GoogleTtsVoiceSelectionParams.js +3 -0
  64. package/dist/cjs/api/types/HumeAiTtsParams.d.ts +21 -1
  65. package/dist/cjs/api/types/HumeAiTtsParams.js +9 -0
  66. package/dist/cjs/api/types/Llm.d.ts +58 -0
  67. package/dist/cjs/api/types/Llm.js +15 -0
  68. package/dist/cjs/api/types/LlmParams.d.ts +11 -0
  69. package/dist/cjs/api/types/LlmParams.js +3 -0
  70. package/dist/cjs/api/types/MicrosoftAsr.d.ts +10 -0
  71. package/dist/cjs/api/types/MicrosoftAsr.js +3 -0
  72. package/dist/cjs/api/types/MicrosoftAsrParams.d.ts +15 -0
  73. package/dist/cjs/api/types/MicrosoftAsrParams.js +3 -0
  74. package/dist/cjs/api/types/MicrosoftTtsParams.d.ts +6 -0
  75. package/dist/cjs/api/types/MinimaxTtsParams.d.ts +4 -0
  76. package/dist/cjs/api/types/Mllm.d.ts +44 -0
  77. package/dist/cjs/api/types/Mllm.js +14 -0
  78. package/dist/cjs/api/types/MllmHttpOptions.d.ts +9 -0
  79. package/dist/cjs/api/types/MllmHttpOptions.js +3 -0
  80. package/dist/cjs/api/types/MllmInputAudioTranscription.d.ts +13 -0
  81. package/dist/cjs/api/types/MllmInputAudioTranscription.js +3 -0
  82. package/dist/cjs/api/types/MllmParams.d.ts +28 -0
  83. package/dist/cjs/api/types/MllmParams.js +3 -0
  84. package/dist/cjs/api/types/MllmTurnDetection.d.ts +65 -0
  85. package/dist/cjs/api/types/MllmTurnDetection.js +33 -0
  86. package/dist/cjs/api/types/MurfTtsParams.d.ts +17 -5
  87. package/dist/cjs/api/types/OpenAiAsr.d.ts +10 -0
  88. package/dist/cjs/api/types/OpenAiAsr.js +3 -0
  89. package/dist/cjs/api/types/OpenAiAsrParams.d.ts +11 -0
  90. package/dist/cjs/api/types/OpenAiAsrParams.js +3 -0
  91. package/dist/cjs/api/types/OpenAiInputAudioTranscription.d.ts +13 -0
  92. package/dist/cjs/api/types/OpenAiInputAudioTranscription.js +3 -0
  93. package/dist/cjs/api/types/OpenAiTtsParams.d.ts +9 -1
  94. package/dist/cjs/api/types/RimeTtsParams.d.ts +7 -3
  95. package/dist/cjs/api/types/SarvamAsr.d.ts +10 -0
  96. package/dist/cjs/api/types/SarvamAsr.js +3 -0
  97. package/dist/cjs/api/types/SarvamAsrParams.d.ts +11 -0
  98. package/dist/cjs/api/types/SarvamAsrParams.js +3 -0
  99. package/dist/cjs/api/types/SarvamTtsParams.d.ts +29 -2
  100. package/dist/cjs/api/types/SarvamTtsParams.js +18 -0
  101. package/dist/cjs/api/types/SpeechmaticsAsr.d.ts +10 -0
  102. package/dist/cjs/api/types/SpeechmaticsAsr.js +3 -0
  103. package/dist/cjs/api/types/SpeechmaticsAsrParams.d.ts +13 -0
  104. package/dist/cjs/api/types/SpeechmaticsAsrParams.js +3 -0
  105. package/dist/cjs/api/types/index.d.ts +31 -0
  106. package/dist/cjs/api/types/index.js +31 -0
  107. package/dist/cjs/index.d.ts +1 -1
  108. package/dist/cjs/version.d.ts +1 -1
  109. package/dist/cjs/version.js +1 -1
  110. package/dist/esm/BaseClient.mjs +2 -2
  111. package/dist/esm/agentkit/Agent.d.mts +49 -9
  112. package/dist/esm/agentkit/Agent.mjs +92 -7
  113. package/dist/esm/agentkit/AgentSession.d.mts +3 -3
  114. package/dist/esm/agentkit/AgentSession.mjs +8 -7
  115. package/dist/esm/agentkit/__tests__/type-safety.test.mjs +23 -3
  116. package/dist/esm/agentkit/constants.d.mts +5 -4
  117. package/dist/esm/agentkit/constants.mjs +5 -4
  118. package/dist/esm/agentkit/index.d.mts +1 -1
  119. package/dist/esm/agentkit/types.d.mts +50 -35
  120. package/dist/esm/agentkit/vendors/avatar.d.mts +3 -1
  121. package/dist/esm/agentkit/vendors/avatar.mjs +3 -1
  122. package/dist/esm/agentkit/vendors/llm.d.mts +18 -8
  123. package/dist/esm/agentkit/vendors/llm.mjs +83 -15
  124. package/dist/esm/agentkit/vendors/mllm.d.mts +16 -0
  125. package/dist/esm/agentkit/vendors/mllm.mjs +11 -7
  126. package/dist/esm/agentkit/vendors/stt.d.mts +29 -11
  127. package/dist/esm/agentkit/vendors/stt.mjs +74 -53
  128. package/dist/esm/agentkit/vendors/tts.d.mts +70 -22
  129. package/dist/esm/agentkit/vendors/tts.mjs +67 -34
  130. package/dist/esm/api/resources/agents/client/Client.d.mts +3 -2
  131. package/dist/esm/api/resources/agents/client/Client.mjs +3 -2
  132. package/dist/esm/api/resources/agents/client/requests/StartAgentsRequest.d.mts +8 -331
  133. package/dist/esm/api/resources/agents/client/requests/StartAgentsRequest.mjs +0 -107
  134. package/dist/esm/api/types/AmazonAsr.d.mts +10 -0
  135. package/dist/esm/api/types/AmazonAsr.mjs +2 -0
  136. package/dist/esm/api/types/AmazonAsrParams.d.mts +19 -0
  137. package/dist/esm/api/types/AmazonAsrParams.mjs +2 -0
  138. package/dist/esm/api/types/AmazonTtsParams.d.mts +19 -5
  139. package/dist/esm/api/types/AmazonTtsParams.mjs +10 -1
  140. package/dist/esm/api/types/AresAsr.d.mts +10 -0
  141. package/dist/esm/api/types/AresAsr.mjs +2 -0
  142. package/dist/esm/api/types/AresAsrParams.d.mts +4 -0
  143. package/dist/esm/api/types/AresAsrParams.mjs +2 -0
  144. package/dist/esm/api/types/Asr.d.mts +31 -0
  145. package/dist/esm/api/types/Asr.mjs +2 -0
  146. package/dist/esm/api/types/AsrLanguage.d.mts +36 -0
  147. package/dist/esm/api/types/AsrLanguage.mjs +36 -0
  148. package/dist/esm/api/types/AssemblyAiAsr.d.mts +10 -0
  149. package/dist/esm/api/types/AssemblyAiAsr.mjs +2 -0
  150. package/dist/esm/api/types/AssemblyAiAsrParams.d.mts +13 -0
  151. package/dist/esm/api/types/AssemblyAiAsrParams.mjs +2 -0
  152. package/dist/esm/api/types/CartesiaTtsOutputFormat.d.mts +11 -0
  153. package/dist/esm/api/types/CartesiaTtsOutputFormat.mjs +2 -0
  154. package/dist/esm/api/types/CartesiaTtsParams.d.mts +9 -4
  155. package/dist/esm/api/types/CartesiaTtsVoice.d.mts +2 -0
  156. package/dist/esm/api/types/DeepgramAsr.d.mts +12 -0
  157. package/dist/esm/api/types/DeepgramAsr.mjs +2 -0
  158. package/dist/esm/api/types/DeepgramAsrParams.d.mts +17 -0
  159. package/dist/esm/api/types/DeepgramAsrParams.mjs +2 -0
  160. package/dist/esm/api/types/DeepgramTtsParams.d.mts +2 -2
  161. package/dist/esm/api/types/ElevenLabsTtsParams.d.mts +13 -1
  162. package/dist/esm/api/types/FishAudioTtsParams.d.mts +5 -1
  163. package/dist/esm/api/types/GoogleAsr.d.mts +10 -0
  164. package/dist/esm/api/types/GoogleAsr.mjs +2 -0
  165. package/dist/esm/api/types/GoogleAsrParams.d.mts +17 -0
  166. package/dist/esm/api/types/GoogleAsrParams.mjs +2 -0
  167. package/dist/esm/api/types/GoogleTtsAudioConfig.d.mts +11 -0
  168. package/dist/esm/api/types/GoogleTtsAudioConfig.mjs +2 -0
  169. package/dist/esm/api/types/GoogleTtsParams.d.mts +7 -8
  170. package/dist/esm/api/types/GoogleTtsVoiceSelectionParams.d.mts +9 -0
  171. package/dist/esm/api/types/GoogleTtsVoiceSelectionParams.mjs +2 -0
  172. package/dist/esm/api/types/HumeAiTtsParams.d.mts +21 -1
  173. package/dist/esm/api/types/HumeAiTtsParams.mjs +8 -1
  174. package/dist/esm/api/types/Llm.d.mts +58 -0
  175. package/dist/esm/api/types/Llm.mjs +12 -0
  176. package/dist/esm/api/types/LlmParams.d.mts +11 -0
  177. package/dist/esm/api/types/LlmParams.mjs +2 -0
  178. package/dist/esm/api/types/MicrosoftAsr.d.mts +10 -0
  179. package/dist/esm/api/types/MicrosoftAsr.mjs +2 -0
  180. package/dist/esm/api/types/MicrosoftAsrParams.d.mts +15 -0
  181. package/dist/esm/api/types/MicrosoftAsrParams.mjs +2 -0
  182. package/dist/esm/api/types/MicrosoftTtsParams.d.mts +6 -0
  183. package/dist/esm/api/types/MinimaxTtsParams.d.mts +4 -0
  184. package/dist/esm/api/types/Mllm.d.mts +44 -0
  185. package/dist/esm/api/types/Mllm.mjs +11 -0
  186. package/dist/esm/api/types/MllmHttpOptions.d.mts +9 -0
  187. package/dist/esm/api/types/MllmHttpOptions.mjs +2 -0
  188. package/dist/esm/api/types/MllmInputAudioTranscription.d.mts +13 -0
  189. package/dist/esm/api/types/MllmInputAudioTranscription.mjs +2 -0
  190. package/dist/esm/api/types/MllmParams.d.mts +28 -0
  191. package/dist/esm/api/types/MllmParams.mjs +2 -0
  192. package/dist/esm/api/types/MllmTurnDetection.d.mts +65 -0
  193. package/dist/esm/api/types/MllmTurnDetection.mjs +30 -0
  194. package/dist/esm/api/types/MurfTtsParams.d.mts +17 -5
  195. package/dist/esm/api/types/OpenAiAsr.d.mts +10 -0
  196. package/dist/esm/api/types/OpenAiAsr.mjs +2 -0
  197. package/dist/esm/api/types/OpenAiAsrParams.d.mts +11 -0
  198. package/dist/esm/api/types/OpenAiAsrParams.mjs +2 -0
  199. package/dist/esm/api/types/OpenAiInputAudioTranscription.d.mts +13 -0
  200. package/dist/esm/api/types/OpenAiInputAudioTranscription.mjs +2 -0
  201. package/dist/esm/api/types/OpenAiTtsParams.d.mts +9 -1
  202. package/dist/esm/api/types/RimeTtsParams.d.mts +7 -3
  203. package/dist/esm/api/types/SarvamAsr.d.mts +10 -0
  204. package/dist/esm/api/types/SarvamAsr.mjs +2 -0
  205. package/dist/esm/api/types/SarvamAsrParams.d.mts +11 -0
  206. package/dist/esm/api/types/SarvamAsrParams.mjs +2 -0
  207. package/dist/esm/api/types/SarvamTtsParams.d.mts +29 -2
  208. package/dist/esm/api/types/SarvamTtsParams.mjs +17 -1
  209. package/dist/esm/api/types/SpeechmaticsAsr.d.mts +10 -0
  210. package/dist/esm/api/types/SpeechmaticsAsr.mjs +2 -0
  211. package/dist/esm/api/types/SpeechmaticsAsrParams.d.mts +13 -0
  212. package/dist/esm/api/types/SpeechmaticsAsrParams.mjs +2 -0
  213. package/dist/esm/api/types/index.d.mts +31 -0
  214. package/dist/esm/api/types/index.mjs +31 -0
  215. package/dist/esm/index.d.mts +1 -1
  216. package/dist/esm/version.d.mts +1 -1
  217. package/dist/esm/version.mjs +1 -1
  218. package/package.json +3 -2
package/README.md CHANGED
@@ -16,6 +16,7 @@ npm install agora-agents
16
16
  ## Quick Start
17
17
 
18
18
  Start with the `Agent` builder: create a client with app credentials, choose your ASR, LLM, and TTS providers, then start a session. Omit vendor API keys for supported Agora-managed models, or provide keys when you want BYOK.
19
+ Set Agora interaction language with `turnDetection.language`; provider-specific STT language values remain under `asr.params`.
19
20
 
20
21
  ```typescript
21
22
  import {
@@ -44,11 +45,8 @@ export async function startConversation(): Promise<string> {
44
45
 
45
46
  const agent = new Agent({
46
47
  name: `conversation-${Date.now()}`,
47
- instructions: AGENT_PROMPT,
48
- greeting: GREETING,
49
- failureMessage: 'Please wait a moment.',
50
- maxHistory: 50,
51
48
  turnDetection: {
49
+ language: 'en-US',
52
50
  config: {
53
51
  speech_threshold: 0.5,
54
52
  start_of_speech: {
@@ -84,9 +82,10 @@ export async function startConversation(): Promise<string> {
84
82
  .withLlm(
85
83
  new OpenAI({
86
84
  model: 'gpt-4o-mini',
85
+ systemMessages: [{ role: 'system', content: AGENT_PROMPT }],
87
86
  greetingMessage: GREETING,
88
87
  failureMessage: 'Please wait a moment.',
89
- maxHistory: 15,
88
+ maxHistory: 50,
90
89
  params: {
91
90
  max_tokens: 1024,
92
91
  temperature: 0.7,
@@ -118,15 +117,42 @@ export async function startConversation(): Promise<string> {
118
117
 
119
118
  `AgoraClient` generates the required ConvoAI REST auth and RTC join tokens automatically when you provide `appId` and `appCertificate`. For supported Agora-managed models, leave vendor API keys unset; provide keys when you want BYOK.
120
119
 
120
+ ## AI Studio pipeline IDs
121
+
122
+ Use `pipelineId` when you want a published AI Studio pipeline to provide the base agent configuration:
123
+
124
+ ```typescript
125
+ const agent = new Agent({
126
+ name: 'support',
127
+ pipelineId: 'studio-pipeline-id',
128
+ });
129
+
130
+ const session = agent.createSession(client, {
131
+ channel: 'support-room',
132
+ agentUid: '1',
133
+ remoteUids: ['100'],
134
+ });
135
+ ```
136
+
137
+ You can override it per session:
138
+
139
+ ```typescript
140
+ const session = agent.createSession(client, {
141
+ channel: 'support-room',
142
+ agentUid: '1',
143
+ remoteUids: ['100'],
144
+ pipelineId: 'session-pipeline-id',
145
+ });
146
+ ```
147
+
148
+ AgentKit sends the resolved value as the top-level `/join` field `pipeline_id`, not inside `properties`. Explicit Agent config such as `.withLlm()`, `.withTts()`, `.withStt()`, `.withMllm()`, and `advancedFeatures` may send `properties` fields that override the saved pipeline settings.
149
+
121
150
  ### BYOK version
122
151
 
123
152
  Use the same `Agent` builder shape, but provide credentials explicitly when you want vendor-managed billing and routing instead of Agora-managed models.
124
153
 
125
154
  ```typescript
126
- const agent = new Agent({
127
- instructions: SUPPORT_PROMPT,
128
- greeting: GREETING,
129
- })
155
+ const agent = new Agent({ turnDetection: { language: 'en-US' } })
130
156
  .withStt(
131
157
  new DeepgramSTT({
132
158
  apiKey: process.env.DEEPGRAM_API_KEY!,
@@ -137,7 +163,10 @@ const agent = new Agent({
137
163
  .withLlm(
138
164
  new OpenAI({
139
165
  apiKey: process.env.OPENAI_API_KEY!,
166
+ url: 'https://api.openai.com/v1/chat/completions',
140
167
  model: 'gpt-4o-mini',
168
+ systemMessages: [{ role: 'system', content: SUPPORT_PROMPT }],
169
+ greetingMessage: GREETING,
141
170
  maxTokens: 1024,
142
171
  temperature: 0.7,
143
172
  topP: 0.95,
@@ -41,8 +41,8 @@ function normalizeClientOptions(options) {
41
41
  const headers = (0, headers_js_1.mergeHeaders)({
42
42
  "X-Fern-Language": "JavaScript",
43
43
  "X-Fern-SDK-Name": "agora-agents",
44
- "X-Fern-SDK-Version": "v2.0.0",
45
- "User-Agent": "agora-agents/v2.0.0",
44
+ "X-Fern-SDK-Version": "v2.1.0",
45
+ "User-Agent": "agora-agents/v2.1.0",
46
46
  "X-Fern-Runtime": core.RUNTIME.type,
47
47
  "X-Fern-Runtime-Version": core.RUNTIME.version,
48
48
  }, options === null || options === void 0 ? void 0 : options.headers);
@@ -18,7 +18,17 @@ import type { BaseAvatar, BaseLLM, BaseMLLM, BaseSTT, BaseTTS } from "./vendors/
18
18
  export interface AgentOptions {
19
19
  /** Optional name for the agent (used as default session name) */
20
20
  name?: string;
21
- /** System instructions for the agent */
21
+ /**
22
+ * Published AI Studio pipeline ID to use as this agent's base configuration.
23
+ * Explicit Agent config such as .withLlm(), .withTts(), .withStt(),
24
+ * advancedFeatures, and other builder options may send fields in
25
+ * `properties` that override the saved pipeline settings.
26
+ */
27
+ pipelineId?: string;
28
+ /**
29
+ * System instructions for the agent.
30
+ * @deprecated Configure this on the LLM vendor with `systemMessages` instead.
31
+ */
22
32
  instructions?: string;
23
33
  /** Turn detection configuration */
24
34
  turnDetection?: TurnDetectionConfig;
@@ -32,11 +42,20 @@ export interface AgentOptions {
32
42
  advancedFeatures?: AdvancedFeatures;
33
43
  /** Session parameters */
34
44
  parameters?: SessionParamsInput;
35
- /** Greeting message */
45
+ /**
46
+ * Greeting message.
47
+ * @deprecated Configure this on the LLM or MLLM vendor with `greetingMessage` instead.
48
+ */
36
49
  greeting?: string;
37
- /** Failure message */
50
+ /**
51
+ * Failure message.
52
+ * @deprecated Configure this on the LLM or MLLM vendor with `failureMessage` instead.
53
+ */
38
54
  failureMessage?: string;
39
- /** Max conversation history for the standard LLM pipeline. Does not apply to MLLM. */
55
+ /**
56
+ * Max conversation history for the standard LLM pipeline. Does not apply to MLLM.
57
+ * @deprecated Configure this on the LLM vendor with `maxHistory` instead.
58
+ */
40
59
  maxHistory?: number;
41
60
  /** Regional access restriction configuration */
42
61
  geofence?: GeofenceConfig;
@@ -46,7 +65,10 @@ export interface AgentOptions {
46
65
  rtc?: RtcConfig;
47
66
  /** Filler word configuration (plays filler words while waiting for LLM responses) */
48
67
  fillerWords?: FillerWordsConfig;
49
- /** Greeting playback configuration for multi-user channels */
68
+ /**
69
+ * Greeting playback configuration for multi-user channels.
70
+ * @deprecated Configure this on the LLM vendor with `greetingConfigs` instead.
71
+ */
50
72
  greetingConfigs?: LlmGreetingConfigs;
51
73
  }
52
74
  /**
@@ -60,13 +82,14 @@ export interface AgentOptions {
60
82
  *
61
83
  * // Use the fluent builder pattern to configure vendors
62
84
  * const agent = new Agent({ instructions: 'You are helpful.' })
63
- * .withLlm(new OpenAI({ apiKey: '...', model: 'gpt-4' }))
64
- * .withTts(new ElevenLabsTTS({ key: '...', modelId: '...', voiceId: '...', sampleRate: 24000 }))
85
+ * .withLlm(new OpenAI({ apiKey: '...', model: 'gpt-4', url: 'https://api.openai.com/v1/chat/completions' }))
86
+ * .withTts(new ElevenLabsTTS({ key: '...', modelId: '...', voiceId: '...', baseUrl: 'wss://api.elevenlabs.io/v1', sampleRate: 24000 }))
65
87
  * .withStt(new DeepgramSTT({ apiKey: '...', model: 'nova-2' }));
66
88
  * ```
67
89
  */
68
90
  export declare class Agent<TTSSampleRate extends number = number> {
69
91
  private _name?;
92
+ private _pipelineId?;
70
93
  private _llm?;
71
94
  private _tts?;
72
95
  private _stt?;
@@ -90,7 +113,7 @@ export declare class Agent<TTSSampleRate extends number = number> {
90
113
  /**
91
114
  * Returns a new Agent with the specified LLM vendor.
92
115
  *
93
- * @param vendor - LLM vendor instance (e.g., new OpenAI({ apiKey: '...', model: 'gpt-4' }))
116
+ * @param vendor - LLM vendor instance (e.g., new OpenAI({ apiKey: '...', model: 'gpt-4', url: 'https://api.openai.com/v1/chat/completions' }))
94
117
  */
95
118
  withLlm(vendor: BaseLLM): Agent<TTSSampleRate>;
96
119
  /**
@@ -99,7 +122,7 @@ export declare class Agent<TTSSampleRate extends number = number> {
99
122
  * The sample rate type is tracked for compile-time avatar compatibility checking.
100
123
  *
101
124
  * @template SR - Sample rate literal type
102
- * @param vendor - TTS vendor instance (e.g., new ElevenLabsTTS({ key: '...', modelId: '...', voiceId: '...', sampleRate: 24000 }))
125
+ * @param vendor - TTS vendor instance (e.g., new ElevenLabsTTS({ key: '...', modelId: '...', voiceId: '...', baseUrl: 'wss://api.elevenlabs.io/v1', sampleRate: 24000 }))
103
126
  * @returns Agent with tracked sample rate type
104
127
  */
105
128
  withTts<SR extends number>(vendor: BaseTTS<SR>): Agent<SR>;
@@ -162,6 +185,7 @@ export declare class Agent<TTSSampleRate extends number = number> {
162
185
  * key: '...',
163
186
  * modelId: '...',
164
187
  * voiceId: '...',
188
+ * baseUrl: 'wss://api.elevenlabs.io/v1',
165
189
  * sampleRate: 24000, // Required for HeyGen
166
190
  * }))
167
191
  * .withAvatar(new HeyGenAvatar({
@@ -182,10 +206,14 @@ export declare class Agent<TTSSampleRate extends number = number> {
182
206
  withInterruption(config: InterruptionConfig): Agent<TTSSampleRate>;
183
207
  /**
184
208
  * Returns a new Agent with the specified instructions.
209
+ *
210
+ * @deprecated Configure system messages on the LLM vendor instead.
185
211
  */
186
212
  withInstructions(instructions: string): Agent<TTSSampleRate>;
187
213
  /**
188
214
  * Returns a new Agent with the specified greeting message.
215
+ *
216
+ * @deprecated Configure the greeting on the LLM or MLLM vendor instead.
189
217
  */
190
218
  withGreeting(greeting: string): Agent<TTSSampleRate>;
191
219
  /**
@@ -193,6 +221,8 @@ export declare class Agent<TTSSampleRate extends number = number> {
193
221
  *
194
222
  * Serializes to `llm.greeting_configs`. Agent-level values override any
195
223
  * vendor-level `greeting_configs` configured on the LLM vendor.
224
+ *
225
+ * @deprecated Configure greeting playback on the LLM vendor instead.
196
226
  */
197
227
  withGreetingConfigs(configs: LlmGreetingConfigs): Agent<TTSSampleRate>;
198
228
  /**
@@ -227,11 +257,15 @@ export declare class Agent<TTSSampleRate extends number = number> {
227
257
  * Returns a new Agent with the specified failure message.
228
258
  *
229
259
  * The failure message is played via TTS when the LLM call fails.
260
+ *
261
+ * @deprecated Configure the failure message on the LLM or MLLM vendor instead.
230
262
  */
231
263
  withFailureMessage(message: string): Agent<TTSSampleRate>;
232
264
  /**
233
265
  * Returns a new Agent with the specified maximum conversation history length.
234
266
  * Applies to the standard LLM pipeline only; the v2.7 MLLM core schema has no max_history field.
267
+ *
268
+ * @deprecated Configure max history on the LLM vendor instead.
235
269
  */
236
270
  withMaxHistory(maxHistory: number): Agent<TTSSampleRate>;
237
271
  /**
@@ -260,6 +294,10 @@ export declare class Agent<TTSSampleRate extends number = number> {
260
294
  * Get the agent name.
261
295
  */
262
296
  get name(): string | undefined;
297
+ /**
298
+ * Get the AI Studio pipeline ID used as this agent's base configuration.
299
+ */
300
+ get pipelineId(): string | undefined;
263
301
  /**
264
302
  * Get the LLM configuration.
265
303
  */
@@ -412,4 +450,6 @@ export declare class Agent<TTSSampleRate extends number = number> {
412
450
  * If a new private field is added to Agent, it MUST also be added here.
413
451
  */
414
452
  private _clone;
453
+ private _resolveAsrConfig;
454
+ private _resolveTurnDetectionConfig;
415
455
  }
@@ -9,6 +9,49 @@ Object.defineProperty(exports, "__esModule", { value: true });
9
9
  exports.Agent = void 0;
10
10
  const AgentSession_js_1 = require("./AgentSession.js");
11
11
  const token_js_1 = require("./token.js");
12
+ const DEFAULT_TURN_DETECTION_LANGUAGE = "en-US";
13
+ const INTERACTION_LANGUAGES = new Set([
14
+ "ar-EG",
15
+ "ar-JO",
16
+ "ar-SA",
17
+ "ar-AE",
18
+ "bn-IN",
19
+ "zh-CN",
20
+ "zh-HK",
21
+ "zh-TW",
22
+ "nl-NL",
23
+ "en-IN",
24
+ "en-US",
25
+ "fil-PH",
26
+ "fr-FR",
27
+ "de-DE",
28
+ "gu-IN",
29
+ "he-IL",
30
+ "hi-IN",
31
+ "id-ID",
32
+ "it-IT",
33
+ "ja-JP",
34
+ "kn-IN",
35
+ "ko-KR",
36
+ "ms-MY",
37
+ "fa-IR",
38
+ "pt-PT",
39
+ "ru-RU",
40
+ "es-ES",
41
+ "ta-IN",
42
+ "te-IN",
43
+ "th-TH",
44
+ "tr-TR",
45
+ "vi-VN",
46
+ ]);
47
+ function isTurnDetectionLanguage(value) {
48
+ return INTERACTION_LANGUAGES.has(value);
49
+ }
50
+ function assertTurnDetectionLanguage(value) {
51
+ if (!isTurnDetectionLanguage(value)) {
52
+ throw new Error(`Invalid interaction language: ${value}`);
53
+ }
54
+ }
12
55
  /**
13
56
  * Agent class representing a reusable agent configuration.
14
57
  *
@@ -20,14 +63,15 @@ const token_js_1 = require("./token.js");
20
63
  *
21
64
  * // Use the fluent builder pattern to configure vendors
22
65
  * const agent = new Agent({ instructions: 'You are helpful.' })
23
- * .withLlm(new OpenAI({ apiKey: '...', model: 'gpt-4' }))
24
- * .withTts(new ElevenLabsTTS({ key: '...', modelId: '...', voiceId: '...', sampleRate: 24000 }))
66
+ * .withLlm(new OpenAI({ apiKey: '...', model: 'gpt-4', url: 'https://api.openai.com/v1/chat/completions' }))
67
+ * .withTts(new ElevenLabsTTS({ key: '...', modelId: '...', voiceId: '...', baseUrl: 'wss://api.elevenlabs.io/v1', sampleRate: 24000 }))
25
68
  * .withStt(new DeepgramSTT({ apiKey: '...', model: 'nova-2' }));
26
69
  * ```
27
70
  */
28
71
  class Agent {
29
72
  constructor(options = {}) {
30
73
  this._name = options.name;
74
+ this._pipelineId = options.pipelineId;
31
75
  this._instructions = options.instructions;
32
76
  this._greeting = options.greeting;
33
77
  this._failureMessage = options.failureMessage;
@@ -69,7 +113,7 @@ class Agent {
69
113
  /**
70
114
  * Returns a new Agent with the specified LLM vendor.
71
115
  *
72
- * @param vendor - LLM vendor instance (e.g., new OpenAI({ apiKey: '...', model: 'gpt-4' }))
116
+ * @param vendor - LLM vendor instance (e.g., new OpenAI({ apiKey: '...', model: 'gpt-4', url: 'https://api.openai.com/v1/chat/completions' }))
73
117
  */
74
118
  withLlm(vendor) {
75
119
  const newAgent = this._clone();
@@ -82,7 +126,7 @@ class Agent {
82
126
  * The sample rate type is tracked for compile-time avatar compatibility checking.
83
127
  *
84
128
  * @template SR - Sample rate literal type
85
- * @param vendor - TTS vendor instance (e.g., new ElevenLabsTTS({ key: '...', modelId: '...', voiceId: '...', sampleRate: 24000 }))
129
+ * @param vendor - TTS vendor instance (e.g., new ElevenLabsTTS({ key: '...', modelId: '...', voiceId: '...', baseUrl: 'wss://api.elevenlabs.io/v1', sampleRate: 24000 }))
86
130
  * @returns Agent with tracked sample rate type
87
131
  */
88
132
  withTts(vendor) {
@@ -166,6 +210,7 @@ class Agent {
166
210
  * key: '...',
167
211
  * modelId: '...',
168
212
  * voiceId: '...',
213
+ * baseUrl: 'wss://api.elevenlabs.io/v1',
169
214
  * sampleRate: 24000, // Required for HeyGen
170
215
  * }))
171
216
  * .withAvatar(new HeyGenAvatar({
@@ -200,6 +245,8 @@ class Agent {
200
245
  }
201
246
  /**
202
247
  * Returns a new Agent with the specified instructions.
248
+ *
249
+ * @deprecated Configure system messages on the LLM vendor instead.
203
250
  */
204
251
  withInstructions(instructions) {
205
252
  const newAgent = this._clone();
@@ -208,6 +255,8 @@ class Agent {
208
255
  }
209
256
  /**
210
257
  * Returns a new Agent with the specified greeting message.
258
+ *
259
+ * @deprecated Configure the greeting on the LLM or MLLM vendor instead.
211
260
  */
212
261
  withGreeting(greeting) {
213
262
  const newAgent = this._clone();
@@ -219,6 +268,8 @@ class Agent {
219
268
  *
220
269
  * Serializes to `llm.greeting_configs`. Agent-level values override any
221
270
  * vendor-level `greeting_configs` configured on the LLM vendor.
271
+ *
272
+ * @deprecated Configure greeting playback on the LLM vendor instead.
222
273
  */
223
274
  withGreetingConfigs(configs) {
224
275
  const newAgent = this._clone();
@@ -281,6 +332,8 @@ class Agent {
281
332
  * Returns a new Agent with the specified failure message.
282
333
  *
283
334
  * The failure message is played via TTS when the LLM call fails.
335
+ *
336
+ * @deprecated Configure the failure message on the LLM or MLLM vendor instead.
284
337
  */
285
338
  withFailureMessage(message) {
286
339
  const newAgent = this._clone();
@@ -290,6 +343,8 @@ class Agent {
290
343
  /**
291
344
  * Returns a new Agent with the specified maximum conversation history length.
292
345
  * Applies to the standard LLM pipeline only; the v2.7 MLLM core schema has no max_history field.
346
+ *
347
+ * @deprecated Configure max history on the LLM vendor instead.
293
348
  */
294
349
  withMaxHistory(maxHistory) {
295
350
  const newAgent = this._clone();
@@ -340,6 +395,12 @@ class Agent {
340
395
  get name() {
341
396
  return this._name;
342
397
  }
398
+ /**
399
+ * Get the AI Studio pipeline ID used as this agent's base configuration.
400
+ */
401
+ get pipelineId() {
402
+ return this._pipelineId;
403
+ }
343
404
  /**
344
405
  * Get the LLM configuration.
345
406
  */
@@ -462,6 +523,7 @@ class Agent {
462
523
  get config() {
463
524
  return {
464
525
  name: this._name,
526
+ pipelineId: this._pipelineId,
465
527
  instructions: this._instructions,
466
528
  turnDetection: this._turnDetection,
467
529
  interruption: this._interruption,
@@ -562,7 +624,6 @@ class Agent {
562
624
  idle_timeout: opts.idleTimeout,
563
625
  enable_string_uid: opts.enableStringUid,
564
626
  mllm: this._mllm,
565
- turn_detection: this._turnDetection,
566
627
  interruption: this._interruption,
567
628
  sal: this._sal,
568
629
  avatar: this._avatar,
@@ -586,7 +647,7 @@ class Agent {
586
647
  c.failure_message = this._failureMessage;
587
648
  }
588
649
  }
589
- return Object.assign(Object.assign({}, base), { mllm: mllmConfig });
650
+ return Object.assign(Object.assign({}, base), { mllm: mllmConfig, turn_detection: this._turnDetection });
590
651
  }
591
652
  if (!opts.skipVendorValidation) {
592
653
  if (!this._tts) {
@@ -600,7 +661,9 @@ class Agent {
600
661
  ? Object.assign(Object.assign({}, this._llm), { system_messages: this._instructions
601
662
  ? [{ role: "system", content: this._instructions }]
602
663
  : this._llm.system_messages, greeting_message: (_d = this._greeting) !== null && _d !== void 0 ? _d : this._llm.greeting_message, greeting_configs: (_e = this._greetingConfigs) !== null && _e !== void 0 ? _e : this._llm.greeting_configs, failure_message: (_f = this._failureMessage) !== null && _f !== void 0 ? _f : this._llm.failure_message, max_history: (_g = this._maxHistory) !== null && _g !== void 0 ? _g : this._llm.max_history }) : undefined;
603
- return Object.assign(Object.assign({}, base), { llm: llmConfig, tts: this._tts, asr: this._stt });
664
+ const asrConfig = this._resolveAsrConfig();
665
+ const turnDetectionConfig = this._resolveTurnDetectionConfig();
666
+ return Object.assign(Object.assign({}, base), { turn_detection: turnDetectionConfig, llm: llmConfig, tts: this._tts, asr: asrConfig });
604
667
  }
605
668
  /**
606
669
  * Creates a shallow copy of this Agent, preserving the TTSSampleRate type
@@ -614,6 +677,7 @@ class Agent {
614
677
  _clone() {
615
678
  const newAgent = new Agent();
616
679
  newAgent._name = this._name;
680
+ newAgent._pipelineId = this._pipelineId;
617
681
  newAgent._llm = this._llm;
618
682
  newAgent._tts = this._tts;
619
683
  newAgent._stt = this._stt;
@@ -635,6 +699,27 @@ class Agent {
635
699
  newAgent._greetingConfigs = this._greetingConfigs;
636
700
  return newAgent;
637
701
  }
702
+ _resolveAsrConfig() {
703
+ var _a;
704
+ const asrConfig = Object.assign({}, ((_a = this._stt) !== null && _a !== void 0 ? _a : {}));
705
+ if (this._stt === undefined) {
706
+ asrConfig.vendor = "ares";
707
+ }
708
+ delete asrConfig.language;
709
+ return Object.keys(asrConfig).length > 0 ? asrConfig : undefined;
710
+ }
711
+ _resolveTurnDetectionConfig() {
712
+ var _a, _b;
713
+ const turnDetection = Object.assign({}, ((_a = this._turnDetection) !== null && _a !== void 0 ? _a : {}));
714
+ const existingTurnDetectionLanguage = turnDetection.language;
715
+ const existingAsrLanguage = (_b = this._stt) === null || _b === void 0 ? void 0 : _b.language;
716
+ const language = existingTurnDetectionLanguage !== null && existingTurnDetectionLanguage !== void 0 ? existingTurnDetectionLanguage : (existingAsrLanguage !== undefined && isTurnDetectionLanguage(existingAsrLanguage)
717
+ ? existingAsrLanguage
718
+ : DEFAULT_TURN_DETECTION_LANGUAGE);
719
+ assertTurnDetectionLanguage(language);
720
+ turnDetection.language = language;
721
+ return turnDetection;
722
+ }
638
723
  }
639
724
  exports.Agent = Agent;
640
725
  function _parseNumericUid(uid, label) {
@@ -46,7 +46,7 @@ export interface AgentSessionOptions {
46
46
  enableStringUid?: boolean;
47
47
  /** Preset IDs to use as the base ASR/LLM/TTS configuration for this session */
48
48
  preset?: PresetInput;
49
- /** Published AI Studio pipeline ID to use as the base configuration for this session */
49
+ /** Published AI Studio pipeline ID to use as this session's base configuration. Overrides agent.pipelineId. */
50
50
  pipelineId?: string;
51
51
  /**
52
52
  * Token lifetime in seconds (default: 86400 = 24 hours, Agora maximum).
@@ -78,8 +78,8 @@ export interface AgentSessionOptions {
78
78
  * });
79
79
  *
80
80
  * const agent = new Agent({ name: 'support-assistant', instructions: 'You are a helpful voice assistant.' })
81
- * .withLlm(new OpenAI({ apiKey: '...', model: 'gpt-4o-mini' }))
82
- * .withTts(new ElevenLabsTTS({ key: '...', modelId: '...', voiceId: '...', sampleRate: 24000 }))
81
+ * .withLlm(new OpenAI({ apiKey: '...', model: 'gpt-4o-mini', url: 'https://api.openai.com/v1/chat/completions' }))
82
+ * .withTts(new ElevenLabsTTS({ key: '...', modelId: '...', voiceId: '...', baseUrl: 'wss://api.elevenlabs.io/v1', sampleRate: 24000 }))
83
83
  * .withStt(new DeepgramSTT({ apiKey: '...', language: 'en-US' }));
84
84
  *
85
85
  * const session = agent.createSession(client, {
@@ -36,8 +36,8 @@ const token_js_1 = require("./token.js");
36
36
  * });
37
37
  *
38
38
  * const agent = new Agent({ name: 'support-assistant', instructions: 'You are a helpful voice assistant.' })
39
- * .withLlm(new OpenAI({ apiKey: '...', model: 'gpt-4o-mini' }))
40
- * .withTts(new ElevenLabsTTS({ key: '...', modelId: '...', voiceId: '...', sampleRate: 24000 }))
39
+ * .withLlm(new OpenAI({ apiKey: '...', model: 'gpt-4o-mini', url: 'https://api.openai.com/v1/chat/completions' }))
40
+ * .withTts(new ElevenLabsTTS({ key: '...', modelId: '...', voiceId: '...', baseUrl: 'wss://api.elevenlabs.io/v1', sampleRate: 24000 }))
41
41
  * .withStt(new DeepgramSTT({ apiKey: '...', language: 'en-US' }));
42
42
  *
43
43
  * const session = agent.createSession(client, {
@@ -305,7 +305,7 @@ class AgentSession {
305
305
  */
306
306
  start() {
307
307
  return __awaiter(this, void 0, void 0, function* () {
308
- var _a, _b;
308
+ var _a, _b, _c;
309
309
  if (this._status !== "idle" && this._status !== "stopped" && this._status !== "error") {
310
310
  throw new Error(`Cannot start session in ${this._status} state`);
311
311
  }
@@ -318,6 +318,7 @@ class AgentSession {
318
318
  }
319
319
  this._status = "starting";
320
320
  try {
321
+ const pipelineId = (_a = this._pipelineId) !== null && _a !== void 0 ? _a : this._agent.pipelineId;
321
322
  // appCertificate presence is guaranteed by the guard above when no token is provided.
322
323
  let expiresIn = this._expiresIn;
323
324
  if (expiresIn !== undefined) {
@@ -333,7 +334,7 @@ class AgentSession {
333
334
  const properties = this._agent.toProperties(Object.assign({ channel: this._channel, agentUid: this._agentUid, remoteUids: this._remoteUids, idleTimeout: this._idleTimeout, enableStringUid: this._enableStringUid,
334
335
  // When a preset or pipeline_id is supplied, ASR/LLM/TTS vendor
335
336
  // config is optional — the backend fills it from the preset/pipeline.
336
- skipVendorValidation: !!(this._preset || this._pipelineId) }, tokenOpts));
337
+ skipVendorValidation: !!(this._preset || pipelineId) }, tokenOpts));
337
338
  const resolved = (0, presets_js_1.resolveSessionPresets)({
338
339
  preset: this._preset,
339
340
  properties,
@@ -344,7 +345,7 @@ class AgentSession {
344
345
  appid: this._appId,
345
346
  name: this._name,
346
347
  preset: resolved.preset,
347
- pipeline_id: this._pipelineId,
348
+ pipeline_id: pipelineId,
348
349
  properties: enrichedProperties,
349
350
  };
350
351
  if (this._debug) {
@@ -355,10 +356,10 @@ class AgentSession {
355
356
  console.log("[Agora Debug] Request:", JSON.stringify(request, null, 2));
356
357
  }
357
358
  const response = yield this._client.agents.start(request, { headers: this._convoAIHeaders() });
358
- this._agentId = (_a = response.agent_id) !== null && _a !== void 0 ? _a : null;
359
+ this._agentId = (_b = response.agent_id) !== null && _b !== void 0 ? _b : null;
359
360
  this._status = "running";
360
361
  this._emit("started", { agentId: this._agentId });
361
- return (_b = this._agentId) !== null && _b !== void 0 ? _b : "";
362
+ return (_c = this._agentId) !== null && _c !== void 0 ? _c : "";
362
363
  }
363
364
  catch (error) {
364
365
  this._status = "error";
@@ -28,6 +28,7 @@ function _validExample1() {
28
28
  key: "test",
29
29
  modelId: "eleven_flash_v2_5",
30
30
  voiceId: "test",
31
+ baseUrl: "wss://api.elevenlabs.io/v1",
31
32
  sampleRate: 24000,
32
33
  }))
33
34
  .withAvatar(new avatar_js_1.LiveAvatarAvatar({
@@ -43,6 +44,7 @@ function _validExample2() {
43
44
  key: "test",
44
45
  modelId: "eleven_flash_v2_5",
45
46
  voiceId: "test",
47
+ baseUrl: "wss://api.elevenlabs.io/v1",
46
48
  sampleRate: 16000,
47
49
  }))
48
50
  .withAvatar(new avatar_js_1.AkoolAvatar({
@@ -70,6 +72,8 @@ function _validExample4() {
70
72
  .withTts(new tts_js_1.OpenAITTS({
71
73
  apiKey: "test",
72
74
  voice: "alloy",
75
+ model: "gpt-4o-mini-tts",
76
+ baseUrl: "https://api.openai.com/v1",
73
77
  }))
74
78
  .withAvatar(new avatar_js_1.LiveAvatarAvatar({
75
79
  apiKey: "test",
@@ -83,6 +87,7 @@ function _validExample5() {
83
87
  .withTts(new tts_js_1.CartesiaTTS({
84
88
  apiKey: "test",
85
89
  voiceId: "test",
90
+ modelId: "sonic-2",
86
91
  sampleRate: 16000,
87
92
  }))
88
93
  .withAvatar(new avatar_js_1.AkoolAvatar({
@@ -93,7 +98,12 @@ function _validExample5() {
93
98
  new stt_js_1.DeepgramSTT({ model: "nova-3" });
94
99
  new llm_js_1.OpenAI({ model: "gpt-5-mini" });
95
100
  new tts_js_1.OpenAITTS({ voice: "alloy" });
96
- new llm_js_1.OpenAI({ apiKey: "test", model: "gpt-5-mini", vendor: "custom" });
101
+ new llm_js_1.OpenAI({
102
+ apiKey: "test",
103
+ model: "gpt-5-mini",
104
+ url: "https://api.openai.com/v1/chat/completions",
105
+ vendor: "custom",
106
+ });
97
107
  new tts_js_1.MiniMaxTTS({
98
108
  model: "speech-2.6-turbo",
99
109
  });
@@ -127,6 +137,7 @@ function invalidMismatch1(): Agent<24000> {
127
137
  key: "test",
128
138
  modelId: "eleven_flash_v2_5",
129
139
  voiceId: "test",
140
+ baseUrl: "wss://api.elevenlabs.io/v1",
130
141
  sampleRate: 16000, // ❌ Wrong rate for HeyGen
131
142
  })
132
143
  )
@@ -148,6 +159,7 @@ function invalidMismatch2(): Agent<16000> {
148
159
  key: "test",
149
160
  modelId: "eleven_flash_v2_5",
150
161
  voiceId: "test",
162
+ baseUrl: "wss://api.elevenlabs.io/v1",
151
163
  sampleRate: 24000, // ❌ Wrong rate for Akool
152
164
  })
153
165
  )
@@ -191,7 +203,8 @@ function invalidEnum1() {
191
203
  key: "test",
192
204
  modelId: "eleven_flash_v2_5",
193
205
  voiceId: "test",
194
- sampleRate: 25000, // ❌ Not in enum: 16000, 22050, 24000, 44100
206
+ baseUrl: "wss://api.elevenlabs.io/v1",
207
+ sampleRate: 25000, // ❌ Not in enum: 16000, 22050, 24000, 44100
195
208
  })
196
209
  );
197
210
  }
@@ -216,7 +229,8 @@ function invalidEnum3() {
216
229
  new CartesiaTTS({
217
230
  key: "test",
218
231
  voiceId: "test",
219
- sampleRate: 32000, // ❌ Not in enum: 8000-48000 (specific values)
232
+ baseUrl: "wss://api.elevenlabs.io/v1",
233
+ sampleRate: 32000, // ❌ Not in enum: 8000-48000 (specific values)
220
234
  })
221
235
  );
222
236
  }
@@ -238,6 +252,7 @@ function _edgeCase2() {
238
252
  key: "test",
239
253
  modelId: "eleven_flash_v2_5",
240
254
  voiceId: "test",
255
+ baseUrl: "wss://api.elevenlabs.io/v1",
241
256
  sampleRate: 16000,
242
257
  }));
243
258
  }
@@ -248,6 +263,7 @@ function _edgeCase3() {
248
263
  key: "test",
249
264
  modelId: "eleven_flash_v2_5",
250
265
  voiceId: "test",
266
+ baseUrl: "wss://api.elevenlabs.io/v1",
251
267
  sampleRate: 24000,
252
268
  }))
253
269
  .withInstructions("Updated instructions")
@@ -266,6 +282,7 @@ function _typeInference1() {
266
282
  key: "test",
267
283
  modelId: "eleven_flash_v2_5",
268
284
  voiceId: "test",
285
+ baseUrl: "wss://api.elevenlabs.io/v1",
269
286
  sampleRate: 24000,
270
287
  }));
271
288
  // Verify: Type should be Agent<24000>
@@ -277,6 +294,7 @@ function _typeInference2() {
277
294
  key: "test",
278
295
  modelId: "eleven_flash_v2_5",
279
296
  voiceId: "test",
297
+ baseUrl: "wss://api.elevenlabs.io/v1",
280
298
  sampleRate: 16000,
281
299
  }));
282
300
  // Verify: Type should be Agent<16000>
@@ -287,6 +305,8 @@ function _typeInference3() {
287
305
  const openAIAgent = new Agent_js_1.Agent({ instructions: "Test" }).withTts(new tts_js_1.OpenAITTS({
288
306
  apiKey: "test",
289
307
  voice: "alloy",
308
+ model: "gpt-4o-mini-tts",
309
+ baseUrl: "https://api.openai.com/v1",
290
310
  }));
291
311
  // Verify: OpenAI is fixed at 24kHz, so type should be Agent<24000>
292
312
  const _typeCheck = openAIAgent;