@ai-sdk/gateway 4.0.0-canary.86 → 4.0.0-canary.88
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/CHANGELOG.md +12 -0
- package/dist/index.d.ts +24 -4
- package/dist/index.js +315 -58
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/gateway-language-model-settings.ts +1 -0
- package/src/gateway-model-entry.ts +2 -0
- package/src/gateway-provider.ts +50 -0
- package/src/gateway-speech-model-settings.ts +1 -0
- package/src/gateway-speech-model.ts +140 -0
- package/src/gateway-transcription-model-settings.ts +1 -0
- package/src/gateway-transcription-model.ts +150 -0
- package/src/index.ts +2 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @ai-sdk/gateway
|
|
2
2
|
|
|
3
|
+
## 4.0.0-canary.88
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- accaca0: chore(provider/gateway): update gateway model settings files
|
|
8
|
+
|
|
9
|
+
## 4.0.0-canary.87
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- bf837fe: feat(provider/gateway): add speech and transcription model support
|
|
14
|
+
|
|
3
15
|
## 4.0.0-canary.86
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -1,14 +1,18 @@
|
|
|
1
|
-
import { LanguageModelV4, ProviderV4, EmbeddingModelV4, ImageModelV4, Experimental_VideoModelV4, RerankingModelV4, TypeValidationError } from '@ai-sdk/provider';
|
|
1
|
+
import { LanguageModelV4, ProviderV4, EmbeddingModelV4, ImageModelV4, Experimental_VideoModelV4, RerankingModelV4, SpeechModelV4, TranscriptionModelV4, TypeValidationError } from '@ai-sdk/provider';
|
|
2
2
|
import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
|
|
3
3
|
import { FetchFunction, InferSchema } from '@ai-sdk/provider-utils';
|
|
4
4
|
|
|
5
|
-
type GatewayModelId = 'alibaba/qwen-3-14b' | 'alibaba/qwen-3-235b' | 'alibaba/qwen-3-30b' | 'alibaba/qwen-3-32b' | 'alibaba/qwen-3.6-max-preview' | 'alibaba/qwen3-235b-a22b-thinking' | 'alibaba/qwen3-coder' | 'alibaba/qwen3-coder-30b-a3b' | 'alibaba/qwen3-coder-next' | 'alibaba/qwen3-coder-plus' | 'alibaba/qwen3-max' | 'alibaba/qwen3-max-preview' | 'alibaba/qwen3-max-thinking' | 'alibaba/qwen3-next-80b-a3b-instruct' | 'alibaba/qwen3-next-80b-a3b-thinking' | 'alibaba/qwen3-vl-235b-a22b-instruct' | 'alibaba/qwen3-vl-instruct' | 'alibaba/qwen3-vl-thinking' | 'alibaba/qwen3.5-flash' | 'alibaba/qwen3.5-plus' | 'alibaba/qwen3.6-27b' | 'alibaba/qwen3.6-plus' | 'amazon/nova-2-lite' | 'amazon/nova-lite' | 'amazon/nova-micro' | 'amazon/nova-pro' | 'anthropic/claude-3-haiku' | 'anthropic/claude-3.5-haiku' | 'anthropic/claude-haiku-4.5' | 'anthropic/claude-opus-4' | 'anthropic/claude-opus-4.1' | 'anthropic/claude-opus-4.5' | 'anthropic/claude-opus-4.6' | 'anthropic/claude-opus-4.7' | 'anthropic/claude-sonnet-4' | 'anthropic/claude-sonnet-4.5' | 'anthropic/claude-sonnet-4.6' | 'arcee-ai/trinity-large-preview' | 'arcee-ai/trinity-large-thinking' | 'arcee-ai/trinity-mini' | 'bytedance/seed-1.6' | 'bytedance/seed-1.8' | 'cohere/command-a' | 'deepseek/deepseek-r1' | 'deepseek/deepseek-v3' | 'deepseek/deepseek-v3.1' | 'deepseek/deepseek-v3.1-terminus' | 'deepseek/deepseek-v3.2' | 'deepseek/deepseek-v3.2-thinking' | 'deepseek/deepseek-v4-flash' | 'deepseek/deepseek-v4-pro' | 'google/gemini-2.0-flash' | 'google/gemini-2.0-flash-lite' | 'google/gemini-2.5-flash' | 'google/gemini-2.5-flash-image' | 'google/gemini-2.5-flash-lite' | 'google/gemini-2.5-pro' | 'google/gemini-3-flash' | 'google/gemini-3-pro-image' | 'google/gemini-3-pro-preview' | 'google/gemini-3.1-flash-image-preview' | 'google/gemini-3.1-flash-lite' | 'google/gemini-3.1-flash-lite-preview' | 'google/gemini-3.1-pro-preview' | 'google/gemini-3.5-flash' | 'google/gemma-4-26b-a4b-it' | 'google/gemma-4-31b-it' | 'inception/mercury-2' | 'inception/mercury-coder-small' | 'interfaze/interfaze-beta' | 'kwaipilot/kat-coder-pro-v1' | 'kwaipilot/kat-coder-pro-v2' | 'meituan/longcat-flash-chat' | 'meituan/longcat-flash-thinking-2601' | 'meta/llama-3.1-70b' | 'meta/llama-3.1-8b' | 'meta/llama-3.2-11b' | 'meta/llama-3.2-1b' | 'meta/llama-3.2-3b' | 'meta/llama-3.2-90b' | 'meta/llama-3.3-70b' | 'meta/llama-4-maverick' | 'meta/llama-4-scout' | 'minimax/minimax-m2' | 'minimax/minimax-m2.1' | 'minimax/minimax-m2.1-lightning' | 'minimax/minimax-m2.5' | 'minimax/minimax-m2.5-highspeed' | 'minimax/minimax-m2.7' | 'minimax/minimax-m2.7-highspeed' | 'mistral/codestral' | 'mistral/devstral-2' | 'mistral/devstral-small' | 'mistral/devstral-small-2' | 'mistral/magistral-medium' | 'mistral/magistral-small' | 'mistral/ministral-14b' | 'mistral/ministral-3b' | 'mistral/ministral-8b' | 'mistral/mistral-large-3' | 'mistral/mistral-medium' | 'mistral/mistral-nemo' | 'mistral/mistral-small' | 'mistral/pixtral-12b' | 'mistral/pixtral-large' | 'moonshotai/kimi-k2' | 'moonshotai/kimi-k2-thinking' | 'moonshotai/kimi-k2-thinking-turbo' | 'moonshotai/kimi-k2-turbo' | 'moonshotai/kimi-k2.5' | 'moonshotai/kimi-k2.6' | 'morph/morph-v3-fast' | 'morph/morph-v3-large' | 'nvidia/nemotron-3-nano-30b-a3b' | 'nvidia/nemotron-3-super-120b-a12b' | 'nvidia/nemotron-nano-12b-v2-vl' | 'nvidia/nemotron-nano-9b-v2' | 'openai/gpt-3.5-turbo' | 'openai/gpt-3.5-turbo-instruct' | 'openai/gpt-4-turbo' | 'openai/gpt-4.1' | 'openai/gpt-4.1-mini' | 'openai/gpt-4.1-nano' | 'openai/gpt-4o' | 'openai/gpt-4o-mini' | 'openai/gpt-4o-mini-search-preview' | 'openai/gpt-5' | 'openai/gpt-5-chat' | 'openai/gpt-5-codex' | 'openai/gpt-5-mini' | 'openai/gpt-5-nano' | 'openai/gpt-5-pro' | 'openai/gpt-5.1-codex' | 'openai/gpt-5.1-codex-max' | 'openai/gpt-5.1-codex-mini' | 'openai/gpt-5.1-instant' | 'openai/gpt-5.1-thinking' | 'openai/gpt-5.2' | 'openai/gpt-5.2-chat' | 'openai/gpt-5.2-codex' | 'openai/gpt-5.2-pro' | 'openai/gpt-5.3-chat' | 'openai/gpt-5.3-codex' | 'openai/gpt-5.4' | 'openai/gpt-5.4-mini' | 'openai/gpt-5.4-nano' | 'openai/gpt-5.4-pro' | 'openai/gpt-5.5' | 'openai/gpt-5.5-pro' | 'openai/gpt-oss-120b' | 'openai/gpt-oss-20b' | 'openai/gpt-oss-safeguard-20b' | 'openai/o1' | 'openai/o3' | 'openai/o3-deep-research' | 'openai/o3-mini' | 'openai/o3-pro' | 'openai/o4-mini' | 'perplexity/sonar' | 'perplexity/sonar-pro' | 'perplexity/sonar-reasoning-pro' | 'xai/grok-4.1-fast-non-reasoning' | 'xai/grok-4.1-fast-reasoning' | 'xai/grok-4.20-multi-agent' | 'xai/grok-4.20-multi-agent-beta' | 'xai/grok-4.20-non-reasoning' | 'xai/grok-4.20-non-reasoning-beta' | 'xai/grok-4.20-reasoning' | 'xai/grok-4.20-reasoning-beta' | 'xai/grok-4.3' | 'xiaomi/mimo-v2-flash' | 'xiaomi/mimo-v2-pro' | 'xiaomi/mimo-v2.5' | 'xiaomi/mimo-v2.5-pro' | 'zai/glm-4.5' | 'zai/glm-4.5-air' | 'zai/glm-4.5v' | 'zai/glm-4.6' | 'zai/glm-4.6v' | 'zai/glm-4.6v-flash' | 'zai/glm-4.7' | 'zai/glm-4.7-flash' | 'zai/glm-4.7-flashx' | 'zai/glm-5' | 'zai/glm-5-turbo' | 'zai/glm-5.1' | 'zai/glm-5v-turbo' | (string & {});
|
|
5
|
+
type GatewayModelId = 'alibaba/qwen-3-14b' | 'alibaba/qwen-3-235b' | 'alibaba/qwen-3-30b' | 'alibaba/qwen-3-32b' | 'alibaba/qwen-3.6-max-preview' | 'alibaba/qwen3-235b-a22b-thinking' | 'alibaba/qwen3-coder' | 'alibaba/qwen3-coder-30b-a3b' | 'alibaba/qwen3-coder-next' | 'alibaba/qwen3-coder-plus' | 'alibaba/qwen3-max' | 'alibaba/qwen3-max-preview' | 'alibaba/qwen3-max-thinking' | 'alibaba/qwen3-next-80b-a3b-instruct' | 'alibaba/qwen3-next-80b-a3b-thinking' | 'alibaba/qwen3-vl-235b-a22b-instruct' | 'alibaba/qwen3-vl-instruct' | 'alibaba/qwen3-vl-thinking' | 'alibaba/qwen3.5-flash' | 'alibaba/qwen3.5-plus' | 'alibaba/qwen3.6-27b' | 'alibaba/qwen3.6-plus' | 'amazon/nova-2-lite' | 'amazon/nova-lite' | 'amazon/nova-micro' | 'amazon/nova-pro' | 'anthropic/claude-3-haiku' | 'anthropic/claude-3.5-haiku' | 'anthropic/claude-haiku-4.5' | 'anthropic/claude-opus-4' | 'anthropic/claude-opus-4.1' | 'anthropic/claude-opus-4.5' | 'anthropic/claude-opus-4.6' | 'anthropic/claude-opus-4.7' | 'anthropic/claude-sonnet-4' | 'anthropic/claude-sonnet-4.5' | 'anthropic/claude-sonnet-4.6' | 'arcee-ai/trinity-large-preview' | 'arcee-ai/trinity-large-thinking' | 'arcee-ai/trinity-mini' | 'bytedance/seed-1.6' | 'bytedance/seed-1.8' | 'cohere/command-a' | 'deepseek/deepseek-r1' | 'deepseek/deepseek-v3' | 'deepseek/deepseek-v3.1' | 'deepseek/deepseek-v3.1-terminus' | 'deepseek/deepseek-v3.2' | 'deepseek/deepseek-v3.2-thinking' | 'deepseek/deepseek-v4-flash' | 'deepseek/deepseek-v4-pro' | 'google/gemini-2.0-flash' | 'google/gemini-2.0-flash-lite' | 'google/gemini-2.5-flash' | 'google/gemini-2.5-flash-image' | 'google/gemini-2.5-flash-lite' | 'google/gemini-2.5-pro' | 'google/gemini-3-flash' | 'google/gemini-3-pro-image' | 'google/gemini-3-pro-preview' | 'google/gemini-3.1-flash-image-preview' | 'google/gemini-3.1-flash-lite' | 'google/gemini-3.1-flash-lite-preview' | 'google/gemini-3.1-pro-preview' | 'google/gemini-3.5-flash' | 'google/gemma-4-26b-a4b-it' | 'google/gemma-4-31b-it' | 'inception/mercury-2' | 'inception/mercury-coder-small' | 'interfaze/interfaze-beta' | 'kwaipilot/kat-coder-pro-v1' | 'kwaipilot/kat-coder-pro-v2' | 'meituan/longcat-flash-chat' | 'meituan/longcat-flash-thinking-2601' | 'meta/llama-3.1-70b' | 'meta/llama-3.1-8b' | 'meta/llama-3.2-11b' | 'meta/llama-3.2-1b' | 'meta/llama-3.2-3b' | 'meta/llama-3.2-90b' | 'meta/llama-3.3-70b' | 'meta/llama-4-maverick' | 'meta/llama-4-scout' | 'minimax/minimax-m2' | 'minimax/minimax-m2.1' | 'minimax/minimax-m2.1-lightning' | 'minimax/minimax-m2.5' | 'minimax/minimax-m2.5-highspeed' | 'minimax/minimax-m2.7' | 'minimax/minimax-m2.7-highspeed' | 'mistral/codestral' | 'mistral/devstral-2' | 'mistral/devstral-small' | 'mistral/devstral-small-2' | 'mistral/magistral-medium' | 'mistral/magistral-small' | 'mistral/ministral-14b' | 'mistral/ministral-3b' | 'mistral/ministral-8b' | 'mistral/mistral-large-3' | 'mistral/mistral-medium' | 'mistral/mistral-medium-3.5' | 'mistral/mistral-nemo' | 'mistral/mistral-small' | 'mistral/pixtral-12b' | 'mistral/pixtral-large' | 'moonshotai/kimi-k2' | 'moonshotai/kimi-k2-thinking' | 'moonshotai/kimi-k2-thinking-turbo' | 'moonshotai/kimi-k2-turbo' | 'moonshotai/kimi-k2.5' | 'moonshotai/kimi-k2.6' | 'morph/morph-v3-fast' | 'morph/morph-v3-large' | 'nvidia/nemotron-3-nano-30b-a3b' | 'nvidia/nemotron-3-super-120b-a12b' | 'nvidia/nemotron-nano-12b-v2-vl' | 'nvidia/nemotron-nano-9b-v2' | 'openai/gpt-3.5-turbo' | 'openai/gpt-3.5-turbo-instruct' | 'openai/gpt-4-turbo' | 'openai/gpt-4.1' | 'openai/gpt-4.1-mini' | 'openai/gpt-4.1-nano' | 'openai/gpt-4o' | 'openai/gpt-4o-mini' | 'openai/gpt-4o-mini-search-preview' | 'openai/gpt-5' | 'openai/gpt-5-chat' | 'openai/gpt-5-codex' | 'openai/gpt-5-mini' | 'openai/gpt-5-nano' | 'openai/gpt-5-pro' | 'openai/gpt-5.1-codex' | 'openai/gpt-5.1-codex-max' | 'openai/gpt-5.1-codex-mini' | 'openai/gpt-5.1-instant' | 'openai/gpt-5.1-thinking' | 'openai/gpt-5.2' | 'openai/gpt-5.2-chat' | 'openai/gpt-5.2-codex' | 'openai/gpt-5.2-pro' | 'openai/gpt-5.3-chat' | 'openai/gpt-5.3-codex' | 'openai/gpt-5.4' | 'openai/gpt-5.4-mini' | 'openai/gpt-5.4-nano' | 'openai/gpt-5.4-pro' | 'openai/gpt-5.5' | 'openai/gpt-5.5-pro' | 'openai/gpt-oss-120b' | 'openai/gpt-oss-20b' | 'openai/gpt-oss-safeguard-20b' | 'openai/o1' | 'openai/o3' | 'openai/o3-deep-research' | 'openai/o3-mini' | 'openai/o3-pro' | 'openai/o4-mini' | 'perplexity/sonar' | 'perplexity/sonar-pro' | 'perplexity/sonar-reasoning-pro' | 'xai/grok-4.1-fast-non-reasoning' | 'xai/grok-4.1-fast-reasoning' | 'xai/grok-4.20-multi-agent' | 'xai/grok-4.20-multi-agent-beta' | 'xai/grok-4.20-non-reasoning' | 'xai/grok-4.20-non-reasoning-beta' | 'xai/grok-4.20-reasoning' | 'xai/grok-4.20-reasoning-beta' | 'xai/grok-4.3' | 'xiaomi/mimo-v2-flash' | 'xiaomi/mimo-v2-pro' | 'xiaomi/mimo-v2.5' | 'xiaomi/mimo-v2.5-pro' | 'zai/glm-4.5' | 'zai/glm-4.5-air' | 'zai/glm-4.5v' | 'zai/glm-4.6' | 'zai/glm-4.6v' | 'zai/glm-4.6v-flash' | 'zai/glm-4.7' | 'zai/glm-4.7-flash' | 'zai/glm-4.7-flashx' | 'zai/glm-5' | 'zai/glm-5-turbo' | 'zai/glm-5.1' | 'zai/glm-5v-turbo' | (string & {});
|
|
6
6
|
|
|
7
7
|
type GatewayRerankingModelId = 'cohere/rerank-v3.5' | 'cohere/rerank-v4-fast' | 'cohere/rerank-v4-pro' | 'voyage/rerank-2.5' | 'voyage/rerank-2.5-lite' | (string & {});
|
|
8
8
|
|
|
9
|
+
type GatewaySpeechModelId = string & {};
|
|
10
|
+
|
|
11
|
+
type GatewayTranscriptionModelId = string & {};
|
|
12
|
+
|
|
9
13
|
type GatewayVideoModelId = 'alibaba/wan-v2.5-t2v-preview' | 'alibaba/wan-v2.6-i2v' | 'alibaba/wan-v2.6-i2v-flash' | 'alibaba/wan-v2.6-r2v' | 'alibaba/wan-v2.6-r2v-flash' | 'alibaba/wan-v2.6-t2v' | 'bytedance/seedance-2.0' | 'bytedance/seedance-2.0-fast' | 'bytedance/seedance-v1.0-lite-i2v' | 'bytedance/seedance-v1.0-lite-t2v' | 'bytedance/seedance-v1.0-pro' | 'bytedance/seedance-v1.0-pro-fast' | 'bytedance/seedance-v1.5-pro' | 'google/veo-3.0-fast-generate-001' | 'google/veo-3.0-generate-001' | 'google/veo-3.1-fast-generate-001' | 'google/veo-3.1-generate-001' | 'klingai/kling-v2.5-turbo-i2v' | 'klingai/kling-v2.5-turbo-t2v' | 'klingai/kling-v2.6-i2v' | 'klingai/kling-v2.6-motion-control' | 'klingai/kling-v2.6-t2v' | 'klingai/kling-v3.0-i2v' | 'klingai/kling-v3.0-motion-control' | 'klingai/kling-v3.0-t2v' | 'xai/grok-imagine-video' | (string & {});
|
|
10
14
|
|
|
11
|
-
declare const KNOWN_MODEL_TYPES: readonly ["embedding", "image", "language", "reranking", "video"];
|
|
15
|
+
declare const KNOWN_MODEL_TYPES: readonly ["embedding", "image", "language", "reranking", "speech", "transcription", "video"];
|
|
12
16
|
type KnownModelType = (typeof KNOWN_MODEL_TYPES)[number];
|
|
13
17
|
interface GatewayLanguageModelEntry {
|
|
14
18
|
/**
|
|
@@ -519,6 +523,22 @@ interface GatewayProvider extends ProviderV4 {
|
|
|
519
523
|
* Creates a model for reranking documents.
|
|
520
524
|
*/
|
|
521
525
|
rerankingModel(modelId: GatewayRerankingModelId): RerankingModelV4;
|
|
526
|
+
/**
|
|
527
|
+
* Creates a model for text-to-speech generation.
|
|
528
|
+
*/
|
|
529
|
+
speech(modelId: GatewaySpeechModelId): SpeechModelV4;
|
|
530
|
+
/**
|
|
531
|
+
* Creates a model for text-to-speech generation.
|
|
532
|
+
*/
|
|
533
|
+
speechModel(modelId: GatewaySpeechModelId): SpeechModelV4;
|
|
534
|
+
/**
|
|
535
|
+
* Creates a model for audio transcription.
|
|
536
|
+
*/
|
|
537
|
+
transcription(modelId: GatewayTranscriptionModelId): TranscriptionModelV4;
|
|
538
|
+
/**
|
|
539
|
+
* Creates a model for audio transcription.
|
|
540
|
+
*/
|
|
541
|
+
transcriptionModel(modelId: GatewayTranscriptionModelId): TranscriptionModelV4;
|
|
522
542
|
/**
|
|
523
543
|
* Gateway-specific tools executed server-side.
|
|
524
544
|
*/
|
|
@@ -728,4 +748,4 @@ declare class GatewayResponseError extends GatewayError {
|
|
|
728
748
|
|
|
729
749
|
declare const VERSION: string;
|
|
730
750
|
|
|
731
|
-
export { GatewayAuthenticationError, type GatewayCreditsResponse, GatewayError, type GatewayErrorResponse, type GatewayGenerationInfo, type GatewayGenerationInfoParams, GatewayInternalServerError, GatewayInvalidRequestError, type GatewayLanguageModelEntry, type GatewayProviderOptions as GatewayLanguageModelOptions, type GatewayLanguageModelSpecification, type GatewayLanguageModelEntry as GatewayModelEntry, type GatewayModelId, GatewayModelNotFoundError, type GatewayProvider, type GatewayProviderOptions, type GatewayProviderSettings, GatewayRateLimitError, type GatewayRerankingModelId, GatewayResponseError, type GatewaySpendReportParams, type GatewaySpendReportResponse, type GatewaySpendReportRow, type GatewayVideoModelId, VERSION, createGateway, createGateway as createGatewayProvider, gateway };
|
|
751
|
+
export { GatewayAuthenticationError, type GatewayCreditsResponse, GatewayError, type GatewayErrorResponse, type GatewayGenerationInfo, type GatewayGenerationInfoParams, GatewayInternalServerError, GatewayInvalidRequestError, type GatewayLanguageModelEntry, type GatewayProviderOptions as GatewayLanguageModelOptions, type GatewayLanguageModelSpecification, type GatewayLanguageModelEntry as GatewayModelEntry, type GatewayModelId, GatewayModelNotFoundError, type GatewayProvider, type GatewayProviderOptions, type GatewayProviderSettings, GatewayRateLimitError, type GatewayRerankingModelId, GatewayResponseError, type GatewaySpeechModelId, type GatewaySpendReportParams, type GatewaySpendReportResponse, type GatewaySpendReportRow, type GatewayTranscriptionModelId, type GatewayVideoModelId, VERSION, createGateway, createGateway as createGatewayProvider, gateway };
|
package/dist/index.js
CHANGED
|
@@ -483,6 +483,8 @@ var KNOWN_MODEL_TYPES = [
|
|
|
483
483
|
"image",
|
|
484
484
|
"language",
|
|
485
485
|
"reranking",
|
|
486
|
+
"speech",
|
|
487
|
+
"transcription",
|
|
486
488
|
"video"
|
|
487
489
|
];
|
|
488
490
|
|
|
@@ -1520,43 +1522,276 @@ var gatewayRerankingResponseSchema = lazySchema8(
|
|
|
1520
1522
|
)
|
|
1521
1523
|
);
|
|
1522
1524
|
|
|
1525
|
+
// src/gateway-speech-model.ts
|
|
1526
|
+
import {
|
|
1527
|
+
combineHeaders as combineHeaders6,
|
|
1528
|
+
createJsonErrorResponseHandler as createJsonErrorResponseHandler9,
|
|
1529
|
+
createJsonResponseHandler as createJsonResponseHandler8,
|
|
1530
|
+
postJsonToApi as postJsonToApi6,
|
|
1531
|
+
resolve as resolve9
|
|
1532
|
+
} from "@ai-sdk/provider-utils";
|
|
1533
|
+
import { z as z12 } from "zod/v4";
|
|
1534
|
+
var GatewaySpeechModel = class {
|
|
1535
|
+
constructor(modelId, config) {
|
|
1536
|
+
this.modelId = modelId;
|
|
1537
|
+
this.config = config;
|
|
1538
|
+
this.specificationVersion = "v4";
|
|
1539
|
+
}
|
|
1540
|
+
get provider() {
|
|
1541
|
+
return this.config.provider;
|
|
1542
|
+
}
|
|
1543
|
+
async doGenerate({
|
|
1544
|
+
text,
|
|
1545
|
+
voice,
|
|
1546
|
+
outputFormat,
|
|
1547
|
+
instructions,
|
|
1548
|
+
speed,
|
|
1549
|
+
language,
|
|
1550
|
+
providerOptions,
|
|
1551
|
+
headers,
|
|
1552
|
+
abortSignal
|
|
1553
|
+
}) {
|
|
1554
|
+
var _a9;
|
|
1555
|
+
const resolvedHeaders = this.config.headers ? await resolve9(this.config.headers) : void 0;
|
|
1556
|
+
try {
|
|
1557
|
+
const {
|
|
1558
|
+
responseHeaders,
|
|
1559
|
+
value: responseBody,
|
|
1560
|
+
rawValue
|
|
1561
|
+
} = await postJsonToApi6({
|
|
1562
|
+
url: this.getUrl(),
|
|
1563
|
+
headers: combineHeaders6(
|
|
1564
|
+
resolvedHeaders,
|
|
1565
|
+
headers != null ? headers : {},
|
|
1566
|
+
this.getModelConfigHeaders(),
|
|
1567
|
+
await resolve9(this.config.o11yHeaders)
|
|
1568
|
+
),
|
|
1569
|
+
body: {
|
|
1570
|
+
text,
|
|
1571
|
+
...voice && { voice },
|
|
1572
|
+
...outputFormat && { outputFormat },
|
|
1573
|
+
...instructions && { instructions },
|
|
1574
|
+
...speed != null && { speed },
|
|
1575
|
+
...language && { language },
|
|
1576
|
+
...providerOptions && { providerOptions }
|
|
1577
|
+
},
|
|
1578
|
+
successfulResponseHandler: createJsonResponseHandler8(
|
|
1579
|
+
gatewaySpeechResponseSchema
|
|
1580
|
+
),
|
|
1581
|
+
failedResponseHandler: createJsonErrorResponseHandler9({
|
|
1582
|
+
errorSchema: z12.any(),
|
|
1583
|
+
errorToMessage: (data) => data
|
|
1584
|
+
}),
|
|
1585
|
+
...abortSignal && { abortSignal },
|
|
1586
|
+
fetch: this.config.fetch
|
|
1587
|
+
});
|
|
1588
|
+
return {
|
|
1589
|
+
audio: responseBody.audio,
|
|
1590
|
+
warnings: (_a9 = responseBody.warnings) != null ? _a9 : [],
|
|
1591
|
+
providerMetadata: responseBody.providerMetadata,
|
|
1592
|
+
response: {
|
|
1593
|
+
timestamp: /* @__PURE__ */ new Date(),
|
|
1594
|
+
modelId: this.modelId,
|
|
1595
|
+
headers: responseHeaders,
|
|
1596
|
+
body: rawValue
|
|
1597
|
+
}
|
|
1598
|
+
};
|
|
1599
|
+
} catch (error) {
|
|
1600
|
+
throw await asGatewayError(
|
|
1601
|
+
error,
|
|
1602
|
+
await parseAuthMethod(resolvedHeaders != null ? resolvedHeaders : {})
|
|
1603
|
+
);
|
|
1604
|
+
}
|
|
1605
|
+
}
|
|
1606
|
+
getUrl() {
|
|
1607
|
+
return `${this.config.baseURL}/speech-model`;
|
|
1608
|
+
}
|
|
1609
|
+
getModelConfigHeaders() {
|
|
1610
|
+
return {
|
|
1611
|
+
"ai-speech-model-specification-version": "4",
|
|
1612
|
+
"ai-model-id": this.modelId
|
|
1613
|
+
};
|
|
1614
|
+
}
|
|
1615
|
+
};
|
|
1616
|
+
var providerMetadataEntrySchema3 = z12.object({}).catchall(z12.unknown());
|
|
1617
|
+
var gatewaySpeechWarningSchema = z12.discriminatedUnion("type", [
|
|
1618
|
+
z12.object({
|
|
1619
|
+
type: z12.literal("unsupported"),
|
|
1620
|
+
feature: z12.string(),
|
|
1621
|
+
details: z12.string().optional()
|
|
1622
|
+
}),
|
|
1623
|
+
z12.object({
|
|
1624
|
+
type: z12.literal("compatibility"),
|
|
1625
|
+
feature: z12.string(),
|
|
1626
|
+
details: z12.string().optional()
|
|
1627
|
+
}),
|
|
1628
|
+
z12.object({
|
|
1629
|
+
type: z12.literal("other"),
|
|
1630
|
+
message: z12.string()
|
|
1631
|
+
})
|
|
1632
|
+
]);
|
|
1633
|
+
var gatewaySpeechResponseSchema = z12.object({
|
|
1634
|
+
audio: z12.string(),
|
|
1635
|
+
warnings: z12.array(gatewaySpeechWarningSchema).optional(),
|
|
1636
|
+
providerMetadata: z12.record(z12.string(), providerMetadataEntrySchema3).optional()
|
|
1637
|
+
});
|
|
1638
|
+
|
|
1639
|
+
// src/gateway-transcription-model.ts
|
|
1640
|
+
import {
|
|
1641
|
+
combineHeaders as combineHeaders7,
|
|
1642
|
+
convertUint8ArrayToBase64 as convertUint8ArrayToBase643,
|
|
1643
|
+
createJsonErrorResponseHandler as createJsonErrorResponseHandler10,
|
|
1644
|
+
createJsonResponseHandler as createJsonResponseHandler9,
|
|
1645
|
+
postJsonToApi as postJsonToApi7,
|
|
1646
|
+
resolve as resolve10
|
|
1647
|
+
} from "@ai-sdk/provider-utils";
|
|
1648
|
+
import { z as z13 } from "zod/v4";
|
|
1649
|
+
var GatewayTranscriptionModel = class {
|
|
1650
|
+
constructor(modelId, config) {
|
|
1651
|
+
this.modelId = modelId;
|
|
1652
|
+
this.config = config;
|
|
1653
|
+
this.specificationVersion = "v4";
|
|
1654
|
+
}
|
|
1655
|
+
get provider() {
|
|
1656
|
+
return this.config.provider;
|
|
1657
|
+
}
|
|
1658
|
+
async doGenerate({
|
|
1659
|
+
audio,
|
|
1660
|
+
mediaType,
|
|
1661
|
+
providerOptions,
|
|
1662
|
+
headers,
|
|
1663
|
+
abortSignal
|
|
1664
|
+
}) {
|
|
1665
|
+
var _a9, _b9, _c, _d;
|
|
1666
|
+
const resolvedHeaders = this.config.headers ? await resolve10(this.config.headers) : void 0;
|
|
1667
|
+
try {
|
|
1668
|
+
const {
|
|
1669
|
+
responseHeaders,
|
|
1670
|
+
value: responseBody,
|
|
1671
|
+
rawValue
|
|
1672
|
+
} = await postJsonToApi7({
|
|
1673
|
+
url: this.getUrl(),
|
|
1674
|
+
headers: combineHeaders7(
|
|
1675
|
+
resolvedHeaders,
|
|
1676
|
+
headers != null ? headers : {},
|
|
1677
|
+
this.getModelConfigHeaders(),
|
|
1678
|
+
await resolve10(this.config.o11yHeaders)
|
|
1679
|
+
),
|
|
1680
|
+
body: {
|
|
1681
|
+
audio: audio instanceof Uint8Array ? convertUint8ArrayToBase643(audio) : audio,
|
|
1682
|
+
mediaType,
|
|
1683
|
+
...providerOptions && { providerOptions }
|
|
1684
|
+
},
|
|
1685
|
+
successfulResponseHandler: createJsonResponseHandler9(
|
|
1686
|
+
gatewayTranscriptionResponseSchema
|
|
1687
|
+
),
|
|
1688
|
+
failedResponseHandler: createJsonErrorResponseHandler10({
|
|
1689
|
+
errorSchema: z13.any(),
|
|
1690
|
+
errorToMessage: (data) => data
|
|
1691
|
+
}),
|
|
1692
|
+
...abortSignal && { abortSignal },
|
|
1693
|
+
fetch: this.config.fetch
|
|
1694
|
+
});
|
|
1695
|
+
return {
|
|
1696
|
+
text: responseBody.text,
|
|
1697
|
+
segments: (_a9 = responseBody.segments) != null ? _a9 : [],
|
|
1698
|
+
language: (_b9 = responseBody.language) != null ? _b9 : void 0,
|
|
1699
|
+
durationInSeconds: (_c = responseBody.durationInSeconds) != null ? _c : void 0,
|
|
1700
|
+
warnings: (_d = responseBody.warnings) != null ? _d : [],
|
|
1701
|
+
providerMetadata: responseBody.providerMetadata,
|
|
1702
|
+
response: {
|
|
1703
|
+
timestamp: /* @__PURE__ */ new Date(),
|
|
1704
|
+
modelId: this.modelId,
|
|
1705
|
+
headers: responseHeaders,
|
|
1706
|
+
body: rawValue
|
|
1707
|
+
}
|
|
1708
|
+
};
|
|
1709
|
+
} catch (error) {
|
|
1710
|
+
throw await asGatewayError(
|
|
1711
|
+
error,
|
|
1712
|
+
await parseAuthMethod(resolvedHeaders != null ? resolvedHeaders : {})
|
|
1713
|
+
);
|
|
1714
|
+
}
|
|
1715
|
+
}
|
|
1716
|
+
getUrl() {
|
|
1717
|
+
return `${this.config.baseURL}/transcription-model`;
|
|
1718
|
+
}
|
|
1719
|
+
getModelConfigHeaders() {
|
|
1720
|
+
return {
|
|
1721
|
+
"ai-transcription-model-specification-version": "4",
|
|
1722
|
+
"ai-model-id": this.modelId
|
|
1723
|
+
};
|
|
1724
|
+
}
|
|
1725
|
+
};
|
|
1726
|
+
var providerMetadataEntrySchema4 = z13.object({}).catchall(z13.unknown());
|
|
1727
|
+
var gatewayTranscriptionWarningSchema = z13.discriminatedUnion("type", [
|
|
1728
|
+
z13.object({
|
|
1729
|
+
type: z13.literal("unsupported"),
|
|
1730
|
+
feature: z13.string(),
|
|
1731
|
+
details: z13.string().optional()
|
|
1732
|
+
}),
|
|
1733
|
+
z13.object({
|
|
1734
|
+
type: z13.literal("compatibility"),
|
|
1735
|
+
feature: z13.string(),
|
|
1736
|
+
details: z13.string().optional()
|
|
1737
|
+
}),
|
|
1738
|
+
z13.object({
|
|
1739
|
+
type: z13.literal("other"),
|
|
1740
|
+
message: z13.string()
|
|
1741
|
+
})
|
|
1742
|
+
]);
|
|
1743
|
+
var gatewayTranscriptionResponseSchema = z13.object({
|
|
1744
|
+
text: z13.string(),
|
|
1745
|
+
segments: z13.array(
|
|
1746
|
+
z13.object({
|
|
1747
|
+
text: z13.string(),
|
|
1748
|
+
startSecond: z13.number(),
|
|
1749
|
+
endSecond: z13.number()
|
|
1750
|
+
})
|
|
1751
|
+
).optional(),
|
|
1752
|
+
language: z13.string().nullish(),
|
|
1753
|
+
durationInSeconds: z13.number().nullish(),
|
|
1754
|
+
warnings: z13.array(gatewayTranscriptionWarningSchema).optional(),
|
|
1755
|
+
providerMetadata: z13.record(z13.string(), providerMetadataEntrySchema4).optional()
|
|
1756
|
+
});
|
|
1757
|
+
|
|
1523
1758
|
// src/tool/parallel-search.ts
|
|
1524
1759
|
import {
|
|
1525
1760
|
createProviderExecutedToolFactory,
|
|
1526
1761
|
lazySchema as lazySchema9,
|
|
1527
1762
|
zodSchema as zodSchema9
|
|
1528
1763
|
} from "@ai-sdk/provider-utils";
|
|
1529
|
-
import { z as
|
|
1764
|
+
import { z as z14 } from "zod";
|
|
1530
1765
|
var parallelSearchInputSchema = lazySchema9(
|
|
1531
1766
|
() => zodSchema9(
|
|
1532
|
-
|
|
1533
|
-
objective:
|
|
1767
|
+
z14.object({
|
|
1768
|
+
objective: z14.string().describe(
|
|
1534
1769
|
"Natural-language description of the web research goal, including source or freshness guidance and broader context from the task. Maximum 5000 characters."
|
|
1535
1770
|
),
|
|
1536
|
-
search_queries:
|
|
1771
|
+
search_queries: z14.array(z14.string()).optional().describe(
|
|
1537
1772
|
"Optional search queries to supplement the objective. Maximum 200 characters per query."
|
|
1538
1773
|
),
|
|
1539
|
-
mode:
|
|
1774
|
+
mode: z14.enum(["one-shot", "agentic"]).optional().describe(
|
|
1540
1775
|
'Mode preset: "one-shot" for comprehensive results with longer excerpts (default), "agentic" for concise, token-efficient results for multi-step workflows.'
|
|
1541
1776
|
),
|
|
1542
|
-
max_results:
|
|
1777
|
+
max_results: z14.number().optional().describe(
|
|
1543
1778
|
"Maximum number of results to return (1-20). Defaults to 10 if not specified."
|
|
1544
1779
|
),
|
|
1545
|
-
source_policy:
|
|
1546
|
-
include_domains:
|
|
1547
|
-
exclude_domains:
|
|
1548
|
-
after_date:
|
|
1780
|
+
source_policy: z14.object({
|
|
1781
|
+
include_domains: z14.array(z14.string()).optional().describe("List of domains to include in search results."),
|
|
1782
|
+
exclude_domains: z14.array(z14.string()).optional().describe("List of domains to exclude from search results."),
|
|
1783
|
+
after_date: z14.string().optional().describe(
|
|
1549
1784
|
"Only include results published after this date (ISO 8601 format)."
|
|
1550
1785
|
)
|
|
1551
1786
|
}).optional().describe(
|
|
1552
1787
|
"Source policy for controlling which domains to include/exclude and freshness."
|
|
1553
1788
|
),
|
|
1554
|
-
excerpts:
|
|
1555
|
-
max_chars_per_result:
|
|
1556
|
-
max_chars_total:
|
|
1789
|
+
excerpts: z14.object({
|
|
1790
|
+
max_chars_per_result: z14.number().optional().describe("Maximum characters per result."),
|
|
1791
|
+
max_chars_total: z14.number().optional().describe("Maximum total characters across all results.")
|
|
1557
1792
|
}).optional().describe("Excerpt configuration for controlling result length."),
|
|
1558
|
-
fetch_policy:
|
|
1559
|
-
max_age_seconds:
|
|
1793
|
+
fetch_policy: z14.object({
|
|
1794
|
+
max_age_seconds: z14.number().optional().describe(
|
|
1560
1795
|
"Maximum age in seconds for cached content. Set to 0 to always fetch fresh content."
|
|
1561
1796
|
)
|
|
1562
1797
|
}).optional().describe("Fetch policy for controlling content freshness.")
|
|
@@ -1565,23 +1800,23 @@ var parallelSearchInputSchema = lazySchema9(
|
|
|
1565
1800
|
);
|
|
1566
1801
|
var parallelSearchOutputSchema = lazySchema9(
|
|
1567
1802
|
() => zodSchema9(
|
|
1568
|
-
|
|
1803
|
+
z14.union([
|
|
1569
1804
|
// Success response
|
|
1570
|
-
|
|
1571
|
-
searchId:
|
|
1572
|
-
results:
|
|
1573
|
-
|
|
1574
|
-
url:
|
|
1575
|
-
title:
|
|
1576
|
-
excerpt:
|
|
1577
|
-
publishDate:
|
|
1578
|
-
relevanceScore:
|
|
1805
|
+
z14.object({
|
|
1806
|
+
searchId: z14.string(),
|
|
1807
|
+
results: z14.array(
|
|
1808
|
+
z14.object({
|
|
1809
|
+
url: z14.string(),
|
|
1810
|
+
title: z14.string(),
|
|
1811
|
+
excerpt: z14.string(),
|
|
1812
|
+
publishDate: z14.string().nullable().optional(),
|
|
1813
|
+
relevanceScore: z14.number().optional()
|
|
1579
1814
|
})
|
|
1580
1815
|
)
|
|
1581
1816
|
}),
|
|
1582
1817
|
// Error response
|
|
1583
|
-
|
|
1584
|
-
error:
|
|
1818
|
+
z14.object({
|
|
1819
|
+
error: z14.enum([
|
|
1585
1820
|
"api_error",
|
|
1586
1821
|
"rate_limit",
|
|
1587
1822
|
"timeout",
|
|
@@ -1589,8 +1824,8 @@ var parallelSearchOutputSchema = lazySchema9(
|
|
|
1589
1824
|
"configuration_error",
|
|
1590
1825
|
"unknown"
|
|
1591
1826
|
]),
|
|
1592
|
-
statusCode:
|
|
1593
|
-
message:
|
|
1827
|
+
statusCode: z14.number().optional(),
|
|
1828
|
+
message: z14.string()
|
|
1594
1829
|
})
|
|
1595
1830
|
])
|
|
1596
1831
|
)
|
|
@@ -1608,44 +1843,44 @@ import {
|
|
|
1608
1843
|
lazySchema as lazySchema10,
|
|
1609
1844
|
zodSchema as zodSchema10
|
|
1610
1845
|
} from "@ai-sdk/provider-utils";
|
|
1611
|
-
import { z as
|
|
1846
|
+
import { z as z15 } from "zod";
|
|
1612
1847
|
var perplexitySearchInputSchema = lazySchema10(
|
|
1613
1848
|
() => zodSchema10(
|
|
1614
|
-
|
|
1615
|
-
query:
|
|
1849
|
+
z15.object({
|
|
1850
|
+
query: z15.union([z15.string(), z15.array(z15.string())]).describe(
|
|
1616
1851
|
"Search query (string) or multiple queries (array of up to 5 strings). Multi-query searches return combined results from all queries."
|
|
1617
1852
|
),
|
|
1618
|
-
max_results:
|
|
1853
|
+
max_results: z15.number().optional().describe(
|
|
1619
1854
|
"Maximum number of search results to return (1-20, default: 10)"
|
|
1620
1855
|
),
|
|
1621
|
-
max_tokens_per_page:
|
|
1856
|
+
max_tokens_per_page: z15.number().optional().describe(
|
|
1622
1857
|
"Maximum number of tokens to extract per search result page (256-2048, default: 2048)"
|
|
1623
1858
|
),
|
|
1624
|
-
max_tokens:
|
|
1859
|
+
max_tokens: z15.number().optional().describe(
|
|
1625
1860
|
"Maximum total tokens across all search results (default: 25000, max: 1000000)"
|
|
1626
1861
|
),
|
|
1627
|
-
country:
|
|
1862
|
+
country: z15.string().optional().describe(
|
|
1628
1863
|
"Two-letter ISO 3166-1 alpha-2 country code for regional search results (e.g., 'US', 'GB', 'FR')"
|
|
1629
1864
|
),
|
|
1630
|
-
search_domain_filter:
|
|
1865
|
+
search_domain_filter: z15.array(z15.string()).optional().describe(
|
|
1631
1866
|
"List of domains to include or exclude from search results (max 20). To include: ['nature.com', 'science.org']. To exclude: ['-example.com', '-spam.net']"
|
|
1632
1867
|
),
|
|
1633
|
-
search_language_filter:
|
|
1868
|
+
search_language_filter: z15.array(z15.string()).optional().describe(
|
|
1634
1869
|
"List of ISO 639-1 language codes to filter results (max 10, lowercase). Examples: ['en', 'fr', 'de']"
|
|
1635
1870
|
),
|
|
1636
|
-
search_after_date:
|
|
1871
|
+
search_after_date: z15.string().optional().describe(
|
|
1637
1872
|
"Include only results published after this date. Format: 'MM/DD/YYYY' (e.g., '3/1/2025'). Cannot be used with search_recency_filter."
|
|
1638
1873
|
),
|
|
1639
|
-
search_before_date:
|
|
1874
|
+
search_before_date: z15.string().optional().describe(
|
|
1640
1875
|
"Include only results published before this date. Format: 'MM/DD/YYYY' (e.g., '3/15/2025'). Cannot be used with search_recency_filter."
|
|
1641
1876
|
),
|
|
1642
|
-
last_updated_after_filter:
|
|
1877
|
+
last_updated_after_filter: z15.string().optional().describe(
|
|
1643
1878
|
"Include only results last updated after this date. Format: 'MM/DD/YYYY' (e.g., '3/1/2025'). Cannot be used with search_recency_filter."
|
|
1644
1879
|
),
|
|
1645
|
-
last_updated_before_filter:
|
|
1880
|
+
last_updated_before_filter: z15.string().optional().describe(
|
|
1646
1881
|
"Include only results last updated before this date. Format: 'MM/DD/YYYY' (e.g., '3/15/2025'). Cannot be used with search_recency_filter."
|
|
1647
1882
|
),
|
|
1648
|
-
search_recency_filter:
|
|
1883
|
+
search_recency_filter: z15.enum(["day", "week", "month", "year"]).optional().describe(
|
|
1649
1884
|
"Filter results by relative time period. Cannot be used with search_after_date or search_before_date."
|
|
1650
1885
|
)
|
|
1651
1886
|
})
|
|
@@ -1653,31 +1888,31 @@ var perplexitySearchInputSchema = lazySchema10(
|
|
|
1653
1888
|
);
|
|
1654
1889
|
var perplexitySearchOutputSchema = lazySchema10(
|
|
1655
1890
|
() => zodSchema10(
|
|
1656
|
-
|
|
1891
|
+
z15.union([
|
|
1657
1892
|
// Success response
|
|
1658
|
-
|
|
1659
|
-
results:
|
|
1660
|
-
|
|
1661
|
-
title:
|
|
1662
|
-
url:
|
|
1663
|
-
snippet:
|
|
1664
|
-
date:
|
|
1665
|
-
lastUpdated:
|
|
1893
|
+
z15.object({
|
|
1894
|
+
results: z15.array(
|
|
1895
|
+
z15.object({
|
|
1896
|
+
title: z15.string(),
|
|
1897
|
+
url: z15.string(),
|
|
1898
|
+
snippet: z15.string(),
|
|
1899
|
+
date: z15.string().optional(),
|
|
1900
|
+
lastUpdated: z15.string().optional()
|
|
1666
1901
|
})
|
|
1667
1902
|
),
|
|
1668
|
-
id:
|
|
1903
|
+
id: z15.string()
|
|
1669
1904
|
}),
|
|
1670
1905
|
// Error response
|
|
1671
|
-
|
|
1672
|
-
error:
|
|
1906
|
+
z15.object({
|
|
1907
|
+
error: z15.enum([
|
|
1673
1908
|
"api_error",
|
|
1674
1909
|
"rate_limit",
|
|
1675
1910
|
"timeout",
|
|
1676
1911
|
"invalid_input",
|
|
1677
1912
|
"unknown"
|
|
1678
1913
|
]),
|
|
1679
|
-
statusCode:
|
|
1680
|
-
message:
|
|
1914
|
+
statusCode: z15.number().optional(),
|
|
1915
|
+
message: z15.string()
|
|
1681
1916
|
})
|
|
1682
1917
|
])
|
|
1683
1918
|
)
|
|
@@ -1719,7 +1954,7 @@ async function getVercelRequestId() {
|
|
|
1719
1954
|
}
|
|
1720
1955
|
|
|
1721
1956
|
// src/version.ts
|
|
1722
|
-
var VERSION = true ? "4.0.0-canary.
|
|
1957
|
+
var VERSION = true ? "4.0.0-canary.88" : "0.0.0-test";
|
|
1723
1958
|
|
|
1724
1959
|
// src/gateway-provider.ts
|
|
1725
1960
|
var AI_GATEWAY_PROTOCOL_VERSION = "0.0.1";
|
|
@@ -1899,6 +2134,28 @@ function createGateway(options = {}) {
|
|
|
1899
2134
|
};
|
|
1900
2135
|
provider.rerankingModel = createRerankingModel;
|
|
1901
2136
|
provider.reranking = createRerankingModel;
|
|
2137
|
+
const createSpeechModel = (modelId) => {
|
|
2138
|
+
return new GatewaySpeechModel(modelId, {
|
|
2139
|
+
provider: "gateway",
|
|
2140
|
+
baseURL,
|
|
2141
|
+
headers: getHeaders,
|
|
2142
|
+
fetch: options.fetch,
|
|
2143
|
+
o11yHeaders: createO11yHeaders()
|
|
2144
|
+
});
|
|
2145
|
+
};
|
|
2146
|
+
provider.speechModel = createSpeechModel;
|
|
2147
|
+
provider.speech = createSpeechModel;
|
|
2148
|
+
const createTranscriptionModel = (modelId) => {
|
|
2149
|
+
return new GatewayTranscriptionModel(modelId, {
|
|
2150
|
+
provider: "gateway",
|
|
2151
|
+
baseURL,
|
|
2152
|
+
headers: getHeaders,
|
|
2153
|
+
fetch: options.fetch,
|
|
2154
|
+
o11yHeaders: createO11yHeaders()
|
|
2155
|
+
});
|
|
2156
|
+
};
|
|
2157
|
+
provider.transcriptionModel = createTranscriptionModel;
|
|
2158
|
+
provider.transcription = createTranscriptionModel;
|
|
1902
2159
|
provider.chat = provider.languageModel;
|
|
1903
2160
|
provider.embedding = provider.embeddingModel;
|
|
1904
2161
|
provider.image = provider.imageModel;
|