@livekit/agents-plugin-openai 1.4.11 → 1.5.1
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.
- package/dist/index.cjs +4 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/llm.cjs +10 -3
- package/dist/llm.cjs.map +1 -1
- package/dist/llm.d.cts +4 -3
- package/dist/llm.d.ts +4 -3
- package/dist/llm.d.ts.map +1 -1
- package/dist/llm.js +10 -3
- package/dist/llm.js.map +1 -1
- package/dist/models.cjs +12 -3
- package/dist/models.cjs.map +1 -1
- package/dist/models.d.cts +7 -1
- package/dist/models.d.ts +7 -1
- package/dist/models.d.ts.map +1 -1
- package/dist/models.js +11 -3
- package/dist/models.js.map +1 -1
- package/dist/realtime/realtime_model.cjs +26 -21
- package/dist/realtime/realtime_model.cjs.map +1 -1
- package/dist/realtime/realtime_model.d.cts +2 -2
- package/dist/realtime/realtime_model.d.ts +2 -2
- package/dist/realtime/realtime_model.d.ts.map +1 -1
- package/dist/realtime/realtime_model.js +26 -21
- package/dist/realtime/realtime_model.js.map +1 -1
- package/dist/realtime/realtime_model.test.cjs +28 -0
- package/dist/realtime/realtime_model.test.cjs.map +1 -1
- package/dist/realtime/realtime_model.test.js +28 -0
- package/dist/realtime/realtime_model.test.js.map +1 -1
- package/dist/responses/llm.cjs +16 -18
- package/dist/responses/llm.cjs.map +1 -1
- package/dist/responses/llm.d.cts +4 -2
- package/dist/responses/llm.d.ts +4 -2
- package/dist/responses/llm.d.ts.map +1 -1
- package/dist/responses/llm.js +16 -18
- package/dist/responses/llm.js.map +1 -1
- package/dist/stt.cjs +23 -9
- package/dist/stt.cjs.map +1 -1
- package/dist/stt.d.ts.map +1 -1
- package/dist/stt.js +23 -9
- package/dist/stt.js.map +1 -1
- package/dist/tool_utils.cjs +53 -0
- package/dist/tool_utils.cjs.map +1 -0
- package/dist/tool_utils.d.cts +4 -0
- package/dist/tool_utils.d.ts +4 -0
- package/dist/tool_utils.d.ts.map +1 -0
- package/dist/tool_utils.js +29 -0
- package/dist/tool_utils.js.map +1 -0
- package/dist/tool_utils.test.cjs +77 -0
- package/dist/tool_utils.test.cjs.map +1 -0
- package/dist/tool_utils.test.d.cts +2 -0
- package/dist/tool_utils.test.d.ts +2 -0
- package/dist/tool_utils.test.d.ts.map +1 -0
- package/dist/tool_utils.test.js +76 -0
- package/dist/tool_utils.test.js.map +1 -0
- package/dist/tools.cjs +117 -0
- package/dist/tools.cjs.map +1 -0
- package/dist/tools.d.cts +88 -0
- package/dist/tools.d.ts +88 -0
- package/dist/tools.d.ts.map +1 -0
- package/dist/tools.js +90 -0
- package/dist/tools.js.map +1 -0
- package/dist/tts.cjs +1 -0
- package/dist/tts.cjs.map +1 -1
- package/dist/tts.d.ts.map +1 -1
- package/dist/tts.js +1 -0
- package/dist/tts.js.map +1 -1
- package/dist/ws/llm.cjs +15 -18
- package/dist/ws/llm.cjs.map +1 -1
- package/dist/ws/llm.d.cts +5 -3
- package/dist/ws/llm.d.ts +5 -3
- package/dist/ws/llm.d.ts.map +1 -1
- package/dist/ws/llm.js +15 -18
- package/dist/ws/llm.js.map +1 -1
- package/package.json +7 -7
- package/src/index.ts +1 -0
- package/src/llm.ts +18 -4
- package/src/models.ts +18 -3
- package/src/realtime/realtime_model.test.ts +38 -0
- package/src/realtime/realtime_model.ts +31 -21
- package/src/responses/llm.ts +28 -23
- package/src/stt.ts +26 -12
- package/src/tool_utils.test.ts +84 -0
- package/src/tool_utils.ts +46 -0
- package/src/tools.ts +166 -0
- package/src/tts.ts +1 -0
- package/src/ws/llm.ts +25 -24
package/dist/models.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type ChatModels = 'gpt-5.4' | 'gpt-5.3-chat-latest' | 'gpt-5.2' | 'gpt-5.2-chat-latest' | 'gpt-5.1' | 'gpt-5.1-chat-latest' | 'gpt-5' | 'gpt-5-mini' | 'gpt-5-nano' | 'gpt-4.1' | 'gpt-4.1-mini' | 'gpt-4.1-nano' | 'gpt-4o' | 'gpt-4o-2024-05-13' | 'gpt-4o-mini' | 'gpt-4o-mini-2024-07-18' | 'gpt-4-turbo' | 'gpt-4-turbo-2024-04-09' | 'gpt-4-turbo-preview' | 'gpt-4-0125-preview' | 'gpt-4-1106-preview' | 'gpt-4-vision-preview' | 'gpt-4-1106-vision-preview' | 'gpt-4' | 'gpt-4-0314' | 'gpt-4-0613' | 'gpt-4-32k' | 'gpt-4-32k-0314' | 'gpt-4-32k-0613' | 'gpt-3.5-turbo' | 'gpt-3.5-turbo-16k' | 'gpt-3.5-turbo-0301' | 'gpt-3.5-turbo-0613' | 'gpt-3.5-turbo-1106' | 'gpt-3.5-turbo-16k-0613';
|
|
1
|
+
export type ChatModels = 'gpt-5.4' | 'gpt-5.4-mini' | 'gpt-5.3-chat-latest' | 'gpt-5.2' | 'gpt-5.2-chat-latest' | 'gpt-5.1' | 'gpt-5.1-chat-latest' | 'gpt-5' | 'gpt-5-mini' | 'gpt-5-nano' | 'gpt-4.1' | 'gpt-4.1-mini' | 'gpt-4.1-nano' | 'gpt-4o' | 'gpt-4o-2024-05-13' | 'gpt-4o-mini' | 'gpt-4o-mini-2024-07-18' | 'gpt-4-turbo' | 'gpt-4-turbo-2024-04-09' | 'gpt-4-turbo-preview' | 'gpt-4-0125-preview' | 'gpt-4-1106-preview' | 'gpt-4-vision-preview' | 'gpt-4-1106-vision-preview' | 'gpt-4' | 'gpt-4-0314' | 'gpt-4-0613' | 'gpt-4-32k' | 'gpt-4-32k-0314' | 'gpt-4-32k-0613' | 'gpt-3.5-turbo' | 'gpt-3.5-turbo-16k' | 'gpt-3.5-turbo-0301' | 'gpt-3.5-turbo-0613' | 'gpt-3.5-turbo-1106' | 'gpt-3.5-turbo-16k-0613';
|
|
2
2
|
export type WhisperModels = 'whisper-1';
|
|
3
3
|
export type TTSModels = 'tts-1' | 'tts-1-hd' | 'gpt-4o-mini-tts';
|
|
4
4
|
export type TTSVoices = 'alloy' | 'ash' | 'ballad' | 'coral' | 'echo' | 'fable' | 'nova' | 'onyx' | 'sage' | 'shimmer';
|
|
@@ -16,5 +16,11 @@ export type TogetherChatModels = 'Austism/chronos-hermes-13b' | 'Gryphe/MythoMax
|
|
|
16
16
|
export type OctoChatModels = 'meta-llama-3-70b-instruct' | 'meta-llama-3.1-405b-instruct' | 'meta-llama-3.1-70b-instruct' | 'meta-llama-3.1-8b-instruct' | 'mistral-7b-instruct' | 'mixtral-8x7b-instruct' | 'wizardlm-2-8x22bllamaguard-2-7b';
|
|
17
17
|
export type XAIChatModels = 'grok-3' | 'grok-3-fast' | 'grok-3-mini' | 'grok-3-mini-fast' | 'grok-2-vision-1212' | 'grok-2-image-1212' | 'grok-2-1212';
|
|
18
18
|
export type MetaChatModels = 'Llama-4-Scout-17B-16E-Instruct-FP8' | 'Llama-4-Maverick-17B-128E-Instruct-FP8' | 'Llama-3.3-70B-Instruct' | 'Llama-3.3-8B-Instruct';
|
|
19
|
+
export type ReasoningEffort = 'none' | 'minimal' | 'low' | 'medium' | 'high';
|
|
20
|
+
export type Reasoning = {
|
|
21
|
+
effort?: ReasoningEffort | null;
|
|
22
|
+
[key: string]: unknown;
|
|
23
|
+
};
|
|
19
24
|
export declare function supportsReasoningEffort(model: ChatModels | string): boolean;
|
|
25
|
+
export declare function defaultReasoningEffort(model: ChatModels | string): ReasoningEffort | undefined;
|
|
20
26
|
//# sourceMappingURL=models.d.ts.map
|
package/dist/models.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../src/models.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,UAAU,GAClB,SAAS,GACT,qBAAqB,GACrB,SAAS,GACT,qBAAqB,GACrB,SAAS,GACT,qBAAqB,GACrB,OAAO,GACP,YAAY,G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,MAAM,GAAG,SAAS,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAC;AAE7E,MAAM,MAAM,SAAS,GAAG;IAAE,MAAM,CAAC,EAAE,eAAe,GAAG,IAAI,CAAC;IAAC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CAAE,CAAC;AAEpF,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,GAAG,OAAO,CAU3E;AAED,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,GAAG,eAAe,GAAG,SAAS,CAU9F"}
|
package/dist/models.js
CHANGED
|
@@ -1,17 +1,25 @@
|
|
|
1
1
|
function supportsReasoningEffort(model) {
|
|
2
2
|
return [
|
|
3
3
|
"gpt-5.4",
|
|
4
|
-
"gpt-5.
|
|
4
|
+
"gpt-5.4-mini",
|
|
5
5
|
"gpt-5.2",
|
|
6
|
-
"gpt-5.2-chat-latest",
|
|
7
6
|
"gpt-5.1",
|
|
8
|
-
"gpt-5.1-chat-latest",
|
|
9
7
|
"gpt-5",
|
|
10
8
|
"gpt-5-mini",
|
|
11
9
|
"gpt-5-nano"
|
|
12
10
|
].includes(model);
|
|
13
11
|
}
|
|
12
|
+
function defaultReasoningEffort(model) {
|
|
13
|
+
if (!supportsReasoningEffort(model)) {
|
|
14
|
+
return void 0;
|
|
15
|
+
}
|
|
16
|
+
if (["gpt-5.1", "gpt-5.2", "gpt-5.4", "gpt-5.4-mini"].includes(model)) {
|
|
17
|
+
return "none";
|
|
18
|
+
}
|
|
19
|
+
return "minimal";
|
|
20
|
+
}
|
|
14
21
|
export {
|
|
22
|
+
defaultReasoningEffort,
|
|
15
23
|
supportsReasoningEffort
|
|
16
24
|
};
|
|
17
25
|
//# sourceMappingURL=models.js.map
|
package/dist/models.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/models.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2024 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\n\nexport type ChatModels =\n | 'gpt-5.4'\n | 'gpt-5.3-chat-latest'\n | 'gpt-5.2'\n | 'gpt-5.2-chat-latest'\n | 'gpt-5.1'\n | 'gpt-5.1-chat-latest'\n | 'gpt-5'\n | 'gpt-5-mini'\n | 'gpt-5-nano'\n | 'gpt-4.1'\n | 'gpt-4.1-mini'\n | 'gpt-4.1-nano'\n | 'gpt-4o'\n | 'gpt-4o-2024-05-13'\n | 'gpt-4o-mini'\n | 'gpt-4o-mini-2024-07-18'\n | 'gpt-4-turbo'\n | 'gpt-4-turbo-2024-04-09'\n | 'gpt-4-turbo-preview'\n | 'gpt-4-0125-preview'\n | 'gpt-4-1106-preview'\n | 'gpt-4-vision-preview'\n | 'gpt-4-1106-vision-preview'\n | 'gpt-4'\n | 'gpt-4-0314'\n | 'gpt-4-0613'\n | 'gpt-4-32k'\n | 'gpt-4-32k-0314'\n | 'gpt-4-32k-0613'\n | 'gpt-3.5-turbo'\n | 'gpt-3.5-turbo-16k'\n | 'gpt-3.5-turbo-0301'\n | 'gpt-3.5-turbo-0613'\n | 'gpt-3.5-turbo-1106'\n | 'gpt-3.5-turbo-16k-0613';\n\nexport type WhisperModels = 'whisper-1';\n\nexport type TTSModels = 'tts-1' | 'tts-1-hd' | 'gpt-4o-mini-tts';\n\nexport type TTSVoices =\n | 'alloy'\n | 'ash'\n | 'ballad'\n | 'coral'\n | 'echo'\n | 'fable'\n | 'nova'\n | 'onyx'\n | 'sage'\n | 'shimmer';\n\nexport type DalleModels = 'dall-e-2' | 'dall-e-3';\n\nexport type EmbeddingModels =\n | 'text-embedding-ada-002'\n | 'text-embedding-3-small'\n | 'text-embedding-3-large';\n\nexport type AssistantTools = 'code_interpreter' | 'file_search' | 'function';\n\nexport type VertexModels =\n | 'google/gemini-2.0-flash-exp'\n | 'google/gemini-1.5-flash'\n | 'google/gemini-1.5-pro'\n | 'google/gemini-1.0-pro-vision'\n | 'google/gemini-1.0-pro-vision-001'\n | 'google/gemini-1.0-pro-002'\n | 'google/gemini-1.0-pro-001'\n | 'google/gemini-1.0-pro';\n\n// adapters for OpenAI-compatible LLMs, TTSs, STTs\n\nexport type TelnyxChatModels =\n | 'meta-llama/Meta-Llama-3.1-8B-Instruct'\n | 'meta-llama/Meta-Llama-3.1-70B-Instruct';\n\nexport type CerebrasChatModels =\n | 'llama3.1-8b'\n | 'llama-3.3-70b'\n | 'llama-4-scout-17b-16e-instruct'\n | 'llama-4-maverick-17b-128e-instruct'\n | 'qwen-3-32b'\n | 'qwen-3-235b-a22b-instruct-2507'\n | 'qwen-3-235b-a22b-thinking-2507'\n | 'qwen-3-coder-480b'\n | 'gpt-oss-120b';\n\nexport type PerplexityChatModels =\n | 'llama-3.1-sonar-small-128k-online'\n | 'llama-3.1-sonar-small-128k-chat'\n | 'llama-3.1-sonar-large-128k-online'\n | 'llama-3.1-sonar-large-128k-chat'\n | 'llama-3.1-8b-instruct'\n | 'llama-3.1-70b-instruct';\n\nexport type GroqChatModels =\n | 'llama-3.1-8b-instant'\n | 'llama-3.3-70b-versatile'\n | 'openai/gpt-oss-120b'\n | 'openai/gpt-oss-20b';\n\nexport type GroqAudioModels = 'whisper-large-v3' | 'whisper-large-v3-turbo';\n\nexport type DeepSeekChatModels = 'deepseek-coder' | 'deepseek-chat';\n\nexport type TogetherChatModels =\n | 'Austism/chronos-hermes-13b'\n | 'Gryphe/MythoMax-L2-13b'\n | 'NousResearch/Nous-Capybara-7B-V1p9'\n | 'NousResearch/Nous-Hermes-2-Mistral-7B-DPO'\n | 'NousResearch/Nous-Hermes-2-Mixtral-8x7B-DPO'\n | 'NousResearch/Nous-Hermes-2-Mixtral-8x7B-SFT'\n | 'NousResearch/Nous-Hermes-2-Yi-34B'\n | 'NousResearch/Nous-Hermes-Llama2-13b'\n | 'NousResearch/Nous-Hermes-llama-2-7b'\n | 'Open-Orca/Mistral-7B-OpenOrca'\n | 'Qwen/Qwen1.5-0.5B-Chat'\n | 'Qwen/Qwen1.5-1.8B-Chat'\n | 'Qwen/Qwen1.5-110B-Chat'\n | 'Qwen/Qwen1.5-14B-Chat'\n | 'Qwen/Qwen1.5-32B-Chat'\n | 'Qwen/Qwen1.5-4B-Chat'\n | 'Qwen/Qwen1.5-72B-Chat'\n | 'Qwen/Qwen1.5-7B-Chat'\n | 'Qwen/Qwen2-72B-Instruct'\n | 'Snowflake/snowflake-arctic-instruct'\n | 'Undi95/ReMM-SLERP-L2-13B'\n | 'Undi95/Toppy-M-7B'\n | 'WizardLM/WizardLM-13B-V1.2'\n | 'allenai/OLMo-7B'\n | 'allenai/OLMo-7B-Instruct'\n | 'allenai/OLMo-7B-Twin-2T'\n | 'codellama/CodeLlama-13b-Instruct-hf'\n | 'codellama/CodeLlama-34b-Instruct-hf'\n | 'codellama/CodeLlama-70b-Instruct-hf'\n | 'codellama/CodeLlama-7b-Instruct-hf'\n | 'cognitivecomputations/dolphin-2.5-mixtral-8x7b'\n | 'databricks/dbrx-instruct'\n | 'deepseek-ai/deepseek-coder-33b-instruct'\n | 'deepseek-ai/deepseek-llm-67b-chat'\n | 'garage-bAInd/Platypus2-70B-instruct'\n | 'google/gemma-2-27b-it'\n | 'google/gemma-2-9b-it'\n | 'google/gemma-2b-it'\n | 'google/gemma-7b-it'\n | 'lmsys/vicuna-13b-v1.5'\n | 'lmsys/vicuna-7b-v1.5'\n | 'meta-llama/Llama-2-13b-chat-hf'\n | 'meta-llama/Llama-2-70b-chat-hf'\n | 'meta-llama/Llama-2-7b-chat-hf'\n | 'meta-llama/Llama-3-70b-chat-hf'\n | 'meta-llama/Llama-3-8b-chat-hf'\n | 'meta-llama/Meta-Llama-3-70B-Instruct-Lite'\n | 'meta-llama/Meta-Llama-3-70B-Instruct-Turbo'\n | 'meta-llama/Meta-Llama-3-8B-Instruct-Lite'\n | 'meta-llama/Meta-Llama-3-8B-Instruct-Turbo'\n | 'meta-llama/Meta-Llama-3.1-405B-Instruct-Turbo'\n | 'meta-llama/Meta-Llama-3.1-70B-Instruct-Turbo'\n | 'meta-llama/Meta-Llama-3.1-8B-Instruct-Turbo'\n | 'meta-llama/Llama-3.3-70B-Instruct-Turbo'\n | 'mistralai/Mistral-7B-Instruct-v0.1'\n | 'mistralai/Mistral-7B-Instruct-v0.2'\n | 'mistralai/Mistral-7B-Instruct-v0.3'\n | 'mistralai/Mixtral-8x22B-Instruct-v0.1'\n | 'mistralai/Mixtral-8x7B-Instruct-v0.1'\n | 'openchat/openchat-3.5-1210'\n | 'snorkelai/Snorkel-Mistral-PairRM-DPO'\n | 'teknium/OpenHermes-2-Mistral-7B'\n | 'teknium/OpenHermes-2p5-Mistral-7B'\n | 'togethercomputer/Llama-2-7B-32K-Instruct'\n | 'togethercomputer/RedPajama-INCITE-7B-Chat'\n | 'togethercomputer/RedPajama-INCITE-Chat-3B-v1'\n | 'togethercomputer/StripedHyena-Nous-7B'\n | 'togethercomputer/alpaca-7b'\n | 'upstage/SOLAR-10.7B-Instruct-v1.0'\n | 'zero-one-ai/Yi-34B-Chat';\n\nexport type OctoChatModels =\n | 'meta-llama-3-70b-instruct'\n | 'meta-llama-3.1-405b-instruct'\n | 'meta-llama-3.1-70b-instruct'\n | 'meta-llama-3.1-8b-instruct'\n | 'mistral-7b-instruct'\n | 'mixtral-8x7b-instruct'\n | 'wizardlm-2-8x22bllamaguard-2-7b';\n\nexport type XAIChatModels =\n | 'grok-3'\n | 'grok-3-fast'\n | 'grok-3-mini'\n | 'grok-3-mini-fast'\n | 'grok-2-vision-1212'\n | 'grok-2-image-1212'\n | 'grok-2-1212';\n\nexport type MetaChatModels =\n | 'Llama-4-Scout-17B-16E-Instruct-FP8'\n | 'Llama-4-Maverick-17B-128E-Instruct-FP8'\n | 'Llama-3.3-70B-Instruct'\n | 'Llama-3.3-8B-Instruct';\n\nexport function supportsReasoningEffort(model: ChatModels | string): boolean {\n return [\n 'gpt-5.4',\n 'gpt-5.
|
|
1
|
+
{"version":3,"sources":["../src/models.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2024 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\n\nexport type ChatModels =\n | 'gpt-5.4'\n | 'gpt-5.4-mini'\n | 'gpt-5.3-chat-latest'\n | 'gpt-5.2'\n | 'gpt-5.2-chat-latest'\n | 'gpt-5.1'\n | 'gpt-5.1-chat-latest'\n | 'gpt-5'\n | 'gpt-5-mini'\n | 'gpt-5-nano'\n | 'gpt-4.1'\n | 'gpt-4.1-mini'\n | 'gpt-4.1-nano'\n | 'gpt-4o'\n | 'gpt-4o-2024-05-13'\n | 'gpt-4o-mini'\n | 'gpt-4o-mini-2024-07-18'\n | 'gpt-4-turbo'\n | 'gpt-4-turbo-2024-04-09'\n | 'gpt-4-turbo-preview'\n | 'gpt-4-0125-preview'\n | 'gpt-4-1106-preview'\n | 'gpt-4-vision-preview'\n | 'gpt-4-1106-vision-preview'\n | 'gpt-4'\n | 'gpt-4-0314'\n | 'gpt-4-0613'\n | 'gpt-4-32k'\n | 'gpt-4-32k-0314'\n | 'gpt-4-32k-0613'\n | 'gpt-3.5-turbo'\n | 'gpt-3.5-turbo-16k'\n | 'gpt-3.5-turbo-0301'\n | 'gpt-3.5-turbo-0613'\n | 'gpt-3.5-turbo-1106'\n | 'gpt-3.5-turbo-16k-0613';\n\nexport type WhisperModels = 'whisper-1';\n\nexport type TTSModels = 'tts-1' | 'tts-1-hd' | 'gpt-4o-mini-tts';\n\nexport type TTSVoices =\n | 'alloy'\n | 'ash'\n | 'ballad'\n | 'coral'\n | 'echo'\n | 'fable'\n | 'nova'\n | 'onyx'\n | 'sage'\n | 'shimmer';\n\nexport type DalleModels = 'dall-e-2' | 'dall-e-3';\n\nexport type EmbeddingModels =\n | 'text-embedding-ada-002'\n | 'text-embedding-3-small'\n | 'text-embedding-3-large';\n\nexport type AssistantTools = 'code_interpreter' | 'file_search' | 'function';\n\nexport type VertexModels =\n | 'google/gemini-2.0-flash-exp'\n | 'google/gemini-1.5-flash'\n | 'google/gemini-1.5-pro'\n | 'google/gemini-1.0-pro-vision'\n | 'google/gemini-1.0-pro-vision-001'\n | 'google/gemini-1.0-pro-002'\n | 'google/gemini-1.0-pro-001'\n | 'google/gemini-1.0-pro';\n\n// adapters for OpenAI-compatible LLMs, TTSs, STTs\n\nexport type TelnyxChatModels =\n | 'meta-llama/Meta-Llama-3.1-8B-Instruct'\n | 'meta-llama/Meta-Llama-3.1-70B-Instruct';\n\nexport type CerebrasChatModels =\n | 'llama3.1-8b'\n | 'llama-3.3-70b'\n | 'llama-4-scout-17b-16e-instruct'\n | 'llama-4-maverick-17b-128e-instruct'\n | 'qwen-3-32b'\n | 'qwen-3-235b-a22b-instruct-2507'\n | 'qwen-3-235b-a22b-thinking-2507'\n | 'qwen-3-coder-480b'\n | 'gpt-oss-120b';\n\nexport type PerplexityChatModels =\n | 'llama-3.1-sonar-small-128k-online'\n | 'llama-3.1-sonar-small-128k-chat'\n | 'llama-3.1-sonar-large-128k-online'\n | 'llama-3.1-sonar-large-128k-chat'\n | 'llama-3.1-8b-instruct'\n | 'llama-3.1-70b-instruct';\n\nexport type GroqChatModels =\n | 'llama-3.1-8b-instant'\n | 'llama-3.3-70b-versatile'\n | 'openai/gpt-oss-120b'\n | 'openai/gpt-oss-20b';\n\nexport type GroqAudioModels = 'whisper-large-v3' | 'whisper-large-v3-turbo';\n\nexport type DeepSeekChatModels = 'deepseek-coder' | 'deepseek-chat';\n\nexport type TogetherChatModels =\n | 'Austism/chronos-hermes-13b'\n | 'Gryphe/MythoMax-L2-13b'\n | 'NousResearch/Nous-Capybara-7B-V1p9'\n | 'NousResearch/Nous-Hermes-2-Mistral-7B-DPO'\n | 'NousResearch/Nous-Hermes-2-Mixtral-8x7B-DPO'\n | 'NousResearch/Nous-Hermes-2-Mixtral-8x7B-SFT'\n | 'NousResearch/Nous-Hermes-2-Yi-34B'\n | 'NousResearch/Nous-Hermes-Llama2-13b'\n | 'NousResearch/Nous-Hermes-llama-2-7b'\n | 'Open-Orca/Mistral-7B-OpenOrca'\n | 'Qwen/Qwen1.5-0.5B-Chat'\n | 'Qwen/Qwen1.5-1.8B-Chat'\n | 'Qwen/Qwen1.5-110B-Chat'\n | 'Qwen/Qwen1.5-14B-Chat'\n | 'Qwen/Qwen1.5-32B-Chat'\n | 'Qwen/Qwen1.5-4B-Chat'\n | 'Qwen/Qwen1.5-72B-Chat'\n | 'Qwen/Qwen1.5-7B-Chat'\n | 'Qwen/Qwen2-72B-Instruct'\n | 'Snowflake/snowflake-arctic-instruct'\n | 'Undi95/ReMM-SLERP-L2-13B'\n | 'Undi95/Toppy-M-7B'\n | 'WizardLM/WizardLM-13B-V1.2'\n | 'allenai/OLMo-7B'\n | 'allenai/OLMo-7B-Instruct'\n | 'allenai/OLMo-7B-Twin-2T'\n | 'codellama/CodeLlama-13b-Instruct-hf'\n | 'codellama/CodeLlama-34b-Instruct-hf'\n | 'codellama/CodeLlama-70b-Instruct-hf'\n | 'codellama/CodeLlama-7b-Instruct-hf'\n | 'cognitivecomputations/dolphin-2.5-mixtral-8x7b'\n | 'databricks/dbrx-instruct'\n | 'deepseek-ai/deepseek-coder-33b-instruct'\n | 'deepseek-ai/deepseek-llm-67b-chat'\n | 'garage-bAInd/Platypus2-70B-instruct'\n | 'google/gemma-2-27b-it'\n | 'google/gemma-2-9b-it'\n | 'google/gemma-2b-it'\n | 'google/gemma-7b-it'\n | 'lmsys/vicuna-13b-v1.5'\n | 'lmsys/vicuna-7b-v1.5'\n | 'meta-llama/Llama-2-13b-chat-hf'\n | 'meta-llama/Llama-2-70b-chat-hf'\n | 'meta-llama/Llama-2-7b-chat-hf'\n | 'meta-llama/Llama-3-70b-chat-hf'\n | 'meta-llama/Llama-3-8b-chat-hf'\n | 'meta-llama/Meta-Llama-3-70B-Instruct-Lite'\n | 'meta-llama/Meta-Llama-3-70B-Instruct-Turbo'\n | 'meta-llama/Meta-Llama-3-8B-Instruct-Lite'\n | 'meta-llama/Meta-Llama-3-8B-Instruct-Turbo'\n | 'meta-llama/Meta-Llama-3.1-405B-Instruct-Turbo'\n | 'meta-llama/Meta-Llama-3.1-70B-Instruct-Turbo'\n | 'meta-llama/Meta-Llama-3.1-8B-Instruct-Turbo'\n | 'meta-llama/Llama-3.3-70B-Instruct-Turbo'\n | 'mistralai/Mistral-7B-Instruct-v0.1'\n | 'mistralai/Mistral-7B-Instruct-v0.2'\n | 'mistralai/Mistral-7B-Instruct-v0.3'\n | 'mistralai/Mixtral-8x22B-Instruct-v0.1'\n | 'mistralai/Mixtral-8x7B-Instruct-v0.1'\n | 'openchat/openchat-3.5-1210'\n | 'snorkelai/Snorkel-Mistral-PairRM-DPO'\n | 'teknium/OpenHermes-2-Mistral-7B'\n | 'teknium/OpenHermes-2p5-Mistral-7B'\n | 'togethercomputer/Llama-2-7B-32K-Instruct'\n | 'togethercomputer/RedPajama-INCITE-7B-Chat'\n | 'togethercomputer/RedPajama-INCITE-Chat-3B-v1'\n | 'togethercomputer/StripedHyena-Nous-7B'\n | 'togethercomputer/alpaca-7b'\n | 'upstage/SOLAR-10.7B-Instruct-v1.0'\n | 'zero-one-ai/Yi-34B-Chat';\n\nexport type OctoChatModels =\n | 'meta-llama-3-70b-instruct'\n | 'meta-llama-3.1-405b-instruct'\n | 'meta-llama-3.1-70b-instruct'\n | 'meta-llama-3.1-8b-instruct'\n | 'mistral-7b-instruct'\n | 'mixtral-8x7b-instruct'\n | 'wizardlm-2-8x22bllamaguard-2-7b';\n\nexport type XAIChatModels =\n | 'grok-3'\n | 'grok-3-fast'\n | 'grok-3-mini'\n | 'grok-3-mini-fast'\n | 'grok-2-vision-1212'\n | 'grok-2-image-1212'\n | 'grok-2-1212';\n\nexport type MetaChatModels =\n | 'Llama-4-Scout-17B-16E-Instruct-FP8'\n | 'Llama-4-Maverick-17B-128E-Instruct-FP8'\n | 'Llama-3.3-70B-Instruct'\n | 'Llama-3.3-8B-Instruct';\n\nexport type ReasoningEffort = 'none' | 'minimal' | 'low' | 'medium' | 'high';\n\nexport type Reasoning = { effort?: ReasoningEffort | null; [key: string]: unknown };\n\nexport function supportsReasoningEffort(model: ChatModels | string): boolean {\n return [\n 'gpt-5.4',\n 'gpt-5.4-mini',\n 'gpt-5.2',\n 'gpt-5.1',\n 'gpt-5',\n 'gpt-5-mini',\n 'gpt-5-nano',\n ].includes(model);\n}\n\nexport function defaultReasoningEffort(model: ChatModels | string): ReasoningEffort | undefined {\n if (!supportsReasoningEffort(model)) {\n return undefined;\n }\n\n if (['gpt-5.1', 'gpt-5.2', 'gpt-5.4', 'gpt-5.4-mini'].includes(model)) {\n return 'none';\n }\n\n return 'minimal';\n}\n"],"mappings":"AAoNO,SAAS,wBAAwB,OAAqC;AAC3E,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,EAAE,SAAS,KAAK;AAClB;AAEO,SAAS,uBAAuB,OAAyD;AAC9F,MAAI,CAAC,wBAAwB,KAAK,GAAG;AACnC,WAAO;AAAA,EACT;AAEA,MAAI,CAAC,WAAW,WAAW,WAAW,cAAc,EAAE,SAAS,KAAK,GAAG;AACrE,WAAO;AAAA,EACT;AAEA,SAAO;AACT;","names":[]}
|
|
@@ -168,7 +168,7 @@ class RealtimeModel extends import_agents.llm.RealtimeModel {
|
|
|
168
168
|
* @param apiKey - Azure OpenAI API key. If undefined, will attempt to read from the environment variable AZURE_OPENAI_API_KEY.
|
|
169
169
|
* @param entraToken - Azure Entra authentication token. Required if not using API key authentication.
|
|
170
170
|
* @param baseURL - Base URL for the API endpoint. If undefined, constructed from the azure_endpoint.
|
|
171
|
-
* @param voice - Voice setting for audio outputs. Defaults to "
|
|
171
|
+
* @param voice - Voice setting for audio outputs. Defaults to "marin".
|
|
172
172
|
* @param inputAudioTranscription - Options for transcribing input audio. Defaults to @see DEFAULT_INPUT_AUDIO_TRANSCRIPTION.
|
|
173
173
|
* @param inputAudioNoiseReduction - Options for noise reduction. Defaults to undefined.
|
|
174
174
|
* @param turnDetection - Options for server-based voice activity detection (VAD). Defaults to @see DEFAULT_SERVER_VAD_OPTIONS.
|
|
@@ -186,7 +186,7 @@ class RealtimeModel extends import_agents.llm.RealtimeModel {
|
|
|
186
186
|
apiKey,
|
|
187
187
|
entraToken,
|
|
188
188
|
baseURL,
|
|
189
|
-
voice = "
|
|
189
|
+
voice = "marin",
|
|
190
190
|
temperature,
|
|
191
191
|
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
192
192
|
inputAudioTranscription = AZURE_DEFAULT_INPUT_AUDIO_TRANSCRIPTION,
|
|
@@ -286,7 +286,7 @@ function processBaseURL({
|
|
|
286
286
|
return url.toString();
|
|
287
287
|
}
|
|
288
288
|
class RealtimeSession extends import_agents.llm.RealtimeSession {
|
|
289
|
-
_tools =
|
|
289
|
+
_tools = import_agents.llm.ToolContext.empty();
|
|
290
290
|
remoteChatCtx = new import_agents.llm.RemoteChatContext();
|
|
291
291
|
messageChannel = new import_agents.Queue();
|
|
292
292
|
inputResampler;
|
|
@@ -383,7 +383,7 @@ class RealtimeSession extends import_agents.llm.RealtimeSession {
|
|
|
383
383
|
return this.remoteChatCtx.toChatCtx();
|
|
384
384
|
}
|
|
385
385
|
get tools() {
|
|
386
|
-
return
|
|
386
|
+
return this._tools.copy();
|
|
387
387
|
}
|
|
388
388
|
async updateChatCtx(_chatCtx) {
|
|
389
389
|
const unlock = await this.updateChatCtxLock.lock();
|
|
@@ -521,34 +521,31 @@ class RealtimeSession extends import_agents.llm.RealtimeSession {
|
|
|
521
521
|
throw new Error("Tools are missing in the session update event");
|
|
522
522
|
}
|
|
523
523
|
const retainedToolNames = new Set(ev.session.tools.map((tool) => tool.name));
|
|
524
|
-
const
|
|
525
|
-
|
|
526
|
-
([name, tool]) => import_agents.llm.isFunctionTool(tool) && retainedToolNames.has(name)
|
|
527
|
-
)
|
|
524
|
+
const retainedEntries = _tools.tools.filter(
|
|
525
|
+
(entry) => !import_agents.llm.isFunctionTool(entry) || retainedToolNames.has(entry.name)
|
|
528
526
|
);
|
|
529
|
-
this._tools =
|
|
527
|
+
this._tools = new import_agents.llm.ToolContext(retainedEntries);
|
|
530
528
|
unlock();
|
|
531
529
|
}
|
|
532
530
|
createToolsUpdateEvent(_tools) {
|
|
533
531
|
const oaiTools = [];
|
|
534
|
-
for (const
|
|
535
|
-
if (!import_agents.llm.isFunctionTool(
|
|
536
|
-
this.#logger.error({ name, tool }, "OpenAI Realtime API doesn't support this tool type");
|
|
537
|
-
continue;
|
|
538
|
-
}
|
|
539
|
-
const { parameters: toolParameters, description } = tool;
|
|
532
|
+
for (const t of _tools.flatten()) {
|
|
533
|
+
if (!import_agents.llm.isFunctionTool(t)) continue;
|
|
540
534
|
try {
|
|
541
535
|
const parameters = import_agents.llm.toJsonSchema(
|
|
542
|
-
|
|
536
|
+
t.parameters
|
|
543
537
|
);
|
|
544
538
|
oaiTools.push({
|
|
545
|
-
name,
|
|
546
|
-
description,
|
|
539
|
+
name: t.name,
|
|
540
|
+
description: t.description,
|
|
547
541
|
parameters,
|
|
548
542
|
type: "function"
|
|
549
543
|
});
|
|
550
544
|
} catch (e) {
|
|
551
|
-
this.#logger.error(
|
|
545
|
+
this.#logger.error(
|
|
546
|
+
{ name: t.name, tool: t },
|
|
547
|
+
"OpenAI Realtime API doesn't support this tool type"
|
|
548
|
+
);
|
|
552
549
|
continue;
|
|
553
550
|
}
|
|
554
551
|
}
|
|
@@ -622,7 +619,15 @@ class RealtimeSession extends import_agents.llm.RealtimeSession {
|
|
|
622
619
|
}
|
|
623
620
|
async generateReply(instructions, options = {}) {
|
|
624
621
|
var _a, _b, _c;
|
|
625
|
-
|
|
622
|
+
let responseInstructions = instructions;
|
|
623
|
+
if (instructions && this.instructions) {
|
|
624
|
+
responseInstructions = `${this.instructions}
|
|
625
|
+
${instructions}`;
|
|
626
|
+
}
|
|
627
|
+
const handle = this.createResponse({
|
|
628
|
+
instructions: responseInstructions,
|
|
629
|
+
userInitiated: true
|
|
630
|
+
});
|
|
626
631
|
this.textModeRecoveryRetries = 0;
|
|
627
632
|
const onAbort = () => {
|
|
628
633
|
var _a2;
|
|
@@ -788,7 +793,7 @@ class RealtimeSession extends import_agents.llm.RealtimeSession {
|
|
|
788
793
|
this.inputTranscriptAccumulators.clear();
|
|
789
794
|
const events = [];
|
|
790
795
|
events.push(this.createSessionUpdateEvent());
|
|
791
|
-
if (Object.keys(this._tools).length > 0) {
|
|
796
|
+
if (Object.keys(this._tools.functionTools).length > 0) {
|
|
792
797
|
events.push(this.createToolsUpdateEvent(this._tools));
|
|
793
798
|
}
|
|
794
799
|
const chatCtx = this.chatCtx.copy({
|