@livekit/agents-plugin-openai 1.4.11 → 1.5.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.
- 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 +8 -2
- 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 +8 -2
- 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 +24 -19
- package/dist/realtime/realtime_model.cjs.map +1 -1
- package/dist/realtime/realtime_model.d.cts +1 -1
- package/dist/realtime/realtime_model.d.ts +1 -1
- package/dist/realtime/realtime_model.d.ts.map +1 -1
- package/dist/realtime/realtime_model.js +24 -19
- 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 +15 -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 +15 -18
- package/dist/responses/llm.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/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 +16 -3
- package/src/models.ts +18 -3
- package/src/realtime/realtime_model.test.ts +38 -0
- package/src/realtime/realtime_model.ts +29 -19
- package/src/responses/llm.ts +27 -23
- package/src/tool_utils.test.ts +84 -0
- package/src/tool_utils.ts +46 -0
- package/src/tools.ts +166 -0
- package/src/ws/llm.ts +25 -24
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":[]}
|
|
@@ -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({
|