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
@@ -5,6 +5,7 @@
5
5
  import { AgentThinkAgentManagementRequest as AgentThinkRequestNS } from "../api/resources/agentManagement/client/requests/AgentThinkAgentManagementRequest.js";
6
6
  import { SpeakAgentsRequest as SpeakAgentsRequestNS } from "../api/resources/agents/client/requests/SpeakAgentsRequest.js";
7
7
  import { StartAgentsRequest as StartAgentsRequestNS } from "../api/resources/agents/client/requests/StartAgentsRequest.js";
8
+ import { MllmTurnDetection as MllmTurnDetectionNS } from "../api/types/MllmTurnDetection.js";
8
9
  /** Data channel: `"rtm"` | `"datastream"` */
9
10
  export declare const DataChannel: typeof StartAgentsRequestNS.Properties.Parameters.DataChannel;
10
11
  /** RTC audio scenario: `"default"` | `"chorus"` | `"aiserver"` */
@@ -45,13 +46,13 @@ export declare const SpeakPriorityAppend: SpeakAgentsRequestNS.Priority;
45
46
  /** Drop the message if the agent is busy. */
46
47
  export declare const SpeakPriorityIgnore: SpeakAgentsRequestNS.Priority;
47
48
  /** MLLM turn-detection mode: `"agora_vad"` | `"server_vad"` | `"semantic_vad"` */
48
- export declare const MllmTurnDetectionModeValues: typeof StartAgentsRequestNS.Properties.Mllm.TurnDetection.Mode;
49
+ export declare const MllmTurnDetectionModeValues: typeof MllmTurnDetectionNS.Mode;
49
50
  /** MLLM turn-detection mode: Agora VAD. */
50
- export declare const MllmTurnDetectionModeAgoraVad: StartAgentsRequestNS.Properties.Mllm.TurnDetection.Mode;
51
+ export declare const MllmTurnDetectionModeAgoraVad: MllmTurnDetectionNS.Mode;
51
52
  /** MLLM turn-detection mode: server/vendor VAD. */
52
- export declare const MllmTurnDetectionModeServerVad: StartAgentsRequestNS.Properties.Mllm.TurnDetection.Mode;
53
+ export declare const MllmTurnDetectionModeServerVad: MllmTurnDetectionNS.Mode;
53
54
  /** MLLM turn-detection mode: semantic VAD. */
54
- export declare const MllmTurnDetectionModeSemanticVad: StartAgentsRequestNS.Properties.Mllm.TurnDetection.Mode;
55
+ export declare const MllmTurnDetectionModeSemanticVad: MllmTurnDetectionNS.Mode;
55
56
  /** Think action when the agent is listening: inject custom text without interrupting. */
56
57
  export declare const ThinkOnListeningActionInject: AgentThinkRequestNS.OnListeningAction;
57
58
  /** Think action when the agent is listening: interrupt and start a new turn. */
@@ -9,6 +9,7 @@ exports.ThinkOnSpeakingActionIgnore = exports.ThinkOnSpeakingActionInterrupt = e
9
9
  const AgentThinkAgentManagementRequest_js_1 = require("../api/resources/agentManagement/client/requests/AgentThinkAgentManagementRequest.js");
10
10
  const SpeakAgentsRequest_js_1 = require("../api/resources/agents/client/requests/SpeakAgentsRequest.js");
11
11
  const StartAgentsRequest_js_1 = require("../api/resources/agents/client/requests/StartAgentsRequest.js");
12
+ const MllmTurnDetection_js_1 = require("../api/types/MllmTurnDetection.js");
12
13
  /** Data channel: `"rtm"` | `"datastream"` */
13
14
  exports.DataChannel = StartAgentsRequest_js_1.StartAgentsRequest.Properties.Parameters.DataChannel;
14
15
  /** RTC audio scenario: `"default"` | `"chorus"` | `"aiserver"` */
@@ -49,13 +50,13 @@ exports.SpeakPriorityAppend = SpeakAgentsRequest_js_1.SpeakAgentsRequest.Priorit
49
50
  /** Drop the message if the agent is busy. */
50
51
  exports.SpeakPriorityIgnore = SpeakAgentsRequest_js_1.SpeakAgentsRequest.Priority.Ignore;
51
52
  /** MLLM turn-detection mode: `"agora_vad"` | `"server_vad"` | `"semantic_vad"` */
52
- exports.MllmTurnDetectionModeValues = StartAgentsRequest_js_1.StartAgentsRequest.Properties.Mllm.TurnDetection.Mode;
53
+ exports.MllmTurnDetectionModeValues = MllmTurnDetection_js_1.MllmTurnDetection.Mode;
53
54
  /** MLLM turn-detection mode: Agora VAD. */
54
- exports.MllmTurnDetectionModeAgoraVad = StartAgentsRequest_js_1.StartAgentsRequest.Properties.Mllm.TurnDetection.Mode.AgoraVad;
55
+ exports.MllmTurnDetectionModeAgoraVad = MllmTurnDetection_js_1.MllmTurnDetection.Mode.AgoraVad;
55
56
  /** MLLM turn-detection mode: server/vendor VAD. */
56
- exports.MllmTurnDetectionModeServerVad = StartAgentsRequest_js_1.StartAgentsRequest.Properties.Mllm.TurnDetection.Mode.ServerVad;
57
+ exports.MllmTurnDetectionModeServerVad = MllmTurnDetection_js_1.MllmTurnDetection.Mode.ServerVad;
57
58
  /** MLLM turn-detection mode: semantic VAD. */
58
- exports.MllmTurnDetectionModeSemanticVad = StartAgentsRequest_js_1.StartAgentsRequest.Properties.Mllm.TurnDetection.Mode.SemanticVad;
59
+ exports.MllmTurnDetectionModeSemanticVad = MllmTurnDetection_js_1.MllmTurnDetection.Mode.SemanticVad;
59
60
  /** Think action when the agent is listening: inject custom text without interrupting. */
60
61
  exports.ThinkOnListeningActionInject = AgentThinkAgentManagementRequest_js_1.AgentThinkAgentManagementRequest.OnListeningAction.Inject;
61
62
  /** Think action when the agent is listening: interrupt and start a new turn. */
@@ -30,7 +30,7 @@ export type { AgentPreset, AsrPreset, DeepgramPresetModel, LlmPreset, MiniMaxPre
30
30
  export { AgentPresets, normalizePresetInput } from "./presets.js";
31
31
  export type { GenerateConvoAITokenOptions, GenerateTokenOptions, } from "./token.js";
32
32
  export { ExpiresIn, generateConvoAIToken, generateRtcToken, MAX_EXPIRY_SECONDS, } from "./token.js";
33
- export type { AdvancedFeatures, AgentConfig, AgentConfigUpdate, AmazonTts, AmazonTtsParams, AsrConfig, AvatarConfig, AvatarVendor, CartesiaTts, CartesiaTtsParams, ConversationHistory, ConversationRole, ConversationSessionTurn, ConversationTurn, ConversationTurns, Eagerness, ElevenLabsTts, ElevenLabsTtsParams, EndOfSpeechConfig, EndOfSpeechMode, EndOfSpeechSemanticConfig, EndOfSpeechVadConfig, FarewellConfig, FillerWordsConfig, FillerWordsContent, FillerWordsContentSelectionRule, FillerWordsContentStaticConfig, FillerWordsTrigger, FillerWordsTriggerFixedTimeConfig, FishAudioTts, FishAudioTtsParams, GeofenceArea, GeofenceConfig, GeofenceExcludeArea, GetTurnsOptions, GoogleTts, GoogleTtsParams, HumeAiTts, HumeAiTtsParams, InterruptionConfig, InterruptionMode, InterruptMode, Labels, LlmConfig, LlmGreetingConfigs, LlmGreetingConfigsMode, LlmStyle, McpServersItem, MicrosoftTts, MicrosoftTtsParams, MinimaxTts, MinimaxTtsParams, MllmConfig, MllmTurnDetectionConfig, MllmTurnDetectionMode, MllmVendor, MurfTts, MurfTtsParams, OpenAiTts, OpenAiTtsParams, ParametersAudioScenario, ParametersDataChannel, RimeTts, RimeTtsParams, RtcConfig, SalConfig, SalMode, SarvamTts, SarvamTtsParams, SayOptions, SessionInfo, SessionListResponse, SessionOptions, SessionParams, SessionParamsInput, SessionStatus, SessionSummary, SilenceAction, SilenceConfig, SpeakPriority, StartOfSpeechConfig, StartOfSpeechDisabledConfig, StartOfSpeechDisabledConfigStrategy, StartOfSpeechKeywordsConfig, StartOfSpeechMode, StartOfSpeechVadConfig, SttConfig, SttVendor, ThinkOnListeningAction, ThinkOnSpeakingAction, ThinkOnThinkingAction, ThinkOptions, ThinkResponse, TtsConfig, TurnDetectionConfig, TurnDetectionNestedConfig, TurnDetectionType, } from "./types.js";
33
+ export type { AdvancedFeatures, AgentConfig, AgentConfigUpdate, AmazonTts, AmazonTtsParams, AsrConfig, AvatarConfig, AvatarVendor, CartesiaTts, CartesiaTtsParams, ConversationHistory, ConversationRole, ConversationSessionTurn, ConversationTurn, ConversationTurns, Eagerness, ElevenLabsTts, ElevenLabsTtsParams, EndOfSpeechConfig, EndOfSpeechMode, EndOfSpeechSemanticConfig, EndOfSpeechVadConfig, FarewellConfig, FillerWordsConfig, FillerWordsContent, FillerWordsContentSelectionRule, FillerWordsContentStaticConfig, FillerWordsTrigger, FillerWordsTriggerFixedTimeConfig, FishAudioTts, FishAudioTtsParams, GeofenceArea, GeofenceConfig, GeofenceExcludeArea, GetTurnsOptions, GoogleTts, GoogleTtsParams, HumeAiTts, HumeAiTtsParams, InterruptionConfig, InterruptionMode, InterruptMode, Labels, LlmConfig, LlmGreetingConfigs, LlmGreetingConfigsMode, LlmStyle, McpServersItem, MicrosoftTts, MicrosoftTtsParams, MinimaxTts, MinimaxTtsParams, MllmConfig, MllmTurnDetectionConfig, MllmTurnDetectionMode, MllmVendor, MurfTts, MurfTtsParams, OpenAiTts, OpenAiTtsParams, ParametersAudioScenario, ParametersDataChannel, RimeTts, RimeTtsParams, RtcConfig, SalConfig, SalMode, SarvamTts, SarvamTtsParams, SayOptions, SessionInfo, SessionListResponse, SessionOptions, SessionParams, SessionParamsInput, SessionStatus, SessionSummary, SilenceAction, SilenceConfig, SpeakPriority, StartOfSpeechConfig, StartOfSpeechDisabledConfig, StartOfSpeechDisabledConfigStrategy, StartOfSpeechKeywordsConfig, StartOfSpeechMode, StartOfSpeechVadConfig, SttConfig, SttVendor, ThinkOnListeningAction, ThinkOnSpeakingAction, ThinkOnThinkingAction, ThinkOptions, ThinkResponse, TtsConfig, TurnDetectionConfig, TurnDetectionLanguage, TurnDetectionNestedConfig, TurnDetectionType, } from "./types.js";
34
34
  export type { AkoolAvatarOptions, AnamAvatarOptions, GenericAvatarOptions, HeyGenAvatarOptions, LiveAvatarAvatarOptions, } from "./vendors/avatar.js";
35
35
  export { AkoolAvatar, AnamAvatar, GenericAvatar, HeyGenAvatar, LiveAvatarAvatar, } from "./vendors/avatar.js";
36
36
  export type { AkoolSampleRate, CartesiaSampleRate, ElevenLabsSampleRate, HeyGenSampleRate, LiveAvatarSampleRate, MicrosoftSampleRate, SampleRate, } from "./vendors/base.js";
@@ -2,11 +2,11 @@
2
2
  * Clean type aliases for the Agora Conversational AI SDK.
3
3
  * These provide shorter, more intuitive names for the verbose Fern-generated types.
4
4
  */
5
- import type { AgentThinkAgentManagementResponse, AmazonTtsParams as AmazonTtsParamsType, AmazonTts as AmazonTtsType, CartesiaTtsParams as CartesiaTtsParamsType, CartesiaTts as CartesiaTtsType, ElevenLabsTtsParams as ElevenLabsTtsParamsType, ElevenLabsTts as ElevenLabsTtsType, FishAudioTtsParams as FishAudioTtsParamsType, FishAudioTts as FishAudioTtsType, GetAgentsResponse, GetHistoryAgentsResponse, GetTurnsAgentsResponse, GoogleTtsParams as GoogleTtsParamsType, GoogleTts as GoogleTtsType, HumeAiTtsParams as HumeAiTtsParamsType, HumeAiTts as HumeAiTtsType, ListAgentsResponse, MicrosoftTtsParams as MicrosoftTtsParamsType, MicrosoftTts as MicrosoftTtsType, MinimaxTtsParams as MinimaxTtsParamsType, MinimaxTts as MinimaxTtsType, MurfTtsParams as MurfTtsParamsType, MurfTts as MurfTtsType, OpenAiTtsParams as OpenAiTtsParamsType, OpenAiTts as OpenAiTtsType, RimeTtsParams as RimeTtsParamsType, RimeTts as RimeTtsType, SarvamTtsParams as SarvamTtsParamsType, SarvamTts as SarvamTtsType, SpeakAgentsRequest, StartAgentsRequest, Tts, UpdateAgentsRequest } from "../api/index.js";
5
+ import type { AgentThinkAgentManagementResponse, AmazonTtsParams as AmazonTtsParamsType, AmazonTts as AmazonTtsType, Asr, AsrLanguage, CartesiaTtsParams as CartesiaTtsParamsType, CartesiaTts as CartesiaTtsType, ElevenLabsTtsParams as ElevenLabsTtsParamsType, ElevenLabsTts as ElevenLabsTtsType, FishAudioTtsParams as FishAudioTtsParamsType, FishAudioTts as FishAudioTtsType, GetAgentsResponse, GetHistoryAgentsResponse, GetTurnsAgentsResponse, GoogleTtsParams as GoogleTtsParamsType, GoogleTts as GoogleTtsType, HumeAiTtsParams as HumeAiTtsParamsType, HumeAiTts as HumeAiTtsType, ListAgentsResponse, Llm, MicrosoftTtsParams as MicrosoftTtsParamsType, MicrosoftTts as MicrosoftTtsType, MinimaxTtsParams as MinimaxTtsParamsType, MinimaxTts as MinimaxTtsType, Mllm, MllmTurnDetection, MllmTurnDetection as MllmTurnDetectionNS, MurfTtsParams as MurfTtsParamsType, MurfTts as MurfTtsType, OpenAiTtsParams as OpenAiTtsParamsType, OpenAiTts as OpenAiTtsType, RimeTtsParams as RimeTtsParamsType, RimeTts as RimeTtsType, SarvamTtsParams as SarvamTtsParamsType, SarvamTts as SarvamTtsType, SpeakAgentsRequest, StartAgentsRequest, Tts, UpdateAgentsRequest } from "../api/index.js";
6
6
  import type { AgentThinkAgentManagementRequest } from "../api/resources/agentManagement/client/requests/AgentThinkAgentManagementRequest.js";
7
7
  import type { PresetInput } from "./presets.js";
8
8
  /** LLM request style (openai, gemini, anthropic, dify) */
9
- export type LlmStyle = StartAgentsRequest.Properties.Llm.Style;
9
+ export type LlmStyle = Llm.Style;
10
10
  /**
11
11
  * STT/ASR (Speech-to-Text) configuration with vendor-specific typed parameters.
12
12
  * This discriminated union provides type safety and auto-complete for vendor params.
@@ -14,55 +14,57 @@ export type LlmStyle = StartAgentsRequest.Properties.Llm.Style;
14
14
  */
15
15
  export type SttConfig = {
16
16
  vendor: "speechmatics";
17
- language?: string;
17
+ language?: TurnDetectionLanguage;
18
18
  params: SpeechmaticsParams;
19
19
  } | {
20
20
  vendor: "deepgram";
21
- language?: string;
22
- params?: DeepgramParams;
21
+ language?: TurnDetectionLanguage;
22
+ params: DeepgramParams;
23
23
  } | {
24
24
  vendor: "microsoft";
25
- language?: string;
25
+ language?: TurnDetectionLanguage;
26
26
  params: MicrosoftAsrParams;
27
27
  } | {
28
28
  vendor: "openai";
29
- language?: string;
29
+ language?: TurnDetectionLanguage;
30
30
  params: OpenAiAsrParams;
31
31
  } | {
32
32
  vendor: "google";
33
- language?: string;
33
+ language?: TurnDetectionLanguage;
34
34
  params: GoogleAsrParams;
35
35
  } | {
36
36
  vendor: "amazon";
37
- language?: string;
37
+ language?: TurnDetectionLanguage;
38
38
  params: AmazonAsrParams;
39
39
  } | {
40
40
  vendor: "assemblyai";
41
- language?: string;
42
- params?: AssemblyAiParams;
41
+ language?: TurnDetectionLanguage;
42
+ params: AssemblyAiParams;
43
43
  } | {
44
44
  vendor: "ares";
45
- language?: string;
45
+ language?: TurnDetectionLanguage;
46
46
  params?: AresParams;
47
47
  } | {
48
48
  vendor: "sarvam";
49
- language?: string;
50
- params?: SarvamAsrParams;
51
- } | StartAgentsRequest.Properties.Asr;
49
+ language?: TurnDetectionLanguage;
50
+ params: SarvamAsrParams;
51
+ } | Asr;
52
52
  /** ASR configuration — alias for {@link SttConfig} (wire field: `asr`). */
53
53
  export type AsrConfig = SttConfig;
54
54
  /** STT vendor (ares, microsoft, deepgram, openai, etc.) */
55
- export type SttVendor = StartAgentsRequest.Properties.Asr.Vendor;
55
+ export type SttVendor = string;
56
56
  /** TTS (Text-to-Speech) configuration - discriminated union */
57
57
  export type TtsConfig = Tts;
58
58
  /** MLLM (Multimodal LLM) configuration */
59
- export type MllmConfig = StartAgentsRequest.Properties.Mllm;
59
+ export type MllmConfig = Mllm;
60
60
  /** MLLM vendor (openai, gemini, vertexai, xai) */
61
- export type MllmVendor = StartAgentsRequest.Properties.Mllm.Vendor;
61
+ export type MllmVendor = Mllm.Vendor;
62
62
  /** Avatar configuration */
63
63
  export type AvatarConfig = StartAgentsRequest.Properties.Avatar;
64
64
  /** Avatar vendor (akool, liveavatar, anam, generic, deprecated heygen) */
65
65
  export type AvatarVendor = StartAgentsRequest.Properties.Avatar.Vendor;
66
+ /** BCP-47 language tag used by `turn_detection.language`. */
67
+ export type TurnDetectionLanguage = AsrLanguage;
66
68
  /** Turn detection configuration */
67
69
  export type TurnDetectionConfig = StartAgentsRequest.Properties.TurnDetection;
68
70
  /** Detailed nested config for turn detection (`turn_detection.config`) */
@@ -132,9 +134,9 @@ export type InterruptionConfig = StartAgentsRequest.Properties.Interruption;
132
134
  /** Interruption trigger mode: `"start_of_speech"` | `"keywords"` */
133
135
  export type InterruptionMode = StartAgentsRequest.Properties.Interruption.Mode;
134
136
  /** MLLM turn-detection configuration (`mllm.turn_detection`) */
135
- export type MllmTurnDetectionConfig = StartAgentsRequest.Properties.Mllm.TurnDetection;
137
+ export type MllmTurnDetectionConfig = MllmTurnDetection;
136
138
  /** MLLM turn-detection mode (`agora_vad` | `server_vad` | `semantic_vad`) */
137
- export type MllmTurnDetectionMode = StartAgentsRequest.Properties.Mllm.TurnDetection.Mode;
139
+ export type MllmTurnDetectionMode = MllmTurnDetectionNS.Mode;
138
140
  /** Options for `AgentSession.think()` */
139
141
  export type ThinkOnListeningAction = AgentThinkAgentManagementRequest.OnListeningAction;
140
142
  export type ThinkOnThinkingAction = AgentThinkAgentManagementRequest.OnThinkingAction;
@@ -178,11 +180,11 @@ export type FillerWordsContentSelectionRule = StartAgentsRequest.Properties.Fill
178
180
  /** Custom business labels attached to the agent (returned in notification callbacks) */
179
181
  export type Labels = Record<string, string>;
180
182
  /** LLM greeting broadcast configuration (`llm.greeting_configs`) */
181
- export type LlmGreetingConfigs = StartAgentsRequest.Properties.Llm.GreetingConfigs;
183
+ export type LlmGreetingConfigs = Record<string, unknown>;
182
184
  /** Greeting broadcast mode: `"single_every"` | `"single_first"` */
183
- export type LlmGreetingConfigsMode = StartAgentsRequest.Properties.Llm.GreetingConfigs.Mode;
185
+ export type LlmGreetingConfigsMode = string;
184
186
  /** MCP server config item (`llm.mcp_servers[]`) */
185
- export type McpServersItem = StartAgentsRequest.Properties.Llm.McpServers.Item;
187
+ export type McpServersItem = Record<string, unknown>;
186
188
  /** Full agent configuration (alias for StartAgentsRequest.Properties) */
187
189
  export type AgentConfig = StartAgentsRequest.Properties;
188
190
  /** Agent configuration update (for runtime updates) */
@@ -205,7 +207,7 @@ export interface SessionOptions {
205
207
  enableStringUid?: boolean;
206
208
  /** Preset IDs to use as the base ASR/LLM/TTS configuration for this session */
207
209
  preset?: PresetInput;
208
- /** Published AI Studio pipeline ID to use as the base configuration for this session */
210
+ /** Published AI Studio pipeline ID to use as this session's base configuration. Overrides agent.pipelineId. */
209
211
  pipelineId?: string;
210
212
  /**
211
213
  * Token lifetime in seconds (default: 86400 = 24 hours, Agora maximum).
@@ -371,7 +373,7 @@ export type LlmConfig = (BaseLlmConfig & {
371
373
  }) | (BaseLlmConfig & {
372
374
  style?: undefined;
373
375
  params?: Record<string, unknown>;
374
- }) | StartAgentsRequest.Properties.Llm;
376
+ }) | Llm;
375
377
  /**
376
378
  * Speechmatics STT parameters
377
379
  * @see https://docs.agora.io/en/conversational-ai/models/asr/speechmatics
@@ -381,6 +383,8 @@ export interface SpeechmaticsParams {
381
383
  api_key: string;
382
384
  /** Language code for transcription (e.g., 'en', 'es', 'fr') (required) */
383
385
  language: string;
386
+ /** Speechmatics streaming WebSocket URL */
387
+ uri?: string;
384
388
  /** Additional Speechmatics-specific parameters passed directly to Speechmatics API */
385
389
  [key: string]: unknown;
386
390
  }
@@ -390,7 +394,7 @@ export interface SpeechmaticsParams {
390
394
  */
391
395
  export interface DeepgramParams {
392
396
  /** Deepgram API key */
393
- api_key?: string;
397
+ key?: string;
394
398
  /** Model to use (e.g., 'nova-2', 'enhanced', 'base') */
395
399
  model?: string;
396
400
  /** Language code (e.g., 'en-US', 'es', 'fr') */
@@ -423,8 +427,13 @@ export interface MicrosoftAsrParams {
423
427
  export interface OpenAiAsrParams {
424
428
  /** OpenAI API key (required) */
425
429
  api_key: string;
426
- /** Model to use (default: 'whisper-1') */
427
- model?: string;
430
+ /** OpenAI transcription settings */
431
+ input_audio_transcription?: {
432
+ model?: string;
433
+ prompt?: string;
434
+ language?: string;
435
+ [key: string]: unknown;
436
+ };
428
437
  /** Additional OpenAI-specific parameters */
429
438
  [key: string]: unknown;
430
439
  }
@@ -433,10 +442,16 @@ export interface OpenAiAsrParams {
433
442
  * @see https://docs.agora.io/en/conversational-ai/models/asr/google
434
443
  */
435
444
  export interface GoogleAsrParams {
436
- /** Google Cloud API key (required) */
437
- api_key: string;
445
+ /** Google Cloud project ID where Speech-to-Text is enabled (required) */
446
+ project_id: string;
447
+ /** Google Cloud region for the recognizer (required) */
448
+ location: string;
449
+ /** Google service account credentials JSON string (required) */
450
+ adc_credentials_string: string;
438
451
  /** Language code (e.g., 'en-US', 'es-ES') */
439
452
  language?: string;
453
+ /** Recognition model to use */
454
+ model?: string;
440
455
  /** Additional Google Speech-to-Text parameters */
441
456
  [key: string]: unknown;
442
457
  }
@@ -446,13 +461,13 @@ export interface GoogleAsrParams {
446
461
  */
447
462
  export interface AmazonAsrParams {
448
463
  /** AWS Access Key ID (required) */
449
- access_key: string;
464
+ access_key_id: string;
450
465
  /** AWS Secret Access Key (required) */
451
- secret_key: string;
466
+ secret_access_key: string;
452
467
  /** AWS region (e.g., 'us-east-1') (required) */
453
468
  region: string;
454
469
  /** Language code */
455
- language?: string;
470
+ language_code?: string;
456
471
  /** Additional Amazon Transcribe parameters */
457
472
  [key: string]: unknown;
458
473
  }
@@ -465,6 +480,8 @@ export interface AssemblyAiParams {
465
480
  api_key: string;
466
481
  /** Language code */
467
482
  language?: string;
483
+ /** AssemblyAI streaming WebSocket URL */
484
+ uri?: string;
468
485
  /** Additional AssemblyAI-specific parameters */
469
486
  [key: string]: unknown;
470
487
  }
@@ -473,8 +490,6 @@ export interface AssemblyAiParams {
473
490
  * @see https://docs.agora.io/en/conversational-ai/models/asr/ares
474
491
  */
475
492
  export interface AresParams {
476
- /** Language code for ARES ASR */
477
- language?: string;
478
493
  /** Additional ARES-specific parameters */
479
494
  [key: string]: unknown;
480
495
  }
@@ -63,6 +63,7 @@ export interface AkoolAvatarOptions {
63
63
  * key: process.env.ELEVENLABS_API_KEY,
64
64
  * modelId: 'eleven_flash_v2_5',
65
65
  * voiceId: 'voice-id',
66
+ * baseUrl: 'wss://api.elevenlabs.io/v1',
66
67
  * sampleRate: 16000, // Required for Akool
67
68
  * });
68
69
  *
@@ -100,9 +101,10 @@ export declare class AkoolAvatar extends BaseAvatar<AkoolSampleRate> {
100
101
  * });
101
102
  *
102
103
  * const tts = new ElevenLabsTTS({
103
- * apiKey: process.env.ELEVENLABS_API_KEY,
104
+ * key: process.env.ELEVENLABS_API_KEY,
104
105
  * modelId: 'eleven_flash_v2_5',
105
106
  * voiceId: 'voice-id',
107
+ * baseUrl: 'wss://api.elevenlabs.io/v1',
106
108
  * sampleRate: 24000, // Required for LiveAvatar
107
109
  * });
108
110
  *
@@ -28,6 +28,7 @@ const base_js_1 = require("./base.js");
28
28
  * key: process.env.ELEVENLABS_API_KEY,
29
29
  * modelId: 'eleven_flash_v2_5',
30
30
  * voiceId: 'voice-id',
31
+ * baseUrl: 'wss://api.elevenlabs.io/v1',
31
32
  * sampleRate: 16000, // Required for Akool
32
33
  * });
33
34
  *
@@ -83,9 +84,10 @@ exports.AkoolAvatar = AkoolAvatar;
83
84
  * });
84
85
  *
85
86
  * const tts = new ElevenLabsTTS({
86
- * apiKey: process.env.ELEVENLABS_API_KEY,
87
+ * key: process.env.ELEVENLABS_API_KEY,
87
88
  * modelId: 'eleven_flash_v2_5',
88
89
  * voiceId: 'voice-id',
90
+ * baseUrl: 'wss://api.elevenlabs.io/v1',
89
91
  * sampleRate: 24000, // Required for LiveAvatar
90
92
  * });
91
93
  *
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Type-safe LLM (Large Language Model) vendor classes.
3
3
  */
4
- import type { OpenAIPresetModel } from "../presets.js";
4
+ import { type OpenAIPresetModel } from "../presets.js";
5
5
  import type { LlmConfig } from "../types.js";
6
6
  import { BaseLLM, type BaseLlmOptions } from "./base.js";
7
7
  /**
@@ -12,7 +12,7 @@ type OpenAICommonOptions = BaseLlmOptions & {
12
12
  apiKey?: string;
13
13
  /** Model name (e.g., 'gpt-4o-mini', 'gpt-4', 'gpt-3.5-turbo') */
14
14
  model: string;
15
- /** API endpoint URL (defaults to OpenAI's standard endpoint) */
15
+ /** API endpoint URL */
16
16
  url?: string;
17
17
  /** Maximum number of conversation history messages to cache */
18
18
  maxHistory?: number;
@@ -37,6 +37,7 @@ type OpenAICommonOptions = BaseLlmOptions & {
37
37
  };
38
38
  export type OpenAIOptions = (OpenAICommonOptions & {
39
39
  apiKey: string;
40
+ url: string;
40
41
  }) | (Omit<OpenAICommonOptions, "model" | "url" | "vendor"> & {
41
42
  apiKey?: undefined;
42
43
  model: OpenAIPresetModel;
@@ -51,6 +52,7 @@ export type OpenAIOptions = (OpenAICommonOptions & {
51
52
  * const llm = new OpenAI({
52
53
  * apiKey: process.env.OPENAI_API_KEY,
53
54
  * model: 'gpt-4o',
55
+ * url: 'https://api.openai.com/v1/chat/completions',
54
56
  * });
55
57
  * ```
56
58
  */
@@ -120,12 +122,12 @@ export interface AnthropicOptions extends BaseLlmOptions {
120
122
  apiKey: string;
121
123
  /** Model name (e.g., 'claude-3-5-sonnet-20241022', 'claude-3-opus-20240229') */
122
124
  model: string;
123
- /** API endpoint URL (defaults to Anthropic's standard endpoint) */
124
- url?: string;
125
+ /** API endpoint URL */
126
+ url: string;
125
127
  /** Maximum number of conversation history messages to cache */
126
128
  maxHistory?: number;
127
129
  /** Maximum tokens to generate */
128
- maxTokens?: number;
130
+ maxTokens: number;
129
131
  /** Sampling temperature (0.0–1.0) */
130
132
  temperature?: number;
131
133
  /** Nucleus sampling (0.0–1.0) */
@@ -151,6 +153,9 @@ export interface AnthropicOptions extends BaseLlmOptions {
151
153
  * const llm = new Anthropic({
152
154
  * apiKey: process.env.ANTHROPIC_API_KEY,
153
155
  * model: 'claude-3-5-sonnet-20241022',
156
+ * url: 'https://api.anthropic.com/v1/messages',
157
+ * headers: { 'anthropic-version': '2023-06-01' },
158
+ * maxTokens: 1024,
154
159
  * });
155
160
  * ```
156
161
  */
@@ -211,7 +216,7 @@ export declare class Gemini extends BaseLLM {
211
216
  type OpenAIStyleOptions = BaseLlmOptions & {
212
217
  apiKey: string;
213
218
  model: string;
214
- url?: string;
219
+ url: string;
215
220
  maxHistory?: number;
216
221
  temperature?: number;
217
222
  topP?: number;
@@ -259,9 +264,13 @@ export declare class VertexAILLM extends BaseLLM {
259
264
  toConfig(): LlmConfig;
260
265
  }
261
266
  export interface AmazonBedrockOptions extends BaseLlmOptions {
262
- apiKey: string;
267
+ /** AWS access key ID. */
268
+ accessKey: string;
269
+ /** AWS secret access key. */
270
+ secretKey: string;
271
+ /** AWS region. */
272
+ region: string;
263
273
  model: string;
264
- url: string;
265
274
  maxHistory?: number;
266
275
  maxTokens?: number;
267
276
  temperature?: number;
@@ -282,6 +291,7 @@ export declare class AmazonBedrock extends BaseLLM {
282
291
  export interface DifyOptions extends BaseLlmOptions {
283
292
  apiKey: string;
284
293
  url: string;
294
+ model: string;
285
295
  user?: string;
286
296
  conversationId?: string;
287
297
  maxHistory?: number;
@@ -4,7 +4,26 @@
4
4
  */
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.Dify = exports.AmazonBedrock = exports.VertexAILLM = exports.CustomLLM = exports.Groq = exports.Gemini = exports.Anthropic = exports.AzureOpenAI = exports.OpenAI = void 0;
7
+ const presets_js_1 = require("../presets.js");
7
8
  const base_js_1 = require("./base.js");
9
+ function requireString(value, field, vendor) {
10
+ if (typeof value !== "string" || value.length === 0) {
11
+ throw new Error(`${vendor} requires ${field}`);
12
+ }
13
+ }
14
+ function requireNumber(value, field, vendor) {
15
+ if (typeof value !== "number" || Number.isNaN(value)) {
16
+ throw new Error(`${vendor} requires ${field}`);
17
+ }
18
+ }
19
+ function requireRecord(value, field, vendor) {
20
+ if (value == null || typeof value !== "object" || Array.isArray(value)) {
21
+ throw new Error(`${vendor} requires ${field}`);
22
+ }
23
+ }
24
+ function isOpenAIManagedModel(model) {
25
+ return presets_js_1.OpenAIPresetModels.includes(model.trim().toLowerCase());
26
+ }
8
27
  /**
9
28
  * OpenAI LLM vendor (and OpenAI-compatible APIs).
10
29
  *
@@ -13,12 +32,28 @@ const base_js_1 = require("./base.js");
13
32
  * const llm = new OpenAI({
14
33
  * apiKey: process.env.OPENAI_API_KEY,
15
34
  * model: 'gpt-4o',
35
+ * url: 'https://api.openai.com/v1/chat/completions',
16
36
  * });
17
37
  * ```
18
38
  */
19
39
  class OpenAI extends base_js_1.BaseLLM {
20
40
  constructor(options) {
21
41
  super(options);
42
+ requireString(options.model, "model", "OpenAI");
43
+ if (options.apiKey) {
44
+ requireString(options.url, "url", "OpenAI");
45
+ }
46
+ else {
47
+ if (!isOpenAIManagedModel(options.model)) {
48
+ throw new Error("OpenAI requires apiKey unless using a supported Agora-managed model");
49
+ }
50
+ if (options.url) {
51
+ throw new Error("OpenAI Agora-managed mode does not allow url");
52
+ }
53
+ if (options.vendor) {
54
+ throw new Error("OpenAI Agora-managed mode does not allow vendor");
55
+ }
56
+ }
22
57
  this.options = options;
23
58
  }
24
59
  toConfig() {
@@ -45,6 +80,10 @@ exports.OpenAI = OpenAI;
45
80
  class AzureOpenAI extends base_js_1.BaseLLM {
46
81
  constructor(options) {
47
82
  super(options);
83
+ requireString(options.apiKey, "apiKey", "AzureOpenAI");
84
+ requireString(options.model, "model", "AzureOpenAI");
85
+ requireString(options.resourceName, "resourceName", "AzureOpenAI");
86
+ requireString(options.deploymentName, "deploymentName", "AzureOpenAI");
48
87
  this.options = options;
49
88
  }
50
89
  toConfig() {
@@ -80,18 +119,26 @@ exports.AzureOpenAI = AzureOpenAI;
80
119
  * const llm = new Anthropic({
81
120
  * apiKey: process.env.ANTHROPIC_API_KEY,
82
121
  * model: 'claude-3-5-sonnet-20241022',
122
+ * url: 'https://api.anthropic.com/v1/messages',
123
+ * headers: { 'anthropic-version': '2023-06-01' },
124
+ * maxTokens: 1024,
83
125
  * });
84
126
  * ```
85
127
  */
86
128
  class Anthropic extends base_js_1.BaseLLM {
87
129
  constructor(options) {
88
130
  super(options);
131
+ requireString(options.apiKey, "apiKey", "Anthropic");
132
+ requireString(options.model, "model", "Anthropic");
133
+ requireString(options.url, "url", "Anthropic");
134
+ requireRecord(options.headers, "headers", "Anthropic");
135
+ requireNumber(options.maxTokens, "maxTokens", "Anthropic");
89
136
  this.options = options;
90
137
  }
91
138
  toConfig() {
92
139
  const { apiKey, model, url, maxHistory, maxTokens, temperature, topP, systemMessages, greetingMessage, failureMessage, inputModalities, params, headers, } = this.options;
93
140
  return {
94
- url: url !== null && url !== void 0 ? url : "https://api.anthropic.com/v1/messages",
141
+ url,
95
142
  api_key: apiKey,
96
143
  // model is the default; params entries extend it; named fields win.
97
144
  params: Object.assign(Object.assign(Object.assign(Object.assign({ model }, params), (maxTokens !== undefined && { max_tokens: maxTokens })), (temperature !== undefined && { temperature })), (topP !== undefined && { top_p: topP })),
@@ -125,6 +172,8 @@ exports.Anthropic = Anthropic;
125
172
  class Gemini extends base_js_1.BaseLLM {
126
173
  constructor(options) {
127
174
  super(options);
175
+ requireString(options.apiKey, "apiKey", "Gemini");
176
+ requireString(options.model, "model", "Gemini");
128
177
  this.options = options;
129
178
  }
130
179
  toConfig() {
@@ -150,10 +199,10 @@ class Gemini extends base_js_1.BaseLLM {
150
199
  }
151
200
  }
152
201
  exports.Gemini = Gemini;
153
- function openAIStyleConfig(options, defaultUrl, vendor) {
154
- var _a, _b, _c;
202
+ function openAIStyleConfig(options, vendor) {
203
+ var _a, _b;
155
204
  return {
156
- url: (_a = options.url) !== null && _a !== void 0 ? _a : defaultUrl,
205
+ url: options.url,
157
206
  api_key: options.apiKey,
158
207
  params: Object.assign(Object.assign(Object.assign(Object.assign({ model: options.model }, options.params), (options.temperature !== undefined && { temperature: options.temperature })), (options.topP !== undefined && { top_p: options.topP })), (options.maxTokens !== undefined && { max_tokens: options.maxTokens })),
159
208
  headers: options.headers,
@@ -161,10 +210,10 @@ function openAIStyleConfig(options, defaultUrl, vendor) {
161
210
  system_messages: options.systemMessages,
162
211
  greeting_message: options.greetingMessage,
163
212
  failure_message: options.failureMessage,
164
- input_modalities: (_b = options.inputModalities) !== null && _b !== void 0 ? _b : ["text"],
213
+ input_modalities: (_a = options.inputModalities) !== null && _a !== void 0 ? _a : ["text"],
165
214
  output_modalities: options.outputModalities,
166
215
  style: "openai",
167
- vendor: (_c = options.vendor) !== null && _c !== void 0 ? _c : vendor,
216
+ vendor: (_b = options.vendor) !== null && _b !== void 0 ? _b : vendor,
168
217
  greeting_configs: options.greetingConfigs,
169
218
  template_variables: options.templateVariables,
170
219
  mcp_servers: options.mcpServers,
@@ -174,9 +223,12 @@ class Groq extends base_js_1.BaseLLM {
174
223
  constructor(options) {
175
224
  super(options);
176
225
  this.options = options;
226
+ requireString(options.apiKey, "apiKey", "Groq");
227
+ requireString(options.model, "model", "Groq");
228
+ requireString(options.url, "url", "Groq");
177
229
  }
178
230
  toConfig() {
179
- return openAIStyleConfig(this.options, "https://api.groq.com/openai/v1/chat/completions");
231
+ return openAIStyleConfig(this.options);
180
232
  }
181
233
  }
182
234
  exports.Groq = Groq;
@@ -184,10 +236,12 @@ class CustomLLM extends base_js_1.BaseLLM {
184
236
  constructor(options) {
185
237
  super(options);
186
238
  this.options = options;
239
+ requireString(options.apiKey, "apiKey", "CustomLLM");
240
+ requireString(options.model, "model", "CustomLLM");
241
+ requireString(options.url, "url", "CustomLLM");
187
242
  }
188
243
  toConfig() {
189
- var _a;
190
- return openAIStyleConfig(this.options, (_a = this.options.url) !== null && _a !== void 0 ? _a : "", "custom");
244
+ return openAIStyleConfig(this.options, "custom");
191
245
  }
192
246
  }
193
247
  exports.CustomLLM = CustomLLM;
@@ -195,6 +249,10 @@ class VertexAILLM extends base_js_1.BaseLLM {
195
249
  constructor(options) {
196
250
  super(options);
197
251
  this.options = options;
252
+ requireString(options.apiKey, "apiKey", "VertexAILLM");
253
+ requireString(options.model, "model", "VertexAILLM");
254
+ requireString(options.projectId, "projectId", "VertexAILLM");
255
+ requireString(options.location, "location", "VertexAILLM");
198
256
  }
199
257
  toConfig() {
200
258
  var _a, _b;
@@ -202,7 +260,7 @@ class VertexAILLM extends base_js_1.BaseLLM {
202
260
  return {
203
261
  url: (_a = o.url) !== null && _a !== void 0 ? _a : "https://aiplatform.googleapis.com/v1/projects",
204
262
  api_key: o.apiKey,
205
- params: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ model: o.model, project_id: o.projectId, location: o.location }, o.params), (o.temperature !== undefined && { temperature: o.temperature })), (o.topP !== undefined && { topP: o.topP })), (o.topK !== undefined && { topK: o.topK })), (o.maxOutputTokens !== undefined && { maxOutputTokens: o.maxOutputTokens })),
263
+ params: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ model: o.model, project_id: o.projectId, location: o.location }, o.params), (o.temperature !== undefined && { temperature: o.temperature })), (o.topP !== undefined && { top_p: o.topP })), (o.topK !== undefined && { top_k: o.topK })), (o.maxOutputTokens !== undefined && { max_output_tokens: o.maxOutputTokens })),
206
264
  headers: o.headers,
207
265
  max_history: o.maxHistory,
208
266
  system_messages: o.systemMessages,
@@ -223,14 +281,21 @@ class AmazonBedrock extends base_js_1.BaseLLM {
223
281
  constructor(options) {
224
282
  super(options);
225
283
  this.options = options;
284
+ requireString(options.accessKey, "accessKey", "AmazonBedrock");
285
+ requireString(options.secretKey, "secretKey", "AmazonBedrock");
286
+ requireString(options.region, "region", "AmazonBedrock");
287
+ requireString(options.model, "model", "AmazonBedrock");
226
288
  }
227
289
  toConfig() {
228
290
  var _a;
229
291
  const o = this.options;
230
292
  return {
231
- url: o.url,
232
- api_key: o.apiKey,
233
- params: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ model: o.model }, o.params), (o.maxTokens !== undefined && { max_tokens: o.maxTokens })), (o.temperature !== undefined && { temperature: o.temperature })), (o.topP !== undefined && { top_p: o.topP })), (o.topK !== undefined && { top_k: o.topK })),
293
+ url: `https://bedrock-runtime.${o.region}.amazonaws.com/model/${o.model}/converse-stream`,
294
+ access_key: o.accessKey,
295
+ secret_key: o.secretKey,
296
+ region: o.region,
297
+ model: o.model,
298
+ params: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, o.params), (o.maxTokens !== undefined && { max_tokens: o.maxTokens })), (o.temperature !== undefined && { temperature: o.temperature })), (o.topP !== undefined && { top_p: o.topP })), (o.topK !== undefined && { top_k: o.topK })),
234
299
  headers: o.headers,
235
300
  max_history: o.maxHistory,
236
301
  system_messages: o.systemMessages,
@@ -238,7 +303,7 @@ class AmazonBedrock extends base_js_1.BaseLLM {
238
303
  failure_message: o.failureMessage,
239
304
  input_modalities: (_a = o.inputModalities) !== null && _a !== void 0 ? _a : ["text"],
240
305
  output_modalities: this.outputModalities,
241
- style: "anthropic",
306
+ style: "bedrock",
242
307
  vendor: this.vendor,
243
308
  greeting_configs: this.greetingConfigs,
244
309
  template_variables: this.templateVariables,
@@ -251,6 +316,9 @@ class Dify extends base_js_1.BaseLLM {
251
316
  constructor(options) {
252
317
  super(options);
253
318
  this.options = options;
319
+ requireString(options.apiKey, "apiKey", "Dify");
320
+ requireString(options.url, "url", "Dify");
321
+ requireString(options.model, "model", "Dify");
254
322
  }
255
323
  toConfig() {
256
324
  var _a;
@@ -258,7 +326,7 @@ class Dify extends base_js_1.BaseLLM {
258
326
  return {
259
327
  url: o.url,
260
328
  api_key: o.apiKey,
261
- params: Object.assign(Object.assign(Object.assign({}, o.params), (o.user !== undefined && { user: o.user })), (o.conversationId !== undefined && { conversation_id: o.conversationId })),
329
+ params: Object.assign(Object.assign(Object.assign({ model: o.model }, o.params), (o.user !== undefined && { user: o.user })), (o.conversationId !== undefined && { conversation_id: o.conversationId })),
262
330
  headers: o.headers,
263
331
  max_history: o.maxHistory,
264
332
  system_messages: o.systemMessages,