@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,150 @@
|
|
|
1
|
+
import { Auth } from "../route/auth.js";
|
|
2
|
+
import { AuthOptions } from "../route/auth-options.js";
|
|
3
|
+
import { Endpoint } from "../route/endpoint.js";
|
|
4
|
+
import { MediaRoute } from "../route/media.js";
|
|
5
|
+
import { mergeTransport, ProviderConfigurationError, ProviderID, } from "../schema/index.js";
|
|
6
|
+
import { AnthropicMessages } from "../protocols/anthropic-messages.js";
|
|
7
|
+
import { OpenAIImages } from "../protocols/openai-images.js";
|
|
8
|
+
import { OpenAIEmbeddings } from "../protocols/openai-embeddings.js";
|
|
9
|
+
import * as OpenAIChat from "../protocols/openai-chat.js";
|
|
10
|
+
import * as OpenAIResponses from "../protocols/openai-responses.js";
|
|
11
|
+
import { withOpenAIOptions } from "./openai-options.js";
|
|
12
|
+
export const id = ProviderID.make("azure");
|
|
13
|
+
const routeAuth = Auth.remove("authorization");
|
|
14
|
+
const RESPONSES_WEBSOCKET_ROTATE_AFTER_MS = 55 * 60 * 1000;
|
|
15
|
+
const resourceBaseURL = (resourceName) => `https://${resourceName.trim()}.openai.azure.com/openai`;
|
|
16
|
+
const responsesRoute = OpenAIResponses.route.with({
|
|
17
|
+
compact: { endpoint: OpenAIResponses.route.compact.endpoint },
|
|
18
|
+
id: "azure-openai-responses",
|
|
19
|
+
provider: id,
|
|
20
|
+
auth: routeAuth,
|
|
21
|
+
transport: OpenAIResponses.channelTransport({
|
|
22
|
+
id: "azure-openai-responses",
|
|
23
|
+
name: "Azure OpenAI Responses",
|
|
24
|
+
rotateAfterMs: RESPONSES_WEBSOCKET_ROTATE_AFTER_MS,
|
|
25
|
+
enabled: (value) => {
|
|
26
|
+
const url = new URL(value);
|
|
27
|
+
return (url.protocol === "https:" &&
|
|
28
|
+
url.hostname.endsWith(".openai.azure.com") &&
|
|
29
|
+
url.pathname.endsWith("/openai/v1/responses") &&
|
|
30
|
+
url.searchParams.get("api-version") === "v1");
|
|
31
|
+
},
|
|
32
|
+
url: (value) => {
|
|
33
|
+
const url = new URL(value);
|
|
34
|
+
url.searchParams.delete("api-version");
|
|
35
|
+
return url.toString();
|
|
36
|
+
},
|
|
37
|
+
}),
|
|
38
|
+
});
|
|
39
|
+
const chatRoute = OpenAIChat.route.with({
|
|
40
|
+
id: "azure-openai-chat",
|
|
41
|
+
provider: id,
|
|
42
|
+
auth: routeAuth,
|
|
43
|
+
});
|
|
44
|
+
// Claude on Foundry serves Anthropic Messages under the resource's `services.ai.azure.com` host and accepts the
|
|
45
|
+
// resource key as `x-api-key`; it rejects `api-key`.
|
|
46
|
+
const messagesRoute = AnthropicMessages.route.with({ id: "azure-anthropic-messages", provider: id });
|
|
47
|
+
export const routes = [responsesRoute, chatRoute, messagesRoute];
|
|
48
|
+
const defaults = (input) => {
|
|
49
|
+
const { apiKey: _, apiVersion: _apiVersion, resourceName: _resourceName, useDeploymentBasedUrls: _useDeploymentBasedUrls, baseURL: _baseURL, queryParams: _queryParams, ...rest } = input;
|
|
50
|
+
if ("auth" in rest) {
|
|
51
|
+
const { auth: _, ...withoutAuth } = rest;
|
|
52
|
+
return withoutAuth;
|
|
53
|
+
}
|
|
54
|
+
return rest;
|
|
55
|
+
};
|
|
56
|
+
const auth = (input, header = "api-key") => {
|
|
57
|
+
if ("auth" in input && input.auth)
|
|
58
|
+
return input.auth;
|
|
59
|
+
return Auth.remove("authorization").andThen(AuthOptions.apiKey(input, "AZURE_OPENAI_API_KEY", Auth.header(header)));
|
|
60
|
+
};
|
|
61
|
+
const configuredRoute = (route, input, modelID) => route.with({
|
|
62
|
+
auth: auth(input),
|
|
63
|
+
endpoint: endpoint(input, modelID),
|
|
64
|
+
});
|
|
65
|
+
function endpoint(input, modelID) {
|
|
66
|
+
const baseURL = Endpoint.trimBaseUrl(input.baseURL ?? resourceBaseURL(input.resourceName));
|
|
67
|
+
const query = { "api-version": input.apiVersion ?? "v1", ...input.queryParams };
|
|
68
|
+
if (input.useDeploymentBasedUrls)
|
|
69
|
+
return { baseURL: `${baseURL}/deployments/${modelID}`, query };
|
|
70
|
+
if (input.baseURL !== undefined && !new URL(input.baseURL).hostname.endsWith(".openai.azure.com")) {
|
|
71
|
+
return { baseURL, query: input.queryParams };
|
|
72
|
+
}
|
|
73
|
+
return { baseURL: `${baseURL}/v1`, query };
|
|
74
|
+
}
|
|
75
|
+
export const configure = (input) => {
|
|
76
|
+
const modelDefaults = defaults(input);
|
|
77
|
+
const responses = (modelID) => configuredRoute(responsesRoute, input, modelID)
|
|
78
|
+
.with(withOpenAIOptions(modelID, modelDefaults))
|
|
79
|
+
.model({ id: modelID });
|
|
80
|
+
const chat = (modelID) => configuredRoute(chatRoute, input, modelID)
|
|
81
|
+
.with(withOpenAIOptions(modelID, modelDefaults))
|
|
82
|
+
.model({ id: modelID, capabilities: { cache: { affinity: true } } });
|
|
83
|
+
const messages = (modelID) => messagesRoute
|
|
84
|
+
.with({
|
|
85
|
+
...modelDefaults,
|
|
86
|
+
auth: auth(input, "x-api-key"),
|
|
87
|
+
endpoint: {
|
|
88
|
+
baseURL: Endpoint.trimBaseUrl(input.baseURL ?? `https://${input.resourceName.trim()}.services.ai.azure.com/anthropic/v1`),
|
|
89
|
+
query: input.queryParams,
|
|
90
|
+
},
|
|
91
|
+
})
|
|
92
|
+
.model({ id: modelID });
|
|
93
|
+
const image = (modelID, providerOptions) => {
|
|
94
|
+
const target = endpoint(input, modelID);
|
|
95
|
+
const transport = mergeTransport(input, { http: { query: target.query } });
|
|
96
|
+
const media = MediaRoute.deployment({ ...transport, baseURL: target.baseURL }, auth(input));
|
|
97
|
+
return OpenAIImages.model({ ...media, id: modelID, provider: id, providerOptions });
|
|
98
|
+
};
|
|
99
|
+
const embedding = (modelID, providerOptions) => OpenAIEmbeddings.route
|
|
100
|
+
.with({
|
|
101
|
+
provider: id,
|
|
102
|
+
endpoint: endpoint(input, modelID),
|
|
103
|
+
auth: auth(input),
|
|
104
|
+
...mergeTransport(input),
|
|
105
|
+
})
|
|
106
|
+
.model({ id: modelID, providerOptions });
|
|
107
|
+
return {
|
|
108
|
+
id,
|
|
109
|
+
model: responses,
|
|
110
|
+
responses,
|
|
111
|
+
chat,
|
|
112
|
+
messages,
|
|
113
|
+
image,
|
|
114
|
+
embedding,
|
|
115
|
+
configure,
|
|
116
|
+
};
|
|
117
|
+
};
|
|
118
|
+
export const provider = {
|
|
119
|
+
id,
|
|
120
|
+
configure,
|
|
121
|
+
};
|
|
122
|
+
const config = ({ apiKey, apiVersion, baseURL, body, headers, queryParams, resourceName, useDeploymentBasedUrls, ...providerOptions }) => {
|
|
123
|
+
const common = {
|
|
124
|
+
apiKey,
|
|
125
|
+
apiVersion,
|
|
126
|
+
http: { headers, body },
|
|
127
|
+
providerOptions,
|
|
128
|
+
queryParams,
|
|
129
|
+
useDeploymentBasedUrls,
|
|
130
|
+
};
|
|
131
|
+
if (baseURL !== undefined)
|
|
132
|
+
return { ...common, baseURL };
|
|
133
|
+
if (resourceName !== undefined)
|
|
134
|
+
return { ...common, resourceName };
|
|
135
|
+
throw new ProviderConfigurationError({ provider: id, message: "Azure requires resourceName or baseURL" });
|
|
136
|
+
};
|
|
137
|
+
export const responsesModel = (modelID, settings) => configure(config(settings)).responses(modelID);
|
|
138
|
+
export const chatModel = (modelID, settings) => configure(config(settings)).chat(modelID);
|
|
139
|
+
export const messagesModel = (modelID, settings) => configure(config(settings)).messages(modelID);
|
|
140
|
+
export const imageModel = (modelID, settings) => {
|
|
141
|
+
const input = config(settings);
|
|
142
|
+
return configure(input).image(modelID, input.providerOptions);
|
|
143
|
+
};
|
|
144
|
+
export const embeddingModel = (modelID, settings) => {
|
|
145
|
+
const input = config(settings);
|
|
146
|
+
return configure(input).embedding(modelID, input.providerOptions);
|
|
147
|
+
};
|
|
148
|
+
export const model = responsesModel;
|
|
149
|
+
export const responses = responsesModel;
|
|
150
|
+
export const chat = chatModel;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { decisionModel as model } from "../baseten.js";
|
|
@@ -0,0 +1,384 @@
|
|
|
1
|
+
import type { ProviderPackage } from "../provider-package.js";
|
|
2
|
+
import type { ProviderAuthOption } from "../route/auth-options.js";
|
|
3
|
+
import { Route } from "../route/client.js";
|
|
4
|
+
import { type ModelID, type ProviderOptions, type RequestOptions } from "../schema/index.js";
|
|
5
|
+
import type { OpenAIProviderOptionsInput } from "./openai-options.js";
|
|
6
|
+
export declare const id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
7
|
+
export type Config = Omit<RequestOptions, "providerOptions"> & ProviderAuthOption<"optional"> & {
|
|
8
|
+
readonly baseURL?: string;
|
|
9
|
+
readonly providerOptions?: OpenAIProviderOptionsInput;
|
|
10
|
+
};
|
|
11
|
+
export interface BasetenDecisionOptions {
|
|
12
|
+
readonly [key: string]: unknown;
|
|
13
|
+
readonly max_len?: number;
|
|
14
|
+
}
|
|
15
|
+
export type Settings = ProviderPackage.Settings & OpenAIProviderOptionsInput & {
|
|
16
|
+
readonly apiKey?: string | false;
|
|
17
|
+
readonly baseURL?: string;
|
|
18
|
+
};
|
|
19
|
+
export declare const route: Route<{
|
|
20
|
+
readonly model: string;
|
|
21
|
+
readonly messages: readonly ({
|
|
22
|
+
readonly role: "system";
|
|
23
|
+
readonly content: string | readonly ({
|
|
24
|
+
readonly type: "image_url";
|
|
25
|
+
readonly image_url: {
|
|
26
|
+
readonly url: string;
|
|
27
|
+
};
|
|
28
|
+
} | {
|
|
29
|
+
readonly type: "video_url";
|
|
30
|
+
readonly video_url: {
|
|
31
|
+
readonly url: string;
|
|
32
|
+
};
|
|
33
|
+
} | {
|
|
34
|
+
readonly type: "file";
|
|
35
|
+
readonly file: {
|
|
36
|
+
readonly filename: string;
|
|
37
|
+
readonly file_data: string;
|
|
38
|
+
};
|
|
39
|
+
} | {
|
|
40
|
+
readonly type: "text";
|
|
41
|
+
readonly text: string;
|
|
42
|
+
readonly cache_control?: {
|
|
43
|
+
readonly type: "ephemeral";
|
|
44
|
+
readonly ttl?: string | undefined;
|
|
45
|
+
} | undefined;
|
|
46
|
+
})[];
|
|
47
|
+
} | {
|
|
48
|
+
readonly role: "user";
|
|
49
|
+
readonly content: string | readonly ({
|
|
50
|
+
readonly type: "image_url";
|
|
51
|
+
readonly image_url: {
|
|
52
|
+
readonly url: string;
|
|
53
|
+
};
|
|
54
|
+
} | {
|
|
55
|
+
readonly type: "video_url";
|
|
56
|
+
readonly video_url: {
|
|
57
|
+
readonly url: string;
|
|
58
|
+
};
|
|
59
|
+
} | {
|
|
60
|
+
readonly type: "file";
|
|
61
|
+
readonly file: {
|
|
62
|
+
readonly filename: string;
|
|
63
|
+
readonly file_data: string;
|
|
64
|
+
};
|
|
65
|
+
} | {
|
|
66
|
+
readonly type: "text";
|
|
67
|
+
readonly text: string;
|
|
68
|
+
readonly cache_control?: {
|
|
69
|
+
readonly type: "ephemeral";
|
|
70
|
+
readonly ttl?: string | undefined;
|
|
71
|
+
} | undefined;
|
|
72
|
+
})[];
|
|
73
|
+
} | {
|
|
74
|
+
readonly role: "tool";
|
|
75
|
+
readonly tool_call_id: string;
|
|
76
|
+
readonly content: string | readonly {
|
|
77
|
+
readonly type: "text";
|
|
78
|
+
readonly text: string;
|
|
79
|
+
readonly cache_control?: {
|
|
80
|
+
readonly type: "ephemeral";
|
|
81
|
+
readonly ttl?: string | undefined;
|
|
82
|
+
} | undefined;
|
|
83
|
+
}[];
|
|
84
|
+
} | {
|
|
85
|
+
readonly [x: string]: unknown;
|
|
86
|
+
readonly role: "assistant";
|
|
87
|
+
readonly content: string | readonly {
|
|
88
|
+
readonly type: "text";
|
|
89
|
+
readonly text: string;
|
|
90
|
+
readonly cache_control?: {
|
|
91
|
+
readonly type: "ephemeral";
|
|
92
|
+
readonly ttl?: string | undefined;
|
|
93
|
+
} | undefined;
|
|
94
|
+
}[] | null;
|
|
95
|
+
readonly tool_calls?: readonly ({
|
|
96
|
+
readonly id: string;
|
|
97
|
+
readonly type: "custom";
|
|
98
|
+
readonly custom: {
|
|
99
|
+
readonly name: string;
|
|
100
|
+
readonly input: string;
|
|
101
|
+
};
|
|
102
|
+
} | {
|
|
103
|
+
readonly id: string;
|
|
104
|
+
readonly type: "function";
|
|
105
|
+
readonly function: {
|
|
106
|
+
readonly name: string;
|
|
107
|
+
readonly arguments: string;
|
|
108
|
+
};
|
|
109
|
+
readonly extra_content?: {
|
|
110
|
+
readonly google: {
|
|
111
|
+
readonly thought_signature: string;
|
|
112
|
+
};
|
|
113
|
+
} | undefined;
|
|
114
|
+
})[] | undefined;
|
|
115
|
+
readonly reasoning_content?: string | undefined;
|
|
116
|
+
readonly reasoning?: string | undefined;
|
|
117
|
+
readonly reasoning_text?: string | undefined;
|
|
118
|
+
readonly reasoning_details?: unknown;
|
|
119
|
+
readonly reasoning_opaque?: string | undefined;
|
|
120
|
+
})[];
|
|
121
|
+
readonly tools?: readonly ({
|
|
122
|
+
readonly type: "function";
|
|
123
|
+
readonly function: {
|
|
124
|
+
readonly name: string;
|
|
125
|
+
readonly description: string;
|
|
126
|
+
readonly parameters: {
|
|
127
|
+
readonly [x: string]: unknown;
|
|
128
|
+
};
|
|
129
|
+
readonly strict?: boolean | undefined;
|
|
130
|
+
};
|
|
131
|
+
readonly cache_control?: {
|
|
132
|
+
readonly type: "ephemeral";
|
|
133
|
+
readonly ttl?: string | undefined;
|
|
134
|
+
} | undefined;
|
|
135
|
+
} | {
|
|
136
|
+
readonly type: "custom";
|
|
137
|
+
readonly custom: {
|
|
138
|
+
readonly name: string;
|
|
139
|
+
readonly description: string;
|
|
140
|
+
readonly format: {
|
|
141
|
+
readonly type: "text";
|
|
142
|
+
} | {
|
|
143
|
+
readonly type: "grammar";
|
|
144
|
+
readonly grammar: {
|
|
145
|
+
readonly syntax: "lark" | "regex";
|
|
146
|
+
readonly definition: string;
|
|
147
|
+
};
|
|
148
|
+
};
|
|
149
|
+
};
|
|
150
|
+
readonly cache_control?: {
|
|
151
|
+
readonly type: "ephemeral";
|
|
152
|
+
readonly ttl?: string | undefined;
|
|
153
|
+
} | undefined;
|
|
154
|
+
})[] | undefined;
|
|
155
|
+
readonly tool_choice?: "auto" | "none" | "required" | {
|
|
156
|
+
readonly type: "function";
|
|
157
|
+
readonly function: {
|
|
158
|
+
readonly name: string;
|
|
159
|
+
};
|
|
160
|
+
} | {
|
|
161
|
+
readonly type: "custom";
|
|
162
|
+
readonly custom: {
|
|
163
|
+
readonly name: string;
|
|
164
|
+
};
|
|
165
|
+
} | undefined;
|
|
166
|
+
readonly stream: true;
|
|
167
|
+
readonly stream_options?: {
|
|
168
|
+
readonly include_usage: boolean;
|
|
169
|
+
} | undefined;
|
|
170
|
+
readonly store?: boolean | undefined;
|
|
171
|
+
readonly prompt_cache_key?: string | undefined;
|
|
172
|
+
readonly prompt_cache_retention?: string | undefined;
|
|
173
|
+
readonly prompt_cache_options?: {
|
|
174
|
+
readonly ttl?: string | undefined;
|
|
175
|
+
} | undefined;
|
|
176
|
+
readonly reasoning_effort?: import("../schema/options.js").ReasoningEffort | undefined;
|
|
177
|
+
readonly verbosity?: import("../schema/options.js").OpenString<"high" | "low" | "medium"> | undefined;
|
|
178
|
+
readonly service_tier?: import("../schema/options.js").OpenString<"auto" | "default" | "flex" | "priority"> | undefined;
|
|
179
|
+
readonly parallel_tool_calls?: boolean | undefined;
|
|
180
|
+
readonly metadata?: {
|
|
181
|
+
readonly [x: string]: string;
|
|
182
|
+
} | undefined;
|
|
183
|
+
readonly safety_identifier?: string | undefined;
|
|
184
|
+
readonly tool_stream?: boolean | undefined;
|
|
185
|
+
readonly max_completion_tokens?: number | undefined;
|
|
186
|
+
readonly max_tokens?: number | undefined;
|
|
187
|
+
readonly temperature?: number | undefined;
|
|
188
|
+
readonly top_p?: number | undefined;
|
|
189
|
+
readonly frequency_penalty?: number | undefined;
|
|
190
|
+
readonly presence_penalty?: number | undefined;
|
|
191
|
+
readonly seed?: number | undefined;
|
|
192
|
+
readonly stop?: readonly string[] | undefined;
|
|
193
|
+
}, import("../route/transport/http.js").HttpPrepared<string>, import("../route/client.js").CompactionOperations | undefined>;
|
|
194
|
+
export declare const routes: Route<{
|
|
195
|
+
readonly model: string;
|
|
196
|
+
readonly messages: readonly ({
|
|
197
|
+
readonly role: "system";
|
|
198
|
+
readonly content: string | readonly ({
|
|
199
|
+
readonly type: "image_url";
|
|
200
|
+
readonly image_url: {
|
|
201
|
+
readonly url: string;
|
|
202
|
+
};
|
|
203
|
+
} | {
|
|
204
|
+
readonly type: "video_url";
|
|
205
|
+
readonly video_url: {
|
|
206
|
+
readonly url: string;
|
|
207
|
+
};
|
|
208
|
+
} | {
|
|
209
|
+
readonly type: "file";
|
|
210
|
+
readonly file: {
|
|
211
|
+
readonly filename: string;
|
|
212
|
+
readonly file_data: string;
|
|
213
|
+
};
|
|
214
|
+
} | {
|
|
215
|
+
readonly type: "text";
|
|
216
|
+
readonly text: string;
|
|
217
|
+
readonly cache_control?: {
|
|
218
|
+
readonly type: "ephemeral";
|
|
219
|
+
readonly ttl?: string | undefined;
|
|
220
|
+
} | undefined;
|
|
221
|
+
})[];
|
|
222
|
+
} | {
|
|
223
|
+
readonly role: "user";
|
|
224
|
+
readonly content: string | readonly ({
|
|
225
|
+
readonly type: "image_url";
|
|
226
|
+
readonly image_url: {
|
|
227
|
+
readonly url: string;
|
|
228
|
+
};
|
|
229
|
+
} | {
|
|
230
|
+
readonly type: "video_url";
|
|
231
|
+
readonly video_url: {
|
|
232
|
+
readonly url: string;
|
|
233
|
+
};
|
|
234
|
+
} | {
|
|
235
|
+
readonly type: "file";
|
|
236
|
+
readonly file: {
|
|
237
|
+
readonly filename: string;
|
|
238
|
+
readonly file_data: string;
|
|
239
|
+
};
|
|
240
|
+
} | {
|
|
241
|
+
readonly type: "text";
|
|
242
|
+
readonly text: string;
|
|
243
|
+
readonly cache_control?: {
|
|
244
|
+
readonly type: "ephemeral";
|
|
245
|
+
readonly ttl?: string | undefined;
|
|
246
|
+
} | undefined;
|
|
247
|
+
})[];
|
|
248
|
+
} | {
|
|
249
|
+
readonly role: "tool";
|
|
250
|
+
readonly tool_call_id: string;
|
|
251
|
+
readonly content: string | readonly {
|
|
252
|
+
readonly type: "text";
|
|
253
|
+
readonly text: string;
|
|
254
|
+
readonly cache_control?: {
|
|
255
|
+
readonly type: "ephemeral";
|
|
256
|
+
readonly ttl?: string | undefined;
|
|
257
|
+
} | undefined;
|
|
258
|
+
}[];
|
|
259
|
+
} | {
|
|
260
|
+
readonly [x: string]: unknown;
|
|
261
|
+
readonly role: "assistant";
|
|
262
|
+
readonly content: string | readonly {
|
|
263
|
+
readonly type: "text";
|
|
264
|
+
readonly text: string;
|
|
265
|
+
readonly cache_control?: {
|
|
266
|
+
readonly type: "ephemeral";
|
|
267
|
+
readonly ttl?: string | undefined;
|
|
268
|
+
} | undefined;
|
|
269
|
+
}[] | null;
|
|
270
|
+
readonly tool_calls?: readonly ({
|
|
271
|
+
readonly id: string;
|
|
272
|
+
readonly type: "custom";
|
|
273
|
+
readonly custom: {
|
|
274
|
+
readonly name: string;
|
|
275
|
+
readonly input: string;
|
|
276
|
+
};
|
|
277
|
+
} | {
|
|
278
|
+
readonly id: string;
|
|
279
|
+
readonly type: "function";
|
|
280
|
+
readonly function: {
|
|
281
|
+
readonly name: string;
|
|
282
|
+
readonly arguments: string;
|
|
283
|
+
};
|
|
284
|
+
readonly extra_content?: {
|
|
285
|
+
readonly google: {
|
|
286
|
+
readonly thought_signature: string;
|
|
287
|
+
};
|
|
288
|
+
} | undefined;
|
|
289
|
+
})[] | undefined;
|
|
290
|
+
readonly reasoning_content?: string | undefined;
|
|
291
|
+
readonly reasoning?: string | undefined;
|
|
292
|
+
readonly reasoning_text?: string | undefined;
|
|
293
|
+
readonly reasoning_details?: unknown;
|
|
294
|
+
readonly reasoning_opaque?: string | undefined;
|
|
295
|
+
})[];
|
|
296
|
+
readonly tools?: readonly ({
|
|
297
|
+
readonly type: "function";
|
|
298
|
+
readonly function: {
|
|
299
|
+
readonly name: string;
|
|
300
|
+
readonly description: string;
|
|
301
|
+
readonly parameters: {
|
|
302
|
+
readonly [x: string]: unknown;
|
|
303
|
+
};
|
|
304
|
+
readonly strict?: boolean | undefined;
|
|
305
|
+
};
|
|
306
|
+
readonly cache_control?: {
|
|
307
|
+
readonly type: "ephemeral";
|
|
308
|
+
readonly ttl?: string | undefined;
|
|
309
|
+
} | undefined;
|
|
310
|
+
} | {
|
|
311
|
+
readonly type: "custom";
|
|
312
|
+
readonly custom: {
|
|
313
|
+
readonly name: string;
|
|
314
|
+
readonly description: string;
|
|
315
|
+
readonly format: {
|
|
316
|
+
readonly type: "text";
|
|
317
|
+
} | {
|
|
318
|
+
readonly type: "grammar";
|
|
319
|
+
readonly grammar: {
|
|
320
|
+
readonly syntax: "lark" | "regex";
|
|
321
|
+
readonly definition: string;
|
|
322
|
+
};
|
|
323
|
+
};
|
|
324
|
+
};
|
|
325
|
+
readonly cache_control?: {
|
|
326
|
+
readonly type: "ephemeral";
|
|
327
|
+
readonly ttl?: string | undefined;
|
|
328
|
+
} | undefined;
|
|
329
|
+
})[] | undefined;
|
|
330
|
+
readonly tool_choice?: "auto" | "none" | "required" | {
|
|
331
|
+
readonly type: "function";
|
|
332
|
+
readonly function: {
|
|
333
|
+
readonly name: string;
|
|
334
|
+
};
|
|
335
|
+
} | {
|
|
336
|
+
readonly type: "custom";
|
|
337
|
+
readonly custom: {
|
|
338
|
+
readonly name: string;
|
|
339
|
+
};
|
|
340
|
+
} | undefined;
|
|
341
|
+
readonly stream: true;
|
|
342
|
+
readonly stream_options?: {
|
|
343
|
+
readonly include_usage: boolean;
|
|
344
|
+
} | undefined;
|
|
345
|
+
readonly store?: boolean | undefined;
|
|
346
|
+
readonly prompt_cache_key?: string | undefined;
|
|
347
|
+
readonly prompt_cache_retention?: string | undefined;
|
|
348
|
+
readonly prompt_cache_options?: {
|
|
349
|
+
readonly ttl?: string | undefined;
|
|
350
|
+
} | undefined;
|
|
351
|
+
readonly reasoning_effort?: import("../schema/options.js").ReasoningEffort | undefined;
|
|
352
|
+
readonly verbosity?: import("../schema/options.js").OpenString<"high" | "low" | "medium"> | undefined;
|
|
353
|
+
readonly service_tier?: import("../schema/options.js").OpenString<"auto" | "default" | "flex" | "priority"> | undefined;
|
|
354
|
+
readonly parallel_tool_calls?: boolean | undefined;
|
|
355
|
+
readonly metadata?: {
|
|
356
|
+
readonly [x: string]: string;
|
|
357
|
+
} | undefined;
|
|
358
|
+
readonly safety_identifier?: string | undefined;
|
|
359
|
+
readonly tool_stream?: boolean | undefined;
|
|
360
|
+
readonly max_completion_tokens?: number | undefined;
|
|
361
|
+
readonly max_tokens?: number | undefined;
|
|
362
|
+
readonly temperature?: number | undefined;
|
|
363
|
+
readonly top_p?: number | undefined;
|
|
364
|
+
readonly frequency_penalty?: number | undefined;
|
|
365
|
+
readonly presence_penalty?: number | undefined;
|
|
366
|
+
readonly seed?: number | undefined;
|
|
367
|
+
readonly stop?: readonly string[] | undefined;
|
|
368
|
+
}, import("../route/transport/http.js").HttpPrepared<string>, import("../route/client.js").CompactionOperations | undefined>[];
|
|
369
|
+
export declare const configure: (input?: Config) => {
|
|
370
|
+
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
371
|
+
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput, import("../route/client.js").CompactionOperations | undefined>;
|
|
372
|
+
decision: (modelID: string | ModelID, providerOptions?: ProviderOptions) => import("../decision.js").DecisionModel<BasetenDecisionOptions>;
|
|
373
|
+
configure: typeof configure;
|
|
374
|
+
};
|
|
375
|
+
export declare const provider: {
|
|
376
|
+
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
377
|
+
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput, import("../route/client.js").CompactionOperations | undefined>;
|
|
378
|
+
decision: (modelID: string | ModelID, providerOptions?: ProviderOptions) => import("../decision.js").DecisionModel<BasetenDecisionOptions>;
|
|
379
|
+
configure: typeof configure;
|
|
380
|
+
};
|
|
381
|
+
export declare const decision: (modelID: string | ModelID, providerOptions?: ProviderOptions) => import("../decision.js").DecisionModel<BasetenDecisionOptions>;
|
|
382
|
+
export declare const model: ProviderPackage.Model<Settings, OpenAIProviderOptionsInput>;
|
|
383
|
+
export declare const decisionModel: (modelID: string, settings?: Settings) => import("../decision.js").DecisionModel<BasetenDecisionOptions>;
|
|
384
|
+
export * as Baseten from "./baseten.js";
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { Effect } from "effect";
|
|
2
|
+
import { OpenAIChat } from "../protocols/openai-chat.js";
|
|
3
|
+
import { SystemOne } from "../protocols/system-one.js";
|
|
4
|
+
import { Route } from "../route/client.js";
|
|
5
|
+
import { DecisionRoute } from "../route/decision.js";
|
|
6
|
+
import { Endpoint } from "../route/endpoint.js";
|
|
7
|
+
import { mergeTransport, ProviderID } from "../schema/index.js";
|
|
8
|
+
import { bearerRouteDefaults, toConfig } from "./settings.js";
|
|
9
|
+
export const id = ProviderID.make("baseten");
|
|
10
|
+
const baseURL = "https://inference.baseten.co/v1";
|
|
11
|
+
export const route = Route.make({
|
|
12
|
+
id: "baseten-chat",
|
|
13
|
+
provider: id,
|
|
14
|
+
providerMetadataKey: "baseten",
|
|
15
|
+
protocol: OpenAIChat.protocol,
|
|
16
|
+
endpoint: Endpoint.path("/chat/completions", { baseURL }),
|
|
17
|
+
framing: OpenAIChat.framing,
|
|
18
|
+
});
|
|
19
|
+
export const routes = [route];
|
|
20
|
+
// Baseten reads media only as parts in a user message inside `state.messages`, not in any of the System One
|
|
21
|
+
// placements models.dev describes, so its decision protocol fixes that placement.
|
|
22
|
+
const decisionProtocol = DecisionRoute.protocol({
|
|
23
|
+
...SystemOne.protocol,
|
|
24
|
+
id: "baseten-system-one",
|
|
25
|
+
body: {
|
|
26
|
+
from: (request) => SystemOne.encodeBody(request, "state.messages").pipe(Effect.map((body) => ({ ...body, model: request.model.id }))),
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
export const configure = (input = {}) => {
|
|
30
|
+
const options = bearerRouteDefaults(input, "BASETEN_API_KEY", baseURL);
|
|
31
|
+
const configured = route.with(options);
|
|
32
|
+
const decisionRoute = DecisionRoute.make({
|
|
33
|
+
id: decisionProtocol.id,
|
|
34
|
+
provider: id,
|
|
35
|
+
providerMetadataKey: "baseten",
|
|
36
|
+
protocol: decisionProtocol,
|
|
37
|
+
endpoint: Endpoint.path("/systemone", { baseURL: options.endpoint.baseURL }),
|
|
38
|
+
auth: options.auth,
|
|
39
|
+
...mergeTransport(input),
|
|
40
|
+
});
|
|
41
|
+
const decision = (modelID, providerOptions) => decisionRoute.model({ id: modelID, providerOptions });
|
|
42
|
+
return {
|
|
43
|
+
id,
|
|
44
|
+
model: (modelID) => configured.model({ id: modelID }),
|
|
45
|
+
decision,
|
|
46
|
+
configure,
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
export const provider = configure();
|
|
50
|
+
export const decision = provider.decision;
|
|
51
|
+
export const model = (modelID, settings) => configure(toConfig(settings)).model(modelID);
|
|
52
|
+
export const decisionModel = (modelID, settings) => {
|
|
53
|
+
const input = toConfig(settings);
|
|
54
|
+
return configure(input).decision(modelID, input.providerOptions);
|
|
55
|
+
};
|
|
56
|
+
export * as Baseten from "./baseten.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { videoModel as model } from "../byteplus.js";
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { ProviderPackage } from "../provider-package.js";
|
|
2
|
+
import { type ProviderAuthOption } from "../route/auth-options.js";
|
|
3
|
+
import { type ModelID, type ProviderOptions, type TransportOptions } from "../schema/index.js";
|
|
4
|
+
export declare const id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
5
|
+
export type Config = TransportOptions & ProviderAuthOption<"optional"> & {
|
|
6
|
+
readonly baseURL?: string;
|
|
7
|
+
};
|
|
8
|
+
export type Settings = ProviderPackage.Settings & {
|
|
9
|
+
readonly apiKey?: string | false;
|
|
10
|
+
readonly baseURL?: string;
|
|
11
|
+
};
|
|
12
|
+
export type { SeedanceVideoOptions } from "../protocols/seedance-video.js";
|
|
13
|
+
export declare const configure: (input?: Config) => {
|
|
14
|
+
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
15
|
+
video: (modelID: string | ModelID, providerOptions?: ProviderOptions) => import("../video.js").VideoModel<import("../protocols/seedance-video.js").SeedanceVideoOptions>;
|
|
16
|
+
configure: typeof configure;
|
|
17
|
+
};
|
|
18
|
+
export declare const provider: {
|
|
19
|
+
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
20
|
+
video: (modelID: string | ModelID, providerOptions?: ProviderOptions) => import("../video.js").VideoModel<import("../protocols/seedance-video.js").SeedanceVideoOptions>;
|
|
21
|
+
configure: typeof configure;
|
|
22
|
+
};
|
|
23
|
+
export declare const videoModel: (modelID: string, settings?: Settings) => import("../video.js").VideoModel<import("../protocols/seedance-video.js").SeedanceVideoOptions>;
|
|
24
|
+
export declare const video: (modelID: string | ModelID, providerOptions?: ProviderOptions) => import("../video.js").VideoModel<import("../protocols/seedance-video.js").SeedanceVideoOptions>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { SeedanceVideo } from "../protocols/seedance-video.js";
|
|
2
|
+
import { AuthOptions } from "../route/auth-options.js";
|
|
3
|
+
import { MediaRoute } from "../route/media.js";
|
|
4
|
+
import { ProviderID } from "../schema/index.js";
|
|
5
|
+
import { toConfig } from "./settings.js";
|
|
6
|
+
export const id = ProviderID.make("byteplus");
|
|
7
|
+
const auth = (options) => AuthOptions.bearer(options, "BYTEPLUS_API_KEY");
|
|
8
|
+
export const configure = (input = {}) => {
|
|
9
|
+
const media = MediaRoute.deployment(input, auth(input));
|
|
10
|
+
return {
|
|
11
|
+
id,
|
|
12
|
+
video: (modelID, providerOptions) => SeedanceVideo.byteplus.model({ ...media, id: modelID, providerOptions }),
|
|
13
|
+
configure,
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
export const provider = configure();
|
|
17
|
+
export const videoModel = (modelID, settings) => {
|
|
18
|
+
const input = toConfig(settings);
|
|
19
|
+
return configure(input).video(modelID, input.providerOptions);
|
|
20
|
+
};
|
|
21
|
+
export const video = provider.video;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type ProviderAuthOption } from "../route/auth-options.js";
|
|
2
|
+
import { type ModelID, type TransportOptions } from "../schema/index.js";
|
|
3
|
+
export type { CartesiaEncoding, CartesiaSpeechOptions } from "../protocols/cartesia-speech.js";
|
|
4
|
+
export declare const id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
5
|
+
export type Config = TransportOptions & ProviderAuthOption<"optional"> & {
|
|
6
|
+
readonly baseURL?: string;
|
|
7
|
+
};
|
|
8
|
+
export declare const configure: (input?: Config) => {
|
|
9
|
+
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
10
|
+
speech: (modelID: string | ModelID) => import("../speech.js").SpeechModel<import("../protocols/cartesia-speech.js").CartesiaSpeechOptions>;
|
|
11
|
+
configure: typeof configure;
|
|
12
|
+
};
|
|
13
|
+
export declare const provider: {
|
|
14
|
+
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
15
|
+
speech: (modelID: string | ModelID) => import("../speech.js").SpeechModel<import("../protocols/cartesia-speech.js").CartesiaSpeechOptions>;
|
|
16
|
+
configure: typeof configure;
|
|
17
|
+
};
|
|
18
|
+
export declare const speech: (modelID: string | ModelID) => import("../speech.js").SpeechModel<import("../protocols/cartesia-speech.js").CartesiaSpeechOptions>;
|