@radheim/ai 0.0.0-stage → 2.4.3
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/README.md +1890 -3
- package/dist/ai.d.ts +36 -0
- package/dist/ai.js +46 -0
- package/dist/cache-policy.d.ts +6 -0
- package/dist/cache-policy.js +205 -0
- package/dist/decision-client.d.ts +10 -0
- package/dist/decision-client.js +42 -0
- package/dist/decision.d.ts +378 -0
- package/dist/decision.js +171 -0
- package/dist/effect.d.ts +59 -0
- package/dist/effect.js +33 -0
- package/dist/effort-updates.d.ts +12 -0
- package/dist/effort-updates.js +23 -0
- package/dist/embedding-client.d.ts +10 -0
- package/dist/embedding-client.js +17 -0
- package/dist/embedding.d.ts +113 -0
- package/dist/embedding.js +76 -0
- package/dist/experimental/cloudflare-run-extraction.d.ts +17 -0
- package/dist/experimental/cloudflare-run-extraction.js +85 -0
- package/dist/experimental/extraction.d.ts +153 -0
- package/dist/experimental/extraction.js +103 -0
- package/dist/experimental/realtime.d.ts +80 -0
- package/dist/experimental/realtime.js +96 -0
- package/dist/experimental.d.ts +10 -0
- package/dist/experimental.js +6 -0
- package/dist/fetch-middleware.d.ts +7 -0
- package/dist/fetch-middleware.js +41 -0
- package/dist/generation.d.ts +77 -0
- package/dist/generation.js +109 -0
- package/dist/image-client.d.ts +14 -0
- package/dist/image-client.js +39 -0
- package/dist/image.d.ts +323 -0
- package/dist/image.js +103 -0
- package/dist/index.d.ts +300 -0
- package/dist/index.js +179 -0
- package/dist/llm.d.ts +109 -0
- package/dist/llm.js +177 -0
- package/dist/loop.d.ts +38 -0
- package/dist/loop.js +139 -0
- package/dist/media-client.d.ts +30 -0
- package/dist/media-client.js +44 -0
- package/dist/media-model.d.ts +49 -0
- package/dist/media-model.js +55 -0
- package/dist/media.d.ts +237 -0
- package/dist/media.js +285 -0
- package/dist/promise-media.d.ts +20 -0
- package/dist/promise-media.js +16 -0
- package/dist/protocols/alibaba-chat.d.ts +315 -0
- package/dist/protocols/alibaba-chat.js +78 -0
- package/dist/protocols/alibaba-images.d.ts +22 -0
- package/dist/protocols/alibaba-images.js +77 -0
- package/dist/protocols/alibaba-messages.d.ts +413 -0
- package/dist/protocols/alibaba-messages.js +44 -0
- package/dist/protocols/alibaba-responses.d.ts +298 -0
- package/dist/protocols/alibaba-responses.js +67 -0
- package/dist/protocols/anthropic-messages.d.ts +1213 -0
- package/dist/protocols/anthropic-messages.js +1412 -0
- package/dist/protocols/assemblyai-transcription.d.ts +41 -0
- package/dist/protocols/assemblyai-transcription.js +137 -0
- package/dist/protocols/bedrock-converse.d.ts +548 -0
- package/dist/protocols/bedrock-converse.js +801 -0
- package/dist/protocols/bedrock-event-stream.d.ts +14 -0
- package/dist/protocols/bedrock-event-stream.js +100 -0
- package/dist/protocols/cartesia-speech.d.ts +117 -0
- package/dist/protocols/cartesia-speech.js +120 -0
- package/dist/protocols/cloudflare-run-decisions.d.ts +9 -0
- package/dist/protocols/cloudflare-run-decisions.js +36 -0
- package/dist/protocols/cloudflare-workers-ai-images.d.ts +23 -0
- package/dist/protocols/cloudflare-workers-ai-images.js +80 -0
- package/dist/protocols/cohere-chat.d.ts +184 -0
- package/dist/protocols/cohere-chat.js +317 -0
- package/dist/protocols/deepgram-speech.d.ts +109 -0
- package/dist/protocols/deepgram-speech.js +93 -0
- package/dist/protocols/deepgram-transcription.d.ts +26 -0
- package/dist/protocols/deepgram-transcription.js +119 -0
- package/dist/protocols/elevenlabs-speech.d.ts +112 -0
- package/dist/protocols/elevenlabs-speech.js +111 -0
- package/dist/protocols/elevenlabs-transcription.d.ts +28 -0
- package/dist/protocols/elevenlabs-transcription.js +137 -0
- package/dist/protocols/gemini.d.ts +388 -0
- package/dist/protocols/gemini.js +741 -0
- package/dist/protocols/google-decisions.d.ts +13 -0
- package/dist/protocols/google-decisions.js +133 -0
- package/dist/protocols/google-embed-content.d.ts +34 -0
- package/dist/protocols/google-embed-content.js +110 -0
- package/dist/protocols/google-images.d.ts +18 -0
- package/dist/protocols/google-images.js +169 -0
- package/dist/protocols/google-interactions-video.d.ts +38 -0
- package/dist/protocols/google-interactions-video.js +185 -0
- package/dist/protocols/google-interactions.d.ts +554 -0
- package/dist/protocols/google-interactions.js +756 -0
- package/dist/protocols/google-speech.d.ts +120 -0
- package/dist/protocols/google-speech.js +94 -0
- package/dist/protocols/google-transcription.d.ts +148 -0
- package/dist/protocols/google-transcription.js +129 -0
- package/dist/protocols/google-vertex-predict-embeddings.d.ts +18 -0
- package/dist/protocols/google-vertex-predict-embeddings.js +74 -0
- package/dist/protocols/index.d.ts +21 -0
- package/dist/protocols/index.js +21 -0
- package/dist/protocols/meta-images.d.ts +26 -0
- package/dist/protocols/meta-images.js +101 -0
- package/dist/protocols/meta-messages.d.ts +423 -0
- package/dist/protocols/meta-messages.js +63 -0
- package/dist/protocols/meta-responses.d.ts +533 -0
- package/dist/protocols/meta-responses.js +189 -0
- package/dist/protocols/minimax-images.d.ts +25 -0
- package/dist/protocols/minimax-images.js +150 -0
- package/dist/protocols/minimax-video.d.ts +45 -0
- package/dist/protocols/minimax-video.js +296 -0
- package/dist/protocols/mistral-chat.d.ts +565 -0
- package/dist/protocols/mistral-chat.js +606 -0
- package/dist/protocols/open-responses-channel.d.ts +25 -0
- package/dist/protocols/open-responses-channel.js +137 -0
- package/dist/protocols/open-responses-continuation.d.ts +18 -0
- package/dist/protocols/open-responses-continuation.js +172 -0
- package/dist/protocols/open-responses.d.ts +2509 -0
- package/dist/protocols/open-responses.js +1335 -0
- package/dist/protocols/openai-chat.d.ts +2571 -0
- package/dist/protocols/openai-chat.js +1140 -0
- package/dist/protocols/openai-compatible-chat.d.ts +184 -0
- package/dist/protocols/openai-compatible-chat.js +19 -0
- package/dist/protocols/openai-compatible-responses.d.ts +231 -0
- package/dist/protocols/openai-compatible-responses.js +18 -0
- package/dist/protocols/openai-decisions.d.ts +22 -0
- package/dist/protocols/openai-decisions.js +141 -0
- package/dist/protocols/openai-embeddings.d.ts +16 -0
- package/dist/protocols/openai-embeddings.js +76 -0
- package/dist/protocols/openai-freeform.d.ts +78 -0
- package/dist/protocols/openai-freeform.js +222 -0
- package/dist/protocols/openai-images.d.ts +148 -0
- package/dist/protocols/openai-images.js +303 -0
- package/dist/protocols/openai-responses.d.ts +1600 -0
- package/dist/protocols/openai-responses.js +360 -0
- package/dist/protocols/openai-speech.d.ts +110 -0
- package/dist/protocols/openai-speech.js +112 -0
- package/dist/protocols/openai-transcription.d.ts +185 -0
- package/dist/protocols/openai-transcription.js +206 -0
- package/dist/protocols/openrouter-video.d.ts +36 -0
- package/dist/protocols/openrouter-video.js +139 -0
- package/dist/protocols/seedance-video.d.ts +45 -0
- package/dist/protocols/seedance-video.js +217 -0
- package/dist/protocols/shared.d.ts +249 -0
- package/dist/protocols/shared.js +446 -0
- package/dist/protocols/system-one.d.ts +145 -0
- package/dist/protocols/system-one.js +272 -0
- package/dist/protocols/utils/bedrock-auth.d.ts +60 -0
- package/dist/protocols/utils/bedrock-auth.js +86 -0
- package/dist/protocols/utils/bedrock-cache.d.ts +19 -0
- package/dist/protocols/utils/bedrock-cache.js +49 -0
- package/dist/protocols/utils/bedrock-media.d.ts +53 -0
- package/dist/protocols/utils/bedrock-media.js +98 -0
- package/dist/protocols/utils/cache.d.ts +25 -0
- package/dist/protocols/utils/cache.js +33 -0
- package/dist/protocols/utils/claude-model.d.ts +8 -0
- package/dist/protocols/utils/claude-model.js +15 -0
- package/dist/protocols/utils/gateway-protocol.d.ts +17 -0
- package/dist/protocols/utils/gateway-protocol.js +59 -0
- package/dist/protocols/utils/gemini-generate-content.d.ts +75 -0
- package/dist/protocols/utils/gemini-generate-content.js +96 -0
- package/dist/protocols/utils/gemini-json-schema.d.ts +8 -0
- package/dist/protocols/utils/gemini-json-schema.js +76 -0
- package/dist/protocols/utils/image-sizing.d.ts +31 -0
- package/dist/protocols/utils/image-sizing.js +73 -0
- package/dist/protocols/utils/lifecycle.d.ts +24 -0
- package/dist/protocols/utils/lifecycle.js +62 -0
- package/dist/protocols/utils/media-input.d.ts +32 -0
- package/dist/protocols/utils/media-input.js +62 -0
- package/dist/protocols/utils/mistral-tool-id.d.ts +5 -0
- package/dist/protocols/utils/mistral-tool-id.js +31 -0
- package/dist/protocols/utils/open-responses-options.d.ts +54 -0
- package/dist/protocols/utils/open-responses-options.js +59 -0
- package/dist/protocols/utils/partial-json-options.d.ts +61 -0
- package/dist/protocols/utils/partial-json-options.js +51 -0
- package/dist/protocols/utils/partial-json.d.ts +8 -0
- package/dist/protocols/utils/partial-json.js +280 -0
- package/dist/protocols/utils/responses-checkpoint.d.ts +4 -0
- package/dist/protocols/utils/responses-checkpoint.js +103 -0
- package/dist/protocols/utils/responses-compaction.d.ts +6 -0
- package/dist/protocols/utils/responses-compaction.js +162 -0
- package/dist/protocols/utils/responses-hosted-tools.d.ts +122 -0
- package/dist/protocols/utils/responses-hosted-tools.js +63 -0
- package/dist/protocols/utils/speaker-turns.d.ts +3 -0
- package/dist/protocols/utils/speaker-turns.js +9 -0
- package/dist/protocols/utils/speech-stream.d.ts +49 -0
- package/dist/protocols/utils/speech-stream.js +64 -0
- package/dist/protocols/utils/tool-schema.d.ts +10 -0
- package/dist/protocols/utils/tool-schema.js +109 -0
- package/dist/protocols/utils/tool-stream.d.ts +478 -0
- package/dist/protocols/utils/tool-stream.js +153 -0
- package/dist/protocols/venice-chat.d.ts +340 -0
- package/dist/protocols/venice-chat.js +283 -0
- package/dist/protocols/xai-images.d.ts +25 -0
- package/dist/protocols/xai-images.js +87 -0
- package/dist/protocols/xai-responses.d.ts +294 -0
- package/dist/protocols/xai-responses.js +86 -0
- package/dist/protocols/xai-video.d.ts +35 -0
- package/dist/protocols/xai-video.js +159 -0
- package/dist/protocols/zai-chat.d.ts +296 -0
- package/dist/protocols/zai-chat.js +56 -0
- package/dist/protocols/zai-images.d.ts +20 -0
- package/dist/protocols/zai-images.js +79 -0
- package/dist/protocols/zai-messages.d.ts +409 -0
- package/dist/protocols/zai-messages.js +30 -0
- package/dist/protocols.d.ts +1 -0
- package/dist/protocols.js +1 -0
- package/dist/provider-error.d.ts +22 -0
- package/dist/provider-error.js +228 -0
- package/dist/provider-package.d.ts +17 -0
- package/dist/provider-package.js +1 -0
- package/dist/providers/alibaba/chat.d.ts +1 -0
- package/dist/providers/alibaba/chat.js +1 -0
- package/dist/providers/alibaba/embeddings.d.ts +2 -0
- package/dist/providers/alibaba/embeddings.js +1 -0
- package/dist/providers/alibaba/images.d.ts +2 -0
- package/dist/providers/alibaba/images.js +1 -0
- package/dist/providers/alibaba/messages.d.ts +3 -0
- package/dist/providers/alibaba/messages.js +1 -0
- package/dist/providers/alibaba/responses.d.ts +3 -0
- package/dist/providers/alibaba/responses.js +1 -0
- package/dist/providers/alibaba.d.ts +905 -0
- package/dist/providers/alibaba.js +119 -0
- package/dist/providers/amazon-bedrock/mantle/chat.d.ts +2 -0
- package/dist/providers/amazon-bedrock/mantle/chat.js +1 -0
- package/dist/providers/amazon-bedrock/mantle/messages.d.ts +2 -0
- package/dist/providers/amazon-bedrock/mantle/messages.js +1 -0
- package/dist/providers/amazon-bedrock/mantle/responses.d.ts +2 -0
- package/dist/providers/amazon-bedrock/mantle/responses.js +1 -0
- package/dist/providers/amazon-bedrock/mantle.d.ts +2 -0
- package/dist/providers/amazon-bedrock/mantle.js +1 -0
- package/dist/providers/amazon-bedrock-mantle.d.ts +789 -0
- package/dist/providers/amazon-bedrock-mantle.js +107 -0
- package/dist/providers/amazon-bedrock.d.ts +190 -0
- package/dist/providers/amazon-bedrock.js +44 -0
- package/dist/providers/anthropic-compatible.d.ts +364 -0
- package/dist/providers/anthropic-compatible.js +47 -0
- package/dist/providers/anthropic.d.ts +362 -0
- package/dist/providers/anthropic.js +36 -0
- package/dist/providers/assemblyai.d.ts +19 -0
- package/dist/providers/assemblyai.js +19 -0
- package/dist/providers/azure/chat.d.ts +2 -0
- package/dist/providers/azure/chat.js +1 -0
- package/dist/providers/azure/embeddings.d.ts +2 -0
- package/dist/providers/azure/embeddings.js +1 -0
- package/dist/providers/azure/images.d.ts +2 -0
- package/dist/providers/azure/images.js +1 -0
- package/dist/providers/azure/messages.d.ts +2 -0
- package/dist/providers/azure/messages.js +1 -0
- package/dist/providers/azure/responses.d.ts +2 -0
- package/dist/providers/azure/responses.js +1 -0
- package/dist/providers/azure.d.ts +1074 -0
- package/dist/providers/azure.js +150 -0
- package/dist/providers/baseten/decisions.d.ts +2 -0
- package/dist/providers/baseten/decisions.js +1 -0
- package/dist/providers/baseten.d.ts +384 -0
- package/dist/providers/baseten.js +56 -0
- package/dist/providers/byteplus/videos.d.ts +2 -0
- package/dist/providers/byteplus/videos.js +1 -0
- package/dist/providers/byteplus.d.ts +24 -0
- package/dist/providers/byteplus.js +21 -0
- package/dist/providers/cartesia.d.ts +18 -0
- package/dist/providers/cartesia.js +17 -0
- package/dist/providers/cerebras.d.ts +375 -0
- package/dist/providers/cerebras.js +33 -0
- package/dist/providers/cloudflare-ai-gateway/decisions.d.ts +2 -0
- package/dist/providers/cloudflare-ai-gateway/decisions.js +1 -0
- package/dist/providers/cloudflare-ai-gateway.d.ts +1581 -0
- package/dist/providers/cloudflare-ai-gateway.js +120 -0
- package/dist/providers/cloudflare-shared.d.ts +9 -0
- package/dist/providers/cloudflare-shared.js +25 -0
- package/dist/providers/cloudflare-workers-ai/decisions.d.ts +2 -0
- package/dist/providers/cloudflare-workers-ai/decisions.js +1 -0
- package/dist/providers/cloudflare-workers-ai/images.d.ts +2 -0
- package/dist/providers/cloudflare-workers-ai/images.js +1 -0
- package/dist/providers/cloudflare-workers-ai.d.ts +391 -0
- package/dist/providers/cloudflare-workers-ai.js +69 -0
- package/dist/providers/cohere/chat.d.ts +4 -0
- package/dist/providers/cohere/chat.js +3 -0
- package/dist/providers/cohere/embeddings.d.ts +2 -0
- package/dist/providers/cohere/embeddings.js +1 -0
- package/dist/providers/cohere.d.ts +502 -0
- package/dist/providers/cohere.js +55 -0
- package/dist/providers/deepgram.d.ts +22 -0
- package/dist/providers/deepgram.js +20 -0
- package/dist/providers/deepinfra/embeddings.d.ts +2 -0
- package/dist/providers/deepinfra/embeddings.js +1 -0
- package/dist/providers/deepinfra.d.ts +378 -0
- package/dist/providers/deepinfra.js +52 -0
- package/dist/providers/deepseek.d.ts +376 -0
- package/dist/providers/deepseek.js +30 -0
- package/dist/providers/digitalocean/decisions.d.ts +2 -0
- package/dist/providers/digitalocean/decisions.js +1 -0
- package/dist/providers/digitalocean/embeddings.d.ts +2 -0
- package/dist/providers/digitalocean/embeddings.js +1 -0
- package/dist/providers/digitalocean/images.d.ts +2 -0
- package/dist/providers/digitalocean/images.js +1 -0
- package/dist/providers/digitalocean/responses.d.ts +4 -0
- package/dist/providers/digitalocean/responses.js +1 -0
- package/dist/providers/digitalocean.d.ts +874 -0
- package/dist/providers/digitalocean.js +106 -0
- package/dist/providers/elevenlabs.d.ts +22 -0
- package/dist/providers/elevenlabs.js +22 -0
- package/dist/providers/fireworks/embeddings.d.ts +2 -0
- package/dist/providers/fireworks/embeddings.js +1 -0
- package/dist/providers/fireworks.d.ts +379 -0
- package/dist/providers/fireworks.js +40 -0
- package/dist/providers/google/decisions.d.ts +2 -0
- package/dist/providers/google/decisions.js +1 -0
- package/dist/providers/google/embeddings.d.ts +2 -0
- package/dist/providers/google/embeddings.js +1 -0
- package/dist/providers/google/images.d.ts +2 -0
- package/dist/providers/google/images.js +1 -0
- package/dist/providers/google/interactions.d.ts +7 -0
- package/dist/providers/google/interactions.js +3 -0
- package/dist/providers/google/videos.d.ts +2 -0
- package/dist/providers/google/videos.js +1 -0
- package/dist/providers/google-vertex/chat.d.ts +2 -0
- package/dist/providers/google-vertex/chat.js +1 -0
- package/dist/providers/google-vertex/embeddings.d.ts +2 -0
- package/dist/providers/google-vertex/embeddings.js +1 -0
- package/dist/providers/google-vertex/gemini.d.ts +2 -0
- package/dist/providers/google-vertex/gemini.js +1 -0
- package/dist/providers/google-vertex/images.d.ts +2 -0
- package/dist/providers/google-vertex/images.js +1 -0
- package/dist/providers/google-vertex/interactions.d.ts +2 -0
- package/dist/providers/google-vertex/interactions.js +1 -0
- package/dist/providers/google-vertex/messages.d.ts +2 -0
- package/dist/providers/google-vertex/messages.js +1 -0
- package/dist/providers/google-vertex/mistral.d.ts +2 -0
- package/dist/providers/google-vertex/mistral.js +1 -0
- package/dist/providers/google-vertex/responses.d.ts +2 -0
- package/dist/providers/google-vertex/responses.js +1 -0
- package/dist/providers/google-vertex-chat.d.ts +204 -0
- package/dist/providers/google-vertex-chat.js +29 -0
- package/dist/providers/google-vertex-interactions.d.ts +111 -0
- package/dist/providers/google-vertex-interactions.js +62 -0
- package/dist/providers/google-vertex-messages.d.ts +362 -0
- package/dist/providers/google-vertex-messages.js +51 -0
- package/dist/providers/google-vertex-mistral.d.ts +120 -0
- package/dist/providers/google-vertex-mistral.js +43 -0
- package/dist/providers/google-vertex-responses.d.ts +253 -0
- package/dist/providers/google-vertex-responses.js +30 -0
- package/dist/providers/google-vertex-shared.d.ts +58 -0
- package/dist/providers/google-vertex-shared.js +128 -0
- package/dist/providers/google-vertex.d.ts +132 -0
- package/dist/providers/google-vertex.js +161 -0
- package/dist/providers/google.d.ts +246 -0
- package/dist/providers/google.js +80 -0
- package/dist/providers/groq.d.ts +470 -0
- package/dist/providers/groq.js +63 -0
- package/dist/providers/index.d.ts +45 -0
- package/dist/providers/index.js +45 -0
- package/dist/providers/meta/chat.d.ts +2 -0
- package/dist/providers/meta/chat.js +1 -0
- package/dist/providers/meta/images.d.ts +2 -0
- package/dist/providers/meta/images.js +1 -0
- package/dist/providers/meta/messages.d.ts +2 -0
- package/dist/providers/meta/messages.js +1 -0
- package/dist/providers/meta/responses.d.ts +2 -0
- package/dist/providers/meta/responses.js +1 -0
- package/dist/providers/meta.d.ts +804 -0
- package/dist/providers/meta.js +96 -0
- package/dist/providers/minimax/chat.d.ts +4 -0
- package/dist/providers/minimax/chat.js +3 -0
- package/dist/providers/minimax/images.d.ts +3 -0
- package/dist/providers/minimax/images.js +1 -0
- package/dist/providers/minimax/messages.d.ts +1 -0
- package/dist/providers/minimax/messages.js +1 -0
- package/dist/providers/minimax/responses.d.ts +4 -0
- package/dist/providers/minimax/responses.js +3 -0
- package/dist/providers/minimax/videos.d.ts +3 -0
- package/dist/providers/minimax/videos.js +1 -0
- package/dist/providers/minimax.d.ts +798 -0
- package/dist/providers/minimax.js +99 -0
- package/dist/providers/mistral.d.ts +208 -0
- package/dist/providers/mistral.js +17 -0
- package/dist/providers/moonshot/chat.d.ts +1 -0
- package/dist/providers/moonshot/chat.js +1 -0
- package/dist/providers/moonshot/messages.d.ts +4 -0
- package/dist/providers/moonshot/messages.js +3 -0
- package/dist/providers/moonshot/responses.d.ts +4 -0
- package/dist/providers/moonshot/responses.js +3 -0
- package/dist/providers/moonshot.d.ts +785 -0
- package/dist/providers/moonshot.js +78 -0
- package/dist/providers/open-responses-options.d.ts +5 -0
- package/dist/providers/open-responses-options.js +1 -0
- package/dist/providers/openai/chat.d.ts +2 -0
- package/dist/providers/openai/chat.js +1 -0
- package/dist/providers/openai/embeddings.d.ts +2 -0
- package/dist/providers/openai/embeddings.js +1 -0
- package/dist/providers/openai/images.d.ts +2 -0
- package/dist/providers/openai/images.js +1 -0
- package/dist/providers/openai/responses.d.ts +2 -0
- package/dist/providers/openai/responses.js +1 -0
- package/dist/providers/openai-compatible/decisions.d.ts +2 -0
- package/dist/providers/openai-compatible/decisions.js +1 -0
- package/dist/providers/openai-compatible/embeddings.d.ts +2 -0
- package/dist/providers/openai-compatible/embeddings.js +1 -0
- package/dist/providers/openai-compatible/images.d.ts +2 -0
- package/dist/providers/openai-compatible/images.js +1 -0
- package/dist/providers/openai-compatible/responses.d.ts +1 -0
- package/dist/providers/openai-compatible/responses.js +1 -0
- package/dist/providers/openai-compatible-responses.d.ts +250 -0
- package/dist/providers/openai-compatible-responses.js +26 -0
- package/dist/providers/openai-compatible.d.ts +208 -0
- package/dist/providers/openai-compatible.js +71 -0
- package/dist/providers/openai-options.d.ts +21 -0
- package/dist/providers/openai-options.js +37 -0
- package/dist/providers/openai.d.ts +522 -0
- package/dist/providers/openai.js +118 -0
- package/dist/providers/opencode/decisions.d.ts +2 -0
- package/dist/providers/opencode/decisions.js +1 -0
- package/dist/providers/opencode.d.ts +23 -0
- package/dist/providers/opencode.js +25 -0
- package/dist/providers/openrouter/decisions.d.ts +2 -0
- package/dist/providers/openrouter/decisions.js +1 -0
- package/dist/providers/openrouter/embeddings.d.ts +2 -0
- package/dist/providers/openrouter/embeddings.js +1 -0
- package/dist/providers/openrouter/images.d.ts +2 -0
- package/dist/providers/openrouter/images.js +1 -0
- package/dist/providers/openrouter/responses.d.ts +3 -0
- package/dist/providers/openrouter/responses.js +1 -0
- package/dist/providers/openrouter/videos.d.ts +2 -0
- package/dist/providers/openrouter/videos.js +1 -0
- package/dist/providers/openrouter.d.ts +1204 -0
- package/dist/providers/openrouter.js +210 -0
- package/dist/providers/settings.d.ts +40 -0
- package/dist/providers/settings.js +18 -0
- package/dist/providers/togetherai.d.ts +375 -0
- package/dist/providers/togetherai.js +30 -0
- package/dist/providers/typesafe-ai/decisions.d.ts +2 -0
- package/dist/providers/typesafe-ai/decisions.js +1 -0
- package/dist/providers/typesafe-ai.d.ts +23 -0
- package/dist/providers/typesafe-ai.js +25 -0
- package/dist/providers/venice/responses.d.ts +4 -0
- package/dist/providers/venice/responses.js +1 -0
- package/dist/providers/venice.d.ts +632 -0
- package/dist/providers/venice.js +57 -0
- package/dist/providers/vercel-ai-gateway/chat.d.ts +2 -0
- package/dist/providers/vercel-ai-gateway/chat.js +1 -0
- package/dist/providers/vercel-ai-gateway/decisions.d.ts +2 -0
- package/dist/providers/vercel-ai-gateway/decisions.js +1 -0
- package/dist/providers/vercel-ai-gateway/embeddings.d.ts +2 -0
- package/dist/providers/vercel-ai-gateway/embeddings.js +1 -0
- package/dist/providers/vercel-ai-gateway/images.d.ts +2 -0
- package/dist/providers/vercel-ai-gateway/images.js +1 -0
- package/dist/providers/vercel-ai-gateway/messages.d.ts +2 -0
- package/dist/providers/vercel-ai-gateway/messages.js +1 -0
- package/dist/providers/vercel-ai-gateway/responses.d.ts +2 -0
- package/dist/providers/vercel-ai-gateway/responses.js +1 -0
- package/dist/providers/vercel-ai-gateway.d.ts +111 -0
- package/dist/providers/vercel-ai-gateway.js +181 -0
- package/dist/providers/volcengine/videos.d.ts +2 -0
- package/dist/providers/volcengine/videos.js +1 -0
- package/dist/providers/volcengine.d.ts +24 -0
- package/dist/providers/volcengine.js +21 -0
- package/dist/providers/xai/images.d.ts +2 -0
- package/dist/providers/xai/images.js +1 -0
- package/dist/providers/xai/videos.d.ts +2 -0
- package/dist/providers/xai/videos.js +1 -0
- package/dist/providers/xai.d.ts +235 -0
- package/dist/providers/xai.js +89 -0
- package/dist/providers/zai/chat.d.ts +1 -0
- package/dist/providers/zai/chat.js +1 -0
- package/dist/providers/zai/images.d.ts +2 -0
- package/dist/providers/zai/images.js +1 -0
- package/dist/providers/zai-coding-plan/chat.d.ts +1 -0
- package/dist/providers/zai-coding-plan/chat.js +1 -0
- package/dist/providers/zai-coding-plan/messages.d.ts +4 -0
- package/dist/providers/zai-coding-plan/messages.js +3 -0
- package/dist/providers/zai-coding-plan/responses.d.ts +4 -0
- package/dist/providers/zai-coding-plan/responses.js +3 -0
- package/dist/providers/zai-coding-plan.d.ts +846 -0
- package/dist/providers/zai-coding-plan.js +56 -0
- package/dist/providers/zai.d.ts +285 -0
- package/dist/providers/zai.js +44 -0
- package/dist/providers.d.ts +1 -0
- package/dist/providers.js +1 -0
- package/dist/public.d.ts +18 -0
- package/dist/public.js +7 -0
- package/dist/route/auth-options.d.ts +35 -0
- package/dist/route/auth-options.js +17 -0
- package/dist/route/auth.d.ts +52 -0
- package/dist/route/auth.js +92 -0
- package/dist/route/client.d.ts +229 -0
- package/dist/route/client.js +293 -0
- package/dist/route/decision.d.ts +55 -0
- package/dist/route/decision.js +73 -0
- package/dist/route/embedding.d.ts +58 -0
- package/dist/route/embedding.js +85 -0
- package/dist/route/endpoint.d.ts +29 -0
- package/dist/route/endpoint.js +21 -0
- package/dist/route/executor-service.d.ts +54 -0
- package/dist/route/executor-service.js +115 -0
- package/dist/route/executor.d.ts +37 -0
- package/dist/route/executor.js +225 -0
- package/dist/route/framing.d.ts +44 -0
- package/dist/route/framing.js +63 -0
- package/dist/route/index.d.ts +21 -0
- package/dist/route/index.js +18 -0
- package/dist/route/media-protocol.d.ts +187 -0
- package/dist/route/media-protocol.js +117 -0
- package/dist/route/media.d.ts +91 -0
- package/dist/route/media.js +251 -0
- package/dist/route/protocol.d.ts +85 -0
- package/dist/route/protocol.js +19 -0
- package/dist/route/transport/http.d.ts +34 -0
- package/dist/route/transport/http.js +67 -0
- package/dist/route/transport/index.d.ts +42 -0
- package/dist/route/transport/index.js +4 -0
- package/dist/route/transport/websocket-channel.d.ts +56 -0
- package/dist/route/transport/websocket-channel.js +1 -0
- package/dist/route/transport/websocket.d.ts +32 -0
- package/dist/route/transport/websocket.js +315 -0
- package/dist/route.d.ts +1 -0
- package/dist/route.js +1 -0
- package/dist/schema/errors.d.ts +194 -0
- package/dist/schema/errors.js +217 -0
- package/dist/schema/events.d.ts +11001 -0
- package/dist/schema/events.js +542 -0
- package/dist/schema/ids.d.ts +17 -0
- package/dist/schema/ids.js +10 -0
- package/dist/schema/index.d.ts +5 -0
- package/dist/schema/index.js +5 -0
- package/dist/schema/messages.d.ts +2706 -0
- package/dist/schema/messages.js +344 -0
- package/dist/schema/options.d.ts +270 -0
- package/dist/schema/options.js +198 -0
- package/dist/speech.d.ts +266 -0
- package/dist/speech.js +114 -0
- package/dist/test-ai.d.ts +15 -0
- package/dist/test-ai.js +49 -0
- package/dist/testing.d.ts +1585 -0
- package/dist/testing.js +108 -0
- package/dist/tool-history.d.ts +2 -0
- package/dist/tool-history.js +91 -0
- package/dist/tool-runtime.d.ts +22 -0
- package/dist/tool-runtime.js +55 -0
- package/dist/tool-updates.d.ts +34 -0
- package/dist/tool-updates.js +93 -0
- package/dist/tool.d.ts +150 -0
- package/dist/tool.js +159 -0
- package/dist/transcription.d.ts +254 -0
- package/dist/transcription.js +119 -0
- package/dist/utils/bytes.d.ts +1 -0
- package/dist/utils/bytes.js +10 -0
- package/dist/utils/json.d.ts +4 -0
- package/dist/utils/json.js +4 -0
- package/dist/utils/media-type.d.ts +8 -0
- package/dist/utils/media-type.js +93 -0
- package/dist/utils/provider-codes.d.ts +3 -0
- package/dist/utils/provider-codes.js +41 -0
- package/dist/utils/record.d.ts +2 -0
- package/dist/utils/record.js +2 -0
- package/dist/utils/sanitize.d.ts +5 -0
- package/dist/utils/sanitize.js +31 -0
- package/dist/video-client.d.ts +12 -0
- package/dist/video-client.js +24 -0
- package/dist/video.d.ts +178 -0
- package/dist/video.js +79 -0
- package/package.json +648 -4
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { MediaProtocol } from "../route/media-protocol.js";
|
|
2
|
+
import { MediaRoute } from "../route/media.js";
|
|
3
|
+
import { SpeechModel, type SpeechRequest } from "../speech.js";
|
|
4
|
+
import { GeminiGenerateContent } from "./utils/gemini-generate-content.js";
|
|
5
|
+
import { SpeechStream } from "./utils/speech-stream.js";
|
|
6
|
+
export declare const DEFAULT_BASE_URL = "https://generativelanguage.googleapis.com/v1beta";
|
|
7
|
+
/** Style is directed in the text itself, and `speechConfig.multiSpeakerVoiceConfig` excludes `voice`. */
|
|
8
|
+
export type GoogleSpeechOptions = {
|
|
9
|
+
readonly temperature?: number;
|
|
10
|
+
readonly seed?: number;
|
|
11
|
+
readonly speechConfig?: {
|
|
12
|
+
readonly multiSpeakerVoiceConfig?: {
|
|
13
|
+
readonly speakerVoiceConfigs: ReadonlyArray<{
|
|
14
|
+
readonly speaker: string;
|
|
15
|
+
readonly voiceConfig: {
|
|
16
|
+
readonly prebuiltVoiceConfig: {
|
|
17
|
+
readonly voiceName: string;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
}>;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
} & Record<string, unknown>;
|
|
24
|
+
export type Request = SpeechRequest<SpeechModel<GoogleSpeechOptions>>;
|
|
25
|
+
interface State extends SpeechStream.Audio, GeminiGenerateContent.Metadata {
|
|
26
|
+
readonly mimeType?: string;
|
|
27
|
+
}
|
|
28
|
+
export declare const protocol: MediaProtocol.Streamed<Request, {
|
|
29
|
+
readonly type: "audio-delta";
|
|
30
|
+
readonly chunk: Uint8Array<ArrayBufferLike>;
|
|
31
|
+
} | {
|
|
32
|
+
readonly type: "timestamps";
|
|
33
|
+
readonly items: readonly {
|
|
34
|
+
readonly text: string;
|
|
35
|
+
readonly startSeconds: number;
|
|
36
|
+
readonly endSeconds: number;
|
|
37
|
+
}[];
|
|
38
|
+
} | {
|
|
39
|
+
readonly type: "generation-progress";
|
|
40
|
+
readonly id: string;
|
|
41
|
+
readonly progress?: number | undefined;
|
|
42
|
+
} | {
|
|
43
|
+
readonly type: "finish";
|
|
44
|
+
readonly audio: import("../media.js").Asset;
|
|
45
|
+
readonly usage?: {
|
|
46
|
+
readonly type: "seconds";
|
|
47
|
+
readonly seconds: number;
|
|
48
|
+
} | {
|
|
49
|
+
readonly type: "characters";
|
|
50
|
+
readonly characters: number;
|
|
51
|
+
} | {
|
|
52
|
+
readonly type: "credits";
|
|
53
|
+
readonly credits: number;
|
|
54
|
+
} | {
|
|
55
|
+
readonly type: "compute";
|
|
56
|
+
readonly seconds: number;
|
|
57
|
+
} | {
|
|
58
|
+
readonly type: "tokens";
|
|
59
|
+
readonly input?: number | undefined;
|
|
60
|
+
readonly output?: number | undefined;
|
|
61
|
+
readonly total?: number | undefined;
|
|
62
|
+
readonly details?: {
|
|
63
|
+
readonly [x: string]: unknown;
|
|
64
|
+
} | undefined;
|
|
65
|
+
} | undefined;
|
|
66
|
+
readonly providerMetadata?: {
|
|
67
|
+
readonly [x: string]: {
|
|
68
|
+
readonly [x: string]: unknown;
|
|
69
|
+
};
|
|
70
|
+
} | undefined;
|
|
71
|
+
}, string, State>;
|
|
72
|
+
export declare const model: (input: MediaRoute.ModelInput) => SpeechModel<GoogleSpeechOptions>;
|
|
73
|
+
export declare const GoogleSpeech: {
|
|
74
|
+
readonly protocol: MediaProtocol.Streamed<Request, {
|
|
75
|
+
readonly type: "audio-delta";
|
|
76
|
+
readonly chunk: Uint8Array<ArrayBufferLike>;
|
|
77
|
+
} | {
|
|
78
|
+
readonly type: "timestamps";
|
|
79
|
+
readonly items: readonly {
|
|
80
|
+
readonly text: string;
|
|
81
|
+
readonly startSeconds: number;
|
|
82
|
+
readonly endSeconds: number;
|
|
83
|
+
}[];
|
|
84
|
+
} | {
|
|
85
|
+
readonly type: "generation-progress";
|
|
86
|
+
readonly id: string;
|
|
87
|
+
readonly progress?: number | undefined;
|
|
88
|
+
} | {
|
|
89
|
+
readonly type: "finish";
|
|
90
|
+
readonly audio: import("../media.js").Asset;
|
|
91
|
+
readonly usage?: {
|
|
92
|
+
readonly type: "seconds";
|
|
93
|
+
readonly seconds: number;
|
|
94
|
+
} | {
|
|
95
|
+
readonly type: "characters";
|
|
96
|
+
readonly characters: number;
|
|
97
|
+
} | {
|
|
98
|
+
readonly type: "credits";
|
|
99
|
+
readonly credits: number;
|
|
100
|
+
} | {
|
|
101
|
+
readonly type: "compute";
|
|
102
|
+
readonly seconds: number;
|
|
103
|
+
} | {
|
|
104
|
+
readonly type: "tokens";
|
|
105
|
+
readonly input?: number | undefined;
|
|
106
|
+
readonly output?: number | undefined;
|
|
107
|
+
readonly total?: number | undefined;
|
|
108
|
+
readonly details?: {
|
|
109
|
+
readonly [x: string]: unknown;
|
|
110
|
+
} | undefined;
|
|
111
|
+
} | undefined;
|
|
112
|
+
readonly providerMetadata?: {
|
|
113
|
+
readonly [x: string]: {
|
|
114
|
+
readonly [x: string]: unknown;
|
|
115
|
+
};
|
|
116
|
+
} | undefined;
|
|
117
|
+
}, string, State>;
|
|
118
|
+
readonly model: typeof model;
|
|
119
|
+
};
|
|
120
|
+
export {};
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { Effect, Schema } from "effect";
|
|
2
|
+
import { MediaProtocol } from "../route/media-protocol.js";
|
|
3
|
+
import { MediaRoute } from "../route/media.js";
|
|
4
|
+
import { mergeJsonRecords } from "../schema/index.js";
|
|
5
|
+
import { SpeechModel } from "../speech.js";
|
|
6
|
+
import { GeminiGenerateContent } from "./utils/gemini-generate-content.js";
|
|
7
|
+
import { SpeechStream } from "./utils/speech-stream.js";
|
|
8
|
+
const route = MediaProtocol.identity({ id: "google-speech", name: "Google Speech", provider: "google" });
|
|
9
|
+
export const DEFAULT_BASE_URL = "https://generativelanguage.googleapis.com/v1beta";
|
|
10
|
+
const DEFAULT_SAMPLE_RATE = 24000;
|
|
11
|
+
// ---------------------------------------------------------------------------
|
|
12
|
+
// 3. Streaming event schema
|
|
13
|
+
// ---------------------------------------------------------------------------
|
|
14
|
+
const GenerateContentChunk = GeminiGenerateContent.chunk(Schema.Struct({
|
|
15
|
+
text: Schema.optional(Schema.String),
|
|
16
|
+
inlineData: Schema.optional(Schema.Struct({ mimeType: Schema.String, data: Schema.Uint8ArrayFromBase64 })),
|
|
17
|
+
}));
|
|
18
|
+
const decodeChunk = route.decodeFrame(GenerateContentChunk);
|
|
19
|
+
// ---------------------------------------------------------------------------
|
|
20
|
+
// 5. Request body construction
|
|
21
|
+
// ---------------------------------------------------------------------------
|
|
22
|
+
const fromRequest = Effect.fn("GoogleSpeech.fromRequest")(function* (request) {
|
|
23
|
+
// Not in `unsupported`: that list would also reject `timestamps: false`, which asks for nothing.
|
|
24
|
+
if (request.timestamps === true)
|
|
25
|
+
return yield* route.unsupported("media.timestamps", `${route.name} does not return timestamps`);
|
|
26
|
+
if (request.format === "pcm" && request.mode === "generate" && /^gemini-3\.8-.*-tts(?:-|$)/.test(request.model.id))
|
|
27
|
+
return yield* route.unsupported("media.format", `${route.name} returns WAV by default for Gemini 3.8 TTS unary requests; omit the format to accept it`);
|
|
28
|
+
if (request.format !== undefined && request.format !== "pcm")
|
|
29
|
+
return yield* route.unsupported("media.format", `${route.name} only accepts raw PCM as an explicit format; omit it to accept the provider's default output`);
|
|
30
|
+
const voiceName = SpeechStream.voiceID(request.voice);
|
|
31
|
+
return MediaProtocol.json(mergeJsonRecords({
|
|
32
|
+
contents: [{ role: "user", parts: [{ text: request.text }] }],
|
|
33
|
+
generationConfig: mergeJsonRecords({
|
|
34
|
+
responseModalities: ["AUDIO"],
|
|
35
|
+
speechConfig: {
|
|
36
|
+
voiceConfig: voiceName === undefined ? undefined : { prebuiltVoiceConfig: { voiceName } },
|
|
37
|
+
languageCode: request.language,
|
|
38
|
+
},
|
|
39
|
+
}, request.providerOptions),
|
|
40
|
+
}, request.http?.body) ?? {});
|
|
41
|
+
});
|
|
42
|
+
// ---------------------------------------------------------------------------
|
|
43
|
+
// 6. Stream parsing
|
|
44
|
+
// ---------------------------------------------------------------------------
|
|
45
|
+
const step = Effect.fnUntraced(function* (state, frame) {
|
|
46
|
+
const chunk = yield* decodeChunk(frame);
|
|
47
|
+
const blocked = GeminiGenerateContent.blocked(route.name, chunk, frame);
|
|
48
|
+
if (blocked !== undefined)
|
|
49
|
+
return yield* blocked;
|
|
50
|
+
const audio = (chunk.candidates?.[0]?.content?.parts ?? []).flatMap((part) => part.inlineData === undefined ? [] : [part.inlineData]);
|
|
51
|
+
const next = { ...GeminiGenerateContent.track(state, chunk), mimeType: state.mimeType ?? audio[0]?.mimeType };
|
|
52
|
+
const events = audio.flatMap((part) => SpeechStream.delta(next, part.data)[1]);
|
|
53
|
+
const withheld = next.chunks.length === 0 ? GeminiGenerateContent.withheld(route.name, chunk, frame) : undefined;
|
|
54
|
+
if (withheld !== undefined)
|
|
55
|
+
return yield* withheld;
|
|
56
|
+
return [next, events];
|
|
57
|
+
});
|
|
58
|
+
const finish = (state, context) => {
|
|
59
|
+
if (state.finishReason === undefined)
|
|
60
|
+
return Effect.fail(route.incomplete());
|
|
61
|
+
const sampleRate = SpeechStream.sampleRate(state.mimeType) ?? DEFAULT_SAMPLE_RATE;
|
|
62
|
+
const output = state.mimeType?.split(";")[0]?.toLowerCase() === "audio/wav"
|
|
63
|
+
? SpeechStream.container("wav", sampleRate)
|
|
64
|
+
: SpeechStream.pcm("pcm_s16le", sampleRate, state.mimeType ?? `audio/L16;codec=pcm;rate=${sampleRate}`);
|
|
65
|
+
if (context.request.format === "pcm" && output.info.format !== "pcm")
|
|
66
|
+
return Effect.fail(route.frameError(`Google Speech returned ${output.info.format} instead of the requested raw PCM`));
|
|
67
|
+
return SpeechStream.finish(route, state, {
|
|
68
|
+
...output,
|
|
69
|
+
usage: GeminiGenerateContent.usage(state.usage),
|
|
70
|
+
providerMetadata: GeminiGenerateContent.providerMetadata(state),
|
|
71
|
+
detail: `finish reason: ${state.finishReason}`,
|
|
72
|
+
});
|
|
73
|
+
};
|
|
74
|
+
// ---------------------------------------------------------------------------
|
|
75
|
+
// 7. Protocol and route
|
|
76
|
+
// ---------------------------------------------------------------------------
|
|
77
|
+
export const protocol = MediaProtocol.stream(route, {
|
|
78
|
+
unsupported: ["instructions", "speed"],
|
|
79
|
+
body: { from: fromRequest },
|
|
80
|
+
frames: (bytes, context) => GeminiGenerateContent.frames(bytes, context.request.mode),
|
|
81
|
+
initial: () => ({ chunks: [] }),
|
|
82
|
+
step,
|
|
83
|
+
finish,
|
|
84
|
+
});
|
|
85
|
+
export const model = (input) => SpeechModel.fromRoute({
|
|
86
|
+
protocol,
|
|
87
|
+
baseURL: DEFAULT_BASE_URL,
|
|
88
|
+
// Only `gemini-3.1-flash-tts-preview` and later stream; earlier TTS models reject `streamGenerateContent`.
|
|
89
|
+
path: ({ request }) => GeminiGenerateContent.path(request.model.id, request.mode),
|
|
90
|
+
}, input);
|
|
91
|
+
export const GoogleSpeech = {
|
|
92
|
+
protocol,
|
|
93
|
+
model,
|
|
94
|
+
};
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { MediaProtocol } from "../route/media-protocol.js";
|
|
2
|
+
import { MediaRoute } from "../route/media.js";
|
|
3
|
+
import { type OpenString } from "../schema/index.js";
|
|
4
|
+
import { TranscriptionModel, type TranscriptionRequest, type TranscriptionSegment, type TranscriptionWord } from "../transcription.js";
|
|
5
|
+
import { GeminiGenerateContent } from "./utils/gemini-generate-content.js";
|
|
6
|
+
export declare const DEFAULT_BASE_URL = "https://generativelanguage.googleapis.com/v1beta";
|
|
7
|
+
/**
|
|
8
|
+
* Merged into `generationConfig`. The API rejects `customVocabulary` and `mode: "SMART"` alongside diarization or word
|
|
9
|
+
* timestamps.
|
|
10
|
+
*/
|
|
11
|
+
export type GoogleTranscriptionOptions = {
|
|
12
|
+
readonly audioTranscriptionConfig?: {
|
|
13
|
+
readonly mode?: OpenString<"VERBATIM" | "SMART">;
|
|
14
|
+
readonly customVocabulary?: ReadonlyArray<string>;
|
|
15
|
+
readonly languageCodes?: ReadonlyArray<string>;
|
|
16
|
+
};
|
|
17
|
+
} & Record<string, unknown>;
|
|
18
|
+
export type Request = TranscriptionRequest<TranscriptionModel<GoogleTranscriptionOptions>>;
|
|
19
|
+
interface State extends GeminiGenerateContent.Metadata {
|
|
20
|
+
readonly text: string;
|
|
21
|
+
readonly segments: Array<TranscriptionSegment>;
|
|
22
|
+
readonly words: Array<TranscriptionWord>;
|
|
23
|
+
}
|
|
24
|
+
export declare const protocol: MediaProtocol.Streamed<Request, {
|
|
25
|
+
readonly type: "text-delta";
|
|
26
|
+
readonly delta: string;
|
|
27
|
+
} | {
|
|
28
|
+
readonly type: "segment";
|
|
29
|
+
readonly segment: {
|
|
30
|
+
readonly text: string;
|
|
31
|
+
readonly startSeconds: number;
|
|
32
|
+
readonly endSeconds: number;
|
|
33
|
+
readonly speaker?: string | undefined;
|
|
34
|
+
};
|
|
35
|
+
} | {
|
|
36
|
+
readonly type: "generation-progress";
|
|
37
|
+
readonly id: string;
|
|
38
|
+
readonly progress?: number | undefined;
|
|
39
|
+
} | {
|
|
40
|
+
readonly text: string;
|
|
41
|
+
readonly segments?: readonly {
|
|
42
|
+
readonly text: string;
|
|
43
|
+
readonly startSeconds: number;
|
|
44
|
+
readonly endSeconds: number;
|
|
45
|
+
readonly speaker?: string | undefined;
|
|
46
|
+
}[] | undefined;
|
|
47
|
+
readonly words?: readonly {
|
|
48
|
+
readonly text: string;
|
|
49
|
+
readonly startSeconds: number;
|
|
50
|
+
readonly endSeconds: number;
|
|
51
|
+
readonly speaker?: string | undefined;
|
|
52
|
+
readonly confidence?: number | undefined;
|
|
53
|
+
}[] | undefined;
|
|
54
|
+
readonly language?: string | undefined;
|
|
55
|
+
readonly durationSeconds?: number | undefined;
|
|
56
|
+
readonly usage?: {
|
|
57
|
+
readonly type: "seconds";
|
|
58
|
+
readonly seconds: number;
|
|
59
|
+
} | {
|
|
60
|
+
readonly type: "characters";
|
|
61
|
+
readonly characters: number;
|
|
62
|
+
} | {
|
|
63
|
+
readonly type: "credits";
|
|
64
|
+
readonly credits: number;
|
|
65
|
+
} | {
|
|
66
|
+
readonly type: "compute";
|
|
67
|
+
readonly seconds: number;
|
|
68
|
+
} | {
|
|
69
|
+
readonly type: "tokens";
|
|
70
|
+
readonly input?: number | undefined;
|
|
71
|
+
readonly output?: number | undefined;
|
|
72
|
+
readonly total?: number | undefined;
|
|
73
|
+
readonly details?: {
|
|
74
|
+
readonly [x: string]: unknown;
|
|
75
|
+
} | undefined;
|
|
76
|
+
} | undefined;
|
|
77
|
+
readonly providerMetadata?: {
|
|
78
|
+
readonly [x: string]: {
|
|
79
|
+
readonly [x: string]: unknown;
|
|
80
|
+
};
|
|
81
|
+
} | undefined;
|
|
82
|
+
readonly type: "finish";
|
|
83
|
+
}, string, State>;
|
|
84
|
+
export declare const model: (input: MediaRoute.ModelInput) => TranscriptionModel<GoogleTranscriptionOptions>;
|
|
85
|
+
export declare const GoogleTranscription: {
|
|
86
|
+
readonly protocol: MediaProtocol.Streamed<Request, {
|
|
87
|
+
readonly type: "text-delta";
|
|
88
|
+
readonly delta: string;
|
|
89
|
+
} | {
|
|
90
|
+
readonly type: "segment";
|
|
91
|
+
readonly segment: {
|
|
92
|
+
readonly text: string;
|
|
93
|
+
readonly startSeconds: number;
|
|
94
|
+
readonly endSeconds: number;
|
|
95
|
+
readonly speaker?: string | undefined;
|
|
96
|
+
};
|
|
97
|
+
} | {
|
|
98
|
+
readonly type: "generation-progress";
|
|
99
|
+
readonly id: string;
|
|
100
|
+
readonly progress?: number | undefined;
|
|
101
|
+
} | {
|
|
102
|
+
readonly text: string;
|
|
103
|
+
readonly segments?: readonly {
|
|
104
|
+
readonly text: string;
|
|
105
|
+
readonly startSeconds: number;
|
|
106
|
+
readonly endSeconds: number;
|
|
107
|
+
readonly speaker?: string | undefined;
|
|
108
|
+
}[] | undefined;
|
|
109
|
+
readonly words?: readonly {
|
|
110
|
+
readonly text: string;
|
|
111
|
+
readonly startSeconds: number;
|
|
112
|
+
readonly endSeconds: number;
|
|
113
|
+
readonly speaker?: string | undefined;
|
|
114
|
+
readonly confidence?: number | undefined;
|
|
115
|
+
}[] | undefined;
|
|
116
|
+
readonly language?: string | undefined;
|
|
117
|
+
readonly durationSeconds?: number | undefined;
|
|
118
|
+
readonly usage?: {
|
|
119
|
+
readonly type: "seconds";
|
|
120
|
+
readonly seconds: number;
|
|
121
|
+
} | {
|
|
122
|
+
readonly type: "characters";
|
|
123
|
+
readonly characters: number;
|
|
124
|
+
} | {
|
|
125
|
+
readonly type: "credits";
|
|
126
|
+
readonly credits: number;
|
|
127
|
+
} | {
|
|
128
|
+
readonly type: "compute";
|
|
129
|
+
readonly seconds: number;
|
|
130
|
+
} | {
|
|
131
|
+
readonly type: "tokens";
|
|
132
|
+
readonly input?: number | undefined;
|
|
133
|
+
readonly output?: number | undefined;
|
|
134
|
+
readonly total?: number | undefined;
|
|
135
|
+
readonly details?: {
|
|
136
|
+
readonly [x: string]: unknown;
|
|
137
|
+
} | undefined;
|
|
138
|
+
} | undefined;
|
|
139
|
+
readonly providerMetadata?: {
|
|
140
|
+
readonly [x: string]: {
|
|
141
|
+
readonly [x: string]: unknown;
|
|
142
|
+
};
|
|
143
|
+
} | undefined;
|
|
144
|
+
readonly type: "finish";
|
|
145
|
+
}, string, State>;
|
|
146
|
+
readonly model: typeof model;
|
|
147
|
+
};
|
|
148
|
+
export {};
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { Effect, Schema, SchemaGetter } from "effect";
|
|
2
|
+
import { MediaProtocol } from "../route/media-protocol.js";
|
|
3
|
+
import { MediaRoute } from "../route/media.js";
|
|
4
|
+
import { mergeJsonRecords } from "../schema/index.js";
|
|
5
|
+
import { TranscriptionFinishEvent, TranscriptionModel, TranscriptionSegmentEvent, TranscriptionTextDeltaEvent, } from "../transcription.js";
|
|
6
|
+
import { GeminiGenerateContent } from "./utils/gemini-generate-content.js";
|
|
7
|
+
const route = MediaProtocol.identity({ id: "google-transcription", name: "Google Transcription", provider: "google" });
|
|
8
|
+
export const DEFAULT_BASE_URL = "https://generativelanguage.googleapis.com/v1beta";
|
|
9
|
+
// ---------------------------------------------------------------------------
|
|
10
|
+
// 3. Streaming event schema
|
|
11
|
+
// ---------------------------------------------------------------------------
|
|
12
|
+
const Seconds = Schema.String.check(Schema.isPattern(/^\d+(\.\d+)?s$/)).pipe(Schema.decodeTo(Schema.Number, {
|
|
13
|
+
decode: SchemaGetter.transform((value) => Number.parseFloat(value)),
|
|
14
|
+
encode: SchemaGetter.transform((value) => `${value}s`),
|
|
15
|
+
}));
|
|
16
|
+
const AudioTranscription = Schema.Struct({
|
|
17
|
+
text: Schema.String,
|
|
18
|
+
speakerLabel: Schema.optional(Schema.String),
|
|
19
|
+
words: Schema.optional(Schema.Array(Schema.Struct({
|
|
20
|
+
word: Schema.String,
|
|
21
|
+
startOffset: Seconds,
|
|
22
|
+
endOffset: Seconds,
|
|
23
|
+
speakerLabel: Schema.optional(Schema.String),
|
|
24
|
+
}))),
|
|
25
|
+
});
|
|
26
|
+
const decodeChunk = route.decodeFrame(GeminiGenerateContent.chunk(Schema.Struct({ audioTranscription: Schema.optional(AudioTranscription) })));
|
|
27
|
+
// ---------------------------------------------------------------------------
|
|
28
|
+
// 5. Request body construction
|
|
29
|
+
// ---------------------------------------------------------------------------
|
|
30
|
+
const fromRequest = Effect.fn("GoogleTranscription.fromRequest")(function* (request) {
|
|
31
|
+
// General Gemini models ignore `audioTranscriptionConfig` and answer the audio conversationally.
|
|
32
|
+
if (!request.model.id.includes("transcribe"))
|
|
33
|
+
return yield* route.unsupported("transcription.model", `${request.model.id} is not a transcription model; use a transcribe model such as gemini-3.5-transcribe`);
|
|
34
|
+
return MediaProtocol.json(mergeJsonRecords({
|
|
35
|
+
contents: [{ role: "user", parts: [yield* GeminiGenerateContent.mediaPart(route.id, request.audio)] }],
|
|
36
|
+
generationConfig: mergeJsonRecords({
|
|
37
|
+
audioTranscriptionConfig: {
|
|
38
|
+
languageCodes: request.language === undefined ? undefined : [request.language],
|
|
39
|
+
// Parts carry no offsets of their own, so segment times come from word offsets.
|
|
40
|
+
wordTimestamp: request.diarize === true || request.timestamps === "word" || request.timestamps === "segment"
|
|
41
|
+
? true
|
|
42
|
+
: undefined,
|
|
43
|
+
diarization: request.diarize === true ? true : undefined,
|
|
44
|
+
},
|
|
45
|
+
}, request.providerOptions),
|
|
46
|
+
}, request.http?.body) ?? {});
|
|
47
|
+
});
|
|
48
|
+
// ---------------------------------------------------------------------------
|
|
49
|
+
// 6. Stream parsing
|
|
50
|
+
// ---------------------------------------------------------------------------
|
|
51
|
+
const turn = (part) => {
|
|
52
|
+
const words = (part.words ?? []).map((word) => ({
|
|
53
|
+
text: word.word,
|
|
54
|
+
startSeconds: word.startOffset,
|
|
55
|
+
endSeconds: word.endOffset,
|
|
56
|
+
speaker: word.speakerLabel ?? part.speakerLabel,
|
|
57
|
+
}));
|
|
58
|
+
const first = words[0];
|
|
59
|
+
const last = words.at(-1);
|
|
60
|
+
return {
|
|
61
|
+
text: part.text,
|
|
62
|
+
words,
|
|
63
|
+
segment: first === undefined || last === undefined
|
|
64
|
+
? undefined
|
|
65
|
+
: {
|
|
66
|
+
text: part.text,
|
|
67
|
+
startSeconds: first.startSeconds,
|
|
68
|
+
endSeconds: last.endSeconds,
|
|
69
|
+
speaker: part.speakerLabel,
|
|
70
|
+
},
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
const step = Effect.fnUntraced(function* (state, frame) {
|
|
74
|
+
const chunk = yield* decodeChunk(frame);
|
|
75
|
+
const blocked = GeminiGenerateContent.blocked(route.name, chunk, frame);
|
|
76
|
+
if (blocked !== undefined)
|
|
77
|
+
return yield* blocked;
|
|
78
|
+
const turns = (chunk.candidates?.[0]?.content?.parts ?? []).flatMap((part) => part.audioTranscription === undefined ? [] : [turn(part.audioTranscription)]);
|
|
79
|
+
const segments = turns.flatMap((item) => (item.segment === undefined ? [] : [item.segment]));
|
|
80
|
+
state.words.push(...turns.flatMap((item) => item.words));
|
|
81
|
+
state.segments.push(...segments);
|
|
82
|
+
// Each part is one whole speaker turn without surrounding whitespace, so turns join with a space.
|
|
83
|
+
const text = turns
|
|
84
|
+
.map((item) => item.text)
|
|
85
|
+
.filter((item) => item.length > 0)
|
|
86
|
+
.join(" ");
|
|
87
|
+
const delta = text.length === 0 || state.text.length === 0 ? text : ` ${text}`;
|
|
88
|
+
const withheld = state.text.length + delta.length === 0 ? GeminiGenerateContent.withheld(route.name, chunk, frame) : undefined;
|
|
89
|
+
if (withheld !== undefined)
|
|
90
|
+
return yield* withheld;
|
|
91
|
+
const events = [
|
|
92
|
+
...(delta.length === 0 ? [] : [TranscriptionTextDeltaEvent.make({ delta })]),
|
|
93
|
+
...segments.map((segment) => TranscriptionSegmentEvent.make({ segment })),
|
|
94
|
+
];
|
|
95
|
+
return [{ ...GeminiGenerateContent.track(state, chunk), text: state.text + delta }, events];
|
|
96
|
+
});
|
|
97
|
+
const finish = (state) => {
|
|
98
|
+
if (state.finishReason === undefined)
|
|
99
|
+
return Effect.fail(route.incomplete());
|
|
100
|
+
return Effect.succeed([
|
|
101
|
+
TranscriptionFinishEvent.make({
|
|
102
|
+
text: state.text,
|
|
103
|
+
segments: state.segments.length === 0 ? undefined : state.segments,
|
|
104
|
+
words: state.words.length === 0 ? undefined : state.words,
|
|
105
|
+
usage: GeminiGenerateContent.usage(state.usage),
|
|
106
|
+
providerMetadata: GeminiGenerateContent.providerMetadata(state),
|
|
107
|
+
}),
|
|
108
|
+
]);
|
|
109
|
+
};
|
|
110
|
+
// ---------------------------------------------------------------------------
|
|
111
|
+
// 7. Protocol and route
|
|
112
|
+
// ---------------------------------------------------------------------------
|
|
113
|
+
export const protocol = MediaProtocol.stream(route, {
|
|
114
|
+
unsupported: ["prompt", "speakers"],
|
|
115
|
+
body: { from: fromRequest },
|
|
116
|
+
frames: (bytes, context) => GeminiGenerateContent.frames(bytes, context.request.mode),
|
|
117
|
+
initial: () => ({ text: "", segments: [], words: [] }),
|
|
118
|
+
step,
|
|
119
|
+
finish,
|
|
120
|
+
});
|
|
121
|
+
export const model = (input) => TranscriptionModel.fromRoute({
|
|
122
|
+
protocol,
|
|
123
|
+
baseURL: DEFAULT_BASE_URL,
|
|
124
|
+
path: ({ request }) => GeminiGenerateContent.path(request.model.id, request.mode),
|
|
125
|
+
}, input);
|
|
126
|
+
export const GoogleTranscription = {
|
|
127
|
+
protocol,
|
|
128
|
+
model,
|
|
129
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { EmbeddingRoute } from "../route/embedding.js";
|
|
2
|
+
import type { TaskType } from "./google-embed-content.js";
|
|
3
|
+
/** `text-embedding-005` and `text-multilingual-embedding-002` take up to 250 instances per request. */
|
|
4
|
+
export declare const MAX_INSTANCES = 250;
|
|
5
|
+
/**
|
|
6
|
+
* The same option names as `embedContent`, so a model can move between the two APIs: `taskType` and `title` go on
|
|
7
|
+
* each instance (`task_type`, `title`), and `autoTruncate` and anything else go under `parameters`.
|
|
8
|
+
*/
|
|
9
|
+
export interface OptionsInput {
|
|
10
|
+
readonly [key: string]: unknown;
|
|
11
|
+
readonly taskType?: TaskType;
|
|
12
|
+
readonly title?: string;
|
|
13
|
+
readonly autoTruncate?: boolean;
|
|
14
|
+
}
|
|
15
|
+
export declare const protocol: EmbeddingRoute.Protocol;
|
|
16
|
+
export declare const GoogleVertexPredictEmbeddings: {
|
|
17
|
+
readonly protocol: EmbeddingRoute.Protocol;
|
|
18
|
+
};
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { Effect, Schema } from "effect";
|
|
2
|
+
import { EmbeddingResponse, EmbeddingUsage } from "../embedding.js";
|
|
3
|
+
import { EmbeddingRoute } from "../route/embedding.js";
|
|
4
|
+
import { MediaProtocol } from "../route/media-protocol.js";
|
|
5
|
+
import { AIError, UnsupportedOperationError, mergeJsonRecords } from "../schema/index.js";
|
|
6
|
+
const ID = "google-vertex-predict-embeddings";
|
|
7
|
+
const NAME = "Google Vertex text embeddings";
|
|
8
|
+
/** `text-embedding-005` and `text-multilingual-embedding-002` take up to 250 instances per request. */
|
|
9
|
+
export const MAX_INSTANCES = 250;
|
|
10
|
+
const Statistics = Schema.StructWithRest(Schema.Struct({ token_count: Schema.optional(Schema.Number), truncated: Schema.optional(Schema.Boolean) }), [Schema.Record(Schema.String, Schema.Unknown)]);
|
|
11
|
+
const Response = Schema.Struct({
|
|
12
|
+
predictions: Schema.Array(Schema.Struct({
|
|
13
|
+
embeddings: Schema.Struct({ values: Schema.Array(Schema.Number), statistics: Schema.optional(Statistics) }),
|
|
14
|
+
})),
|
|
15
|
+
metadata: Schema.optional(Schema.Record(Schema.String, Schema.Unknown)),
|
|
16
|
+
});
|
|
17
|
+
const TASK_TYPES = { query: "RETRIEVAL_QUERY", document: "RETRIEVAL_DOCUMENT" };
|
|
18
|
+
const fromRequest = Effect.fn("GoogleVertexPredictEmbeddings.fromRequest")(function* (request) {
|
|
19
|
+
const contents = request.values.filter((value) => typeof value === "string");
|
|
20
|
+
if (contents.length !== request.values.length)
|
|
21
|
+
return yield* new AIError({
|
|
22
|
+
reason: new UnsupportedOperationError({
|
|
23
|
+
operation: "embedding.media",
|
|
24
|
+
provider: request.model.provider,
|
|
25
|
+
route: request.model.route.id,
|
|
26
|
+
message: `${request.model.id} on Vertex :predict embeds text only; use gemini-embedding-2 for media values`,
|
|
27
|
+
}),
|
|
28
|
+
});
|
|
29
|
+
const { taskType, title, ...parameters } = request.providerOptions ?? {};
|
|
30
|
+
const instance = {
|
|
31
|
+
...(taskType === undefined
|
|
32
|
+
? request.inputType === undefined
|
|
33
|
+
? {}
|
|
34
|
+
: { task_type: TASK_TYPES[request.inputType] }
|
|
35
|
+
: { task_type: taskType }),
|
|
36
|
+
...(title === undefined ? {} : { title }),
|
|
37
|
+
};
|
|
38
|
+
const merged = {
|
|
39
|
+
...(request.dimensions === undefined ? {} : { outputDimensionality: request.dimensions }),
|
|
40
|
+
...parameters,
|
|
41
|
+
};
|
|
42
|
+
return (mergeJsonRecords({
|
|
43
|
+
instances: contents.map((content) => ({ content, ...instance })),
|
|
44
|
+
...(Object.keys(merged).length === 0 ? {} : { parameters: merged }),
|
|
45
|
+
}, request.http?.body) ?? {});
|
|
46
|
+
});
|
|
47
|
+
const decodeDocument = MediaProtocol.identity({ id: ID, name: NAME, provider: "google-vertex" }).decodeJson(Response);
|
|
48
|
+
export const protocol = EmbeddingRoute.protocol({
|
|
49
|
+
id: ID,
|
|
50
|
+
name: NAME,
|
|
51
|
+
body: { from: fromRequest },
|
|
52
|
+
response: {
|
|
53
|
+
decode: Effect.fn("GoogleVertexPredictEmbeddings.decodeResponse")(function* (response, context) {
|
|
54
|
+
const output = yield* decodeDocument(response);
|
|
55
|
+
const statistics = output.value.predictions.map((prediction) => prediction.embeddings.statistics ?? {});
|
|
56
|
+
const tokens = statistics.map((item) => item.token_count);
|
|
57
|
+
return new EmbeddingResponse({
|
|
58
|
+
embeddings: output.value.predictions.map((prediction) => prediction.embeddings.values),
|
|
59
|
+
usage: tokens.every((count) => count !== undefined)
|
|
60
|
+
? new EmbeddingUsage({ inputTokens: tokens.reduce((sum, count) => sum + count, 0) })
|
|
61
|
+
: undefined,
|
|
62
|
+
providerMetadata: {
|
|
63
|
+
[context.providerMetadataKey]: {
|
|
64
|
+
statistics,
|
|
65
|
+
...(output.value.metadata === undefined ? {} : { metadata: output.value.metadata }),
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
});
|
|
69
|
+
}),
|
|
70
|
+
},
|
|
71
|
+
});
|
|
72
|
+
export const GoogleVertexPredictEmbeddings = {
|
|
73
|
+
protocol,
|
|
74
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export * as AnthropicMessages from "./anthropic-messages.js";
|
|
2
|
+
export * as BedrockConverse from "./bedrock-converse.js";
|
|
3
|
+
export * as CloudflareRunDecisions from "./cloudflare-run-decisions.js";
|
|
4
|
+
export * as CohereChat from "./cohere-chat.js";
|
|
5
|
+
export * as Gemini from "./gemini.js";
|
|
6
|
+
export * as GoogleDecisions from "./google-decisions.js";
|
|
7
|
+
export * as GoogleEmbedContent from "./google-embed-content.js";
|
|
8
|
+
export * as GoogleInteractions from "./google-interactions.js";
|
|
9
|
+
export * as GoogleVertexPredictEmbeddings from "./google-vertex-predict-embeddings.js";
|
|
10
|
+
export * as MistralChat from "./mistral-chat.js";
|
|
11
|
+
export * as OpenAIChat from "./openai-chat.js";
|
|
12
|
+
export * as OpenAIDecisions from "./openai-decisions.js";
|
|
13
|
+
export * as OpenAIEmbeddings from "./openai-embeddings.js";
|
|
14
|
+
export * as OpenAIImages from "./openai-images.js";
|
|
15
|
+
export * as OpenAICompatibleChat from "./openai-compatible-chat.js";
|
|
16
|
+
export * as OpenAICompatibleResponses from "./openai-compatible-responses.js";
|
|
17
|
+
export * as OpenAIResponses from "./openai-responses.js";
|
|
18
|
+
export * as OpenResponses from "./open-responses.js";
|
|
19
|
+
export * as OpenResponsesChannel from "./open-responses-channel.js";
|
|
20
|
+
export * as SystemOne from "./system-one.js";
|
|
21
|
+
export * as XAIResponses from "./xai-responses.js";
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export * as AnthropicMessages from "./anthropic-messages.js";
|
|
2
|
+
export * as BedrockConverse from "./bedrock-converse.js";
|
|
3
|
+
export * as CloudflareRunDecisions from "./cloudflare-run-decisions.js";
|
|
4
|
+
export * as CohereChat from "./cohere-chat.js";
|
|
5
|
+
export * as Gemini from "./gemini.js";
|
|
6
|
+
export * as GoogleDecisions from "./google-decisions.js";
|
|
7
|
+
export * as GoogleEmbedContent from "./google-embed-content.js";
|
|
8
|
+
export * as GoogleInteractions from "./google-interactions.js";
|
|
9
|
+
export * as GoogleVertexPredictEmbeddings from "./google-vertex-predict-embeddings.js";
|
|
10
|
+
export * as MistralChat from "./mistral-chat.js";
|
|
11
|
+
export * as OpenAIChat from "./openai-chat.js";
|
|
12
|
+
export * as OpenAIDecisions from "./openai-decisions.js";
|
|
13
|
+
export * as OpenAIEmbeddings from "./openai-embeddings.js";
|
|
14
|
+
export * as OpenAIImages from "./openai-images.js";
|
|
15
|
+
export * as OpenAICompatibleChat from "./openai-compatible-chat.js";
|
|
16
|
+
export * as OpenAICompatibleResponses from "./openai-compatible-responses.js";
|
|
17
|
+
export * as OpenAIResponses from "./openai-responses.js";
|
|
18
|
+
export * as OpenResponses from "./open-responses.js";
|
|
19
|
+
export * as OpenResponsesChannel from "./open-responses-channel.js";
|
|
20
|
+
export * as SystemOne from "./system-one.js";
|
|
21
|
+
export * as XAIResponses from "./xai-responses.js";
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ImageModel, ImageResponse, type ImageRequest } from "../image.js";
|
|
2
|
+
import { MediaProtocol } from "../route/media-protocol.js";
|
|
3
|
+
import { MediaRoute } from "../route/media.js";
|
|
4
|
+
import { type OpenString } from "../schema/index.js";
|
|
5
|
+
export declare const DEFAULT_BASE_URL = "https://api.meta.ai/v1";
|
|
6
|
+
/**
|
|
7
|
+
* Provider-native options. Common fields (`n`, `aspect`, `images`) live on the request; Meta picks its own output
|
|
8
|
+
* resolution (about 2.5 megapixels), so `resolution` is ignored.
|
|
9
|
+
*/
|
|
10
|
+
export type ImageOptions = {
|
|
11
|
+
/** `WIDTHxHEIGHT` aspect ratio hint; it replaces `aspect`, so setting both fails. */
|
|
12
|
+
readonly size?: string;
|
|
13
|
+
readonly outputFormat?: OpenString<"webp" | "png" | "jpeg">;
|
|
14
|
+
readonly responseFormat?: OpenString<"b64_json" | "url">;
|
|
15
|
+
readonly reasoningStrength?: OpenString<"low" | "high">;
|
|
16
|
+
readonly toolEnablement?: {
|
|
17
|
+
readonly enable_image_search?: boolean;
|
|
18
|
+
readonly enable_web_search?: boolean;
|
|
19
|
+
readonly enable_shell?: boolean;
|
|
20
|
+
};
|
|
21
|
+
readonly [key: string]: unknown;
|
|
22
|
+
};
|
|
23
|
+
export type Request = ImageRequest<ImageModel<ImageOptions>>;
|
|
24
|
+
export declare const protocol: MediaProtocol.Inline<Request, ImageResponse>;
|
|
25
|
+
export declare const model: (input: MediaRoute.ModelInput) => ImageModel<ImageOptions>;
|
|
26
|
+
export * as MetaImages from "./meta-images.js";
|