@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,413 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
import { Protocol } from "../route/protocol.js";
|
|
3
|
+
import { AnthropicMessages } from "./anthropic-messages.js";
|
|
4
|
+
import { OpenResponsesOptions } from "./utils/open-responses-options.js";
|
|
5
|
+
declare const Options: Schema.Struct<{
|
|
6
|
+
readonly effort: Schema.optional<Schema.declare<OpenResponsesOptions.ReasoningEffort, OpenResponsesOptions.ReasoningEffort>>;
|
|
7
|
+
readonly thinking: Schema.optional<Schema.Struct<{
|
|
8
|
+
readonly type: Schema.declare<import("../schema/options.js").OpenString<"disabled" | "enabled">, import("../schema/options.js").OpenString<"disabled" | "enabled">>;
|
|
9
|
+
readonly budgetTokens: Schema.optional<Schema.Int>;
|
|
10
|
+
readonly budget_tokens: Schema.optional<Schema.Int>;
|
|
11
|
+
}>>;
|
|
12
|
+
}>;
|
|
13
|
+
export type OptionsInput = typeof Options.Type & Pick<AnthropicMessages.OptionsInput, "outputConfig">;
|
|
14
|
+
export declare const protocol: Protocol<{
|
|
15
|
+
readonly context_management?: {
|
|
16
|
+
readonly edits: readonly {
|
|
17
|
+
readonly type: "compact_20260112";
|
|
18
|
+
readonly trigger?: {
|
|
19
|
+
readonly type: "input_tokens";
|
|
20
|
+
readonly value: number;
|
|
21
|
+
} | undefined;
|
|
22
|
+
readonly pause_after_compaction?: boolean | undefined;
|
|
23
|
+
readonly instructions?: string | undefined;
|
|
24
|
+
}[];
|
|
25
|
+
} | undefined;
|
|
26
|
+
readonly model: string;
|
|
27
|
+
readonly system?: readonly {
|
|
28
|
+
readonly type: "text";
|
|
29
|
+
readonly text: string;
|
|
30
|
+
readonly cache_control?: {
|
|
31
|
+
readonly type: "ephemeral";
|
|
32
|
+
readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
|
|
33
|
+
} | undefined;
|
|
34
|
+
}[] | undefined;
|
|
35
|
+
readonly messages: readonly ({
|
|
36
|
+
readonly role: "user";
|
|
37
|
+
readonly content: readonly ({
|
|
38
|
+
readonly type: "text";
|
|
39
|
+
readonly text: string;
|
|
40
|
+
readonly cache_control?: {
|
|
41
|
+
readonly type: "ephemeral";
|
|
42
|
+
readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
|
|
43
|
+
} | undefined;
|
|
44
|
+
} | {
|
|
45
|
+
readonly type: "image";
|
|
46
|
+
readonly source: {
|
|
47
|
+
readonly type: "base64";
|
|
48
|
+
readonly media_type: string;
|
|
49
|
+
readonly data: string;
|
|
50
|
+
} | {
|
|
51
|
+
readonly type: "url";
|
|
52
|
+
readonly url: string;
|
|
53
|
+
} | {
|
|
54
|
+
readonly type: "file";
|
|
55
|
+
readonly file_id: string;
|
|
56
|
+
};
|
|
57
|
+
readonly cache_control?: {
|
|
58
|
+
readonly type: "ephemeral";
|
|
59
|
+
readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
|
|
60
|
+
} | undefined;
|
|
61
|
+
readonly transformations?: {
|
|
62
|
+
readonly oversized_image?: "downsize" | "error" | undefined;
|
|
63
|
+
} | undefined;
|
|
64
|
+
} | {
|
|
65
|
+
readonly type: "video";
|
|
66
|
+
readonly source: {
|
|
67
|
+
readonly type: "base64";
|
|
68
|
+
readonly media_type: string;
|
|
69
|
+
readonly data: string;
|
|
70
|
+
} | {
|
|
71
|
+
readonly type: "url";
|
|
72
|
+
readonly url: string;
|
|
73
|
+
} | {
|
|
74
|
+
readonly type: "file";
|
|
75
|
+
readonly file_id: string;
|
|
76
|
+
};
|
|
77
|
+
readonly cache_control?: {
|
|
78
|
+
readonly type: "ephemeral";
|
|
79
|
+
readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
|
|
80
|
+
} | undefined;
|
|
81
|
+
} | {
|
|
82
|
+
readonly type: "document";
|
|
83
|
+
readonly source: {
|
|
84
|
+
readonly type: "base64";
|
|
85
|
+
readonly media_type: "application/pdf";
|
|
86
|
+
readonly data: string;
|
|
87
|
+
} | {
|
|
88
|
+
readonly type: "text";
|
|
89
|
+
readonly media_type: "text/plain";
|
|
90
|
+
readonly data: string;
|
|
91
|
+
} | {
|
|
92
|
+
readonly type: "url";
|
|
93
|
+
readonly url: string;
|
|
94
|
+
} | {
|
|
95
|
+
readonly type: "file";
|
|
96
|
+
readonly file_id: string;
|
|
97
|
+
};
|
|
98
|
+
readonly cache_control?: {
|
|
99
|
+
readonly type: "ephemeral";
|
|
100
|
+
readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
|
|
101
|
+
} | undefined;
|
|
102
|
+
readonly title?: string | undefined;
|
|
103
|
+
readonly context?: string | undefined;
|
|
104
|
+
readonly citations?: {
|
|
105
|
+
readonly enabled: boolean;
|
|
106
|
+
} | undefined;
|
|
107
|
+
} | {
|
|
108
|
+
readonly type: "tool_result";
|
|
109
|
+
readonly tool_use_id: string;
|
|
110
|
+
readonly content: string | readonly ({
|
|
111
|
+
readonly type: "text";
|
|
112
|
+
readonly text: string;
|
|
113
|
+
readonly cache_control?: {
|
|
114
|
+
readonly type: "ephemeral";
|
|
115
|
+
readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
|
|
116
|
+
} | undefined;
|
|
117
|
+
} | {
|
|
118
|
+
readonly type: "image";
|
|
119
|
+
readonly source: {
|
|
120
|
+
readonly type: "base64";
|
|
121
|
+
readonly media_type: string;
|
|
122
|
+
readonly data: string;
|
|
123
|
+
} | {
|
|
124
|
+
readonly type: "url";
|
|
125
|
+
readonly url: string;
|
|
126
|
+
} | {
|
|
127
|
+
readonly type: "file";
|
|
128
|
+
readonly file_id: string;
|
|
129
|
+
};
|
|
130
|
+
readonly cache_control?: {
|
|
131
|
+
readonly type: "ephemeral";
|
|
132
|
+
readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
|
|
133
|
+
} | undefined;
|
|
134
|
+
readonly transformations?: {
|
|
135
|
+
readonly oversized_image?: "downsize" | "error" | undefined;
|
|
136
|
+
} | undefined;
|
|
137
|
+
} | {
|
|
138
|
+
readonly type: "video";
|
|
139
|
+
readonly source: {
|
|
140
|
+
readonly type: "base64";
|
|
141
|
+
readonly media_type: string;
|
|
142
|
+
readonly data: string;
|
|
143
|
+
} | {
|
|
144
|
+
readonly type: "url";
|
|
145
|
+
readonly url: string;
|
|
146
|
+
} | {
|
|
147
|
+
readonly type: "file";
|
|
148
|
+
readonly file_id: string;
|
|
149
|
+
};
|
|
150
|
+
readonly cache_control?: {
|
|
151
|
+
readonly type: "ephemeral";
|
|
152
|
+
readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
|
|
153
|
+
} | undefined;
|
|
154
|
+
} | {
|
|
155
|
+
readonly type: "document";
|
|
156
|
+
readonly source: {
|
|
157
|
+
readonly type: "base64";
|
|
158
|
+
readonly media_type: "application/pdf";
|
|
159
|
+
readonly data: string;
|
|
160
|
+
} | {
|
|
161
|
+
readonly type: "text";
|
|
162
|
+
readonly media_type: "text/plain";
|
|
163
|
+
readonly data: string;
|
|
164
|
+
} | {
|
|
165
|
+
readonly type: "url";
|
|
166
|
+
readonly url: string;
|
|
167
|
+
} | {
|
|
168
|
+
readonly type: "file";
|
|
169
|
+
readonly file_id: string;
|
|
170
|
+
};
|
|
171
|
+
readonly cache_control?: {
|
|
172
|
+
readonly type: "ephemeral";
|
|
173
|
+
readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
|
|
174
|
+
} | undefined;
|
|
175
|
+
readonly title?: string | undefined;
|
|
176
|
+
readonly context?: string | undefined;
|
|
177
|
+
readonly citations?: {
|
|
178
|
+
readonly enabled: boolean;
|
|
179
|
+
} | undefined;
|
|
180
|
+
})[];
|
|
181
|
+
readonly is_error?: boolean | undefined;
|
|
182
|
+
readonly cache_control?: {
|
|
183
|
+
readonly type: "ephemeral";
|
|
184
|
+
readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
|
|
185
|
+
} | undefined;
|
|
186
|
+
})[];
|
|
187
|
+
} | {
|
|
188
|
+
readonly role: "assistant";
|
|
189
|
+
readonly content: readonly ({
|
|
190
|
+
readonly type: "compaction";
|
|
191
|
+
readonly content: string | null;
|
|
192
|
+
} | {
|
|
193
|
+
readonly type: "text";
|
|
194
|
+
readonly text: string;
|
|
195
|
+
readonly cache_control?: {
|
|
196
|
+
readonly type: "ephemeral";
|
|
197
|
+
readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
|
|
198
|
+
} | undefined;
|
|
199
|
+
} | {
|
|
200
|
+
readonly type: "thinking";
|
|
201
|
+
readonly thinking: string;
|
|
202
|
+
readonly signature: string;
|
|
203
|
+
readonly cache_control?: {
|
|
204
|
+
readonly type: "ephemeral";
|
|
205
|
+
readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
|
|
206
|
+
} | undefined;
|
|
207
|
+
} | {
|
|
208
|
+
readonly type: "redacted_thinking";
|
|
209
|
+
readonly data: string;
|
|
210
|
+
readonly cache_control?: {
|
|
211
|
+
readonly type: "ephemeral";
|
|
212
|
+
readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
|
|
213
|
+
} | undefined;
|
|
214
|
+
} | {
|
|
215
|
+
readonly type: "tool_use";
|
|
216
|
+
readonly id: string;
|
|
217
|
+
readonly name: string;
|
|
218
|
+
readonly input: unknown;
|
|
219
|
+
readonly cache_control?: {
|
|
220
|
+
readonly type: "ephemeral";
|
|
221
|
+
readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
|
|
222
|
+
} | undefined;
|
|
223
|
+
} | {
|
|
224
|
+
readonly type: "server_tool_use";
|
|
225
|
+
readonly id: string;
|
|
226
|
+
readonly name: string;
|
|
227
|
+
readonly input: unknown;
|
|
228
|
+
readonly cache_control?: {
|
|
229
|
+
readonly type: "ephemeral";
|
|
230
|
+
readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
|
|
231
|
+
} | undefined;
|
|
232
|
+
} | {
|
|
233
|
+
readonly type: "code_execution_tool_result" | "web_fetch_tool_result" | "web_search_tool_result";
|
|
234
|
+
readonly tool_use_id: string;
|
|
235
|
+
readonly content: unknown;
|
|
236
|
+
readonly cache_control?: {
|
|
237
|
+
readonly type: "ephemeral";
|
|
238
|
+
readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
|
|
239
|
+
} | undefined;
|
|
240
|
+
})[];
|
|
241
|
+
} | {
|
|
242
|
+
readonly role: "system";
|
|
243
|
+
readonly content: readonly ({
|
|
244
|
+
readonly type: "tool_addition";
|
|
245
|
+
readonly tool: {
|
|
246
|
+
readonly type: "tool_definition";
|
|
247
|
+
readonly definition: {
|
|
248
|
+
readonly name: string;
|
|
249
|
+
readonly description: string;
|
|
250
|
+
readonly input_schema: {
|
|
251
|
+
readonly [x: string]: unknown;
|
|
252
|
+
};
|
|
253
|
+
readonly cache_control?: {
|
|
254
|
+
readonly type: "ephemeral";
|
|
255
|
+
readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
|
|
256
|
+
} | undefined;
|
|
257
|
+
};
|
|
258
|
+
};
|
|
259
|
+
} | {
|
|
260
|
+
readonly type: "tool_removal";
|
|
261
|
+
readonly tool: {
|
|
262
|
+
readonly type: "tool_reference";
|
|
263
|
+
readonly name: string;
|
|
264
|
+
};
|
|
265
|
+
} | {
|
|
266
|
+
readonly type: "text";
|
|
267
|
+
readonly text: string;
|
|
268
|
+
readonly cache_control?: {
|
|
269
|
+
readonly type: "ephemeral";
|
|
270
|
+
readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
|
|
271
|
+
} | undefined;
|
|
272
|
+
})[];
|
|
273
|
+
readonly output_config?: {
|
|
274
|
+
readonly effort: string;
|
|
275
|
+
} | undefined;
|
|
276
|
+
})[];
|
|
277
|
+
readonly tools?: readonly {
|
|
278
|
+
readonly name: string;
|
|
279
|
+
readonly description: string;
|
|
280
|
+
readonly input_schema: {
|
|
281
|
+
readonly [x: string]: unknown;
|
|
282
|
+
};
|
|
283
|
+
readonly cache_control?: {
|
|
284
|
+
readonly type: "ephemeral";
|
|
285
|
+
readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
|
|
286
|
+
} | undefined;
|
|
287
|
+
}[] | undefined;
|
|
288
|
+
readonly tool_choice?: {
|
|
289
|
+
readonly type: "any" | "auto" | "none";
|
|
290
|
+
readonly disable_parallel_tool_use?: boolean | undefined;
|
|
291
|
+
} | {
|
|
292
|
+
readonly type: "tool";
|
|
293
|
+
readonly name: string;
|
|
294
|
+
readonly disable_parallel_tool_use?: boolean | undefined;
|
|
295
|
+
} | undefined;
|
|
296
|
+
readonly stream: true;
|
|
297
|
+
readonly max_tokens: number;
|
|
298
|
+
readonly temperature?: number | undefined;
|
|
299
|
+
readonly top_p?: number | undefined;
|
|
300
|
+
readonly top_k?: number | undefined;
|
|
301
|
+
readonly stop_sequences?: readonly string[] | undefined;
|
|
302
|
+
readonly output_config?: {
|
|
303
|
+
readonly effort?: string | undefined;
|
|
304
|
+
readonly format?: {
|
|
305
|
+
readonly type: "json_schema";
|
|
306
|
+
readonly schema: {
|
|
307
|
+
readonly [x: string]: unknown;
|
|
308
|
+
};
|
|
309
|
+
} | null | undefined;
|
|
310
|
+
} | undefined;
|
|
311
|
+
readonly cache_control?: {
|
|
312
|
+
readonly type: "ephemeral";
|
|
313
|
+
readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
|
|
314
|
+
} | undefined;
|
|
315
|
+
readonly container?: string | {
|
|
316
|
+
readonly id?: string | null | undefined;
|
|
317
|
+
readonly skills?: readonly {
|
|
318
|
+
readonly [x: string]: unknown;
|
|
319
|
+
}[] | null | undefined;
|
|
320
|
+
} | null | undefined;
|
|
321
|
+
readonly inference_geo?: string | null | undefined;
|
|
322
|
+
readonly metadata?: {
|
|
323
|
+
readonly user_id?: string | null | undefined;
|
|
324
|
+
} | undefined;
|
|
325
|
+
readonly service_tier?: import("../schema/options.js").OpenString<"auto" | "standard_only"> | undefined;
|
|
326
|
+
readonly speed?: import("../schema/options.js").OpenString<"fast" | "standard"> | undefined;
|
|
327
|
+
readonly thinking?: {
|
|
328
|
+
readonly type: string;
|
|
329
|
+
readonly budget_tokens?: number | undefined;
|
|
330
|
+
} | undefined;
|
|
331
|
+
}, string, {
|
|
332
|
+
readonly [x: string]: unknown;
|
|
333
|
+
readonly type: string;
|
|
334
|
+
readonly index?: number | undefined;
|
|
335
|
+
readonly message?: {
|
|
336
|
+
readonly [x: string]: unknown;
|
|
337
|
+
readonly usage?: {
|
|
338
|
+
readonly [x: string]: unknown;
|
|
339
|
+
readonly input_tokens?: number | null | undefined;
|
|
340
|
+
readonly output_tokens?: number | undefined;
|
|
341
|
+
readonly cache_creation_input_tokens?: number | null | undefined;
|
|
342
|
+
readonly cache_read_input_tokens?: number | null | undefined;
|
|
343
|
+
readonly server_tool_use?: {
|
|
344
|
+
readonly [x: string]: unknown;
|
|
345
|
+
readonly web_search_requests?: number | undefined;
|
|
346
|
+
} | null | undefined;
|
|
347
|
+
readonly output_tokens_details?: {
|
|
348
|
+
readonly [x: string]: unknown;
|
|
349
|
+
readonly thinking_tokens?: number | undefined;
|
|
350
|
+
} | null | undefined;
|
|
351
|
+
readonly iterations?: readonly {
|
|
352
|
+
readonly [x: string]: unknown;
|
|
353
|
+
readonly input_tokens?: number | null | undefined;
|
|
354
|
+
readonly output_tokens?: number | undefined;
|
|
355
|
+
readonly cache_creation_input_tokens?: number | null | undefined;
|
|
356
|
+
readonly cache_read_input_tokens?: number | null | undefined;
|
|
357
|
+
readonly server_tool_use?: {
|
|
358
|
+
readonly [x: string]: unknown;
|
|
359
|
+
readonly web_search_requests?: number | undefined;
|
|
360
|
+
} | null | undefined;
|
|
361
|
+
readonly output_tokens_details?: {
|
|
362
|
+
readonly [x: string]: unknown;
|
|
363
|
+
readonly thinking_tokens?: number | undefined;
|
|
364
|
+
} | null | undefined;
|
|
365
|
+
}[] | undefined;
|
|
366
|
+
} | undefined;
|
|
367
|
+
} | undefined;
|
|
368
|
+
readonly content_block?: unknown;
|
|
369
|
+
readonly delta?: unknown;
|
|
370
|
+
readonly usage?: {
|
|
371
|
+
readonly [x: string]: unknown;
|
|
372
|
+
readonly input_tokens?: number | null | undefined;
|
|
373
|
+
readonly output_tokens?: number | undefined;
|
|
374
|
+
readonly cache_creation_input_tokens?: number | null | undefined;
|
|
375
|
+
readonly cache_read_input_tokens?: number | null | undefined;
|
|
376
|
+
readonly server_tool_use?: {
|
|
377
|
+
readonly [x: string]: unknown;
|
|
378
|
+
readonly web_search_requests?: number | undefined;
|
|
379
|
+
} | null | undefined;
|
|
380
|
+
readonly output_tokens_details?: {
|
|
381
|
+
readonly [x: string]: unknown;
|
|
382
|
+
readonly thinking_tokens?: number | undefined;
|
|
383
|
+
} | null | undefined;
|
|
384
|
+
readonly iterations?: readonly {
|
|
385
|
+
readonly [x: string]: unknown;
|
|
386
|
+
readonly input_tokens?: number | null | undefined;
|
|
387
|
+
readonly output_tokens?: number | undefined;
|
|
388
|
+
readonly cache_creation_input_tokens?: number | null | undefined;
|
|
389
|
+
readonly cache_read_input_tokens?: number | null | undefined;
|
|
390
|
+
readonly server_tool_use?: {
|
|
391
|
+
readonly [x: string]: unknown;
|
|
392
|
+
readonly web_search_requests?: number | undefined;
|
|
393
|
+
} | null | undefined;
|
|
394
|
+
readonly output_tokens_details?: {
|
|
395
|
+
readonly [x: string]: unknown;
|
|
396
|
+
readonly thinking_tokens?: number | undefined;
|
|
397
|
+
} | null | undefined;
|
|
398
|
+
}[] | undefined;
|
|
399
|
+
} | undefined;
|
|
400
|
+
readonly error?: {
|
|
401
|
+
readonly [x: string]: unknown;
|
|
402
|
+
readonly type?: string | undefined;
|
|
403
|
+
readonly message?: string | undefined;
|
|
404
|
+
} | undefined;
|
|
405
|
+
}, {
|
|
406
|
+
provider: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
407
|
+
compactions: {};
|
|
408
|
+
providerMetadataKey: string;
|
|
409
|
+
tools: Partial<Record<number, import("./utils/tool-stream.js").PendingTool>>;
|
|
410
|
+
reasoningSignatures: {};
|
|
411
|
+
lifecycle: import("./utils/lifecycle.js").State;
|
|
412
|
+
}>;
|
|
413
|
+
export * as AlibabaMessages from "./alibaba-messages.js";
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Effect, Schema } from "effect";
|
|
2
|
+
import { Protocol } from "../route/protocol.js";
|
|
3
|
+
import { AnthropicMessages } from "./anthropic-messages.js";
|
|
4
|
+
import { ProviderShared } from "./shared.js";
|
|
5
|
+
import { OpenResponsesOptions } from "./utils/open-responses-options.js";
|
|
6
|
+
const Options = Schema.Struct({
|
|
7
|
+
effort: Schema.optional(OpenResponsesOptions.ReasoningEffort),
|
|
8
|
+
thinking: Schema.optional(Schema.Struct({
|
|
9
|
+
type: ProviderShared.knownString(),
|
|
10
|
+
budgetTokens: Schema.optional(Schema.Int),
|
|
11
|
+
budget_tokens: Schema.optional(Schema.Int),
|
|
12
|
+
})),
|
|
13
|
+
});
|
|
14
|
+
export const protocol = Protocol.make({
|
|
15
|
+
id: "alibaba-messages",
|
|
16
|
+
body: {
|
|
17
|
+
schema: Schema.Struct({
|
|
18
|
+
...AnthropicMessages.AnthropicMessagesBody.fields,
|
|
19
|
+
thinking: Schema.optional(Schema.Struct({ type: Schema.String, budget_tokens: Schema.optional(Schema.Int) })),
|
|
20
|
+
}),
|
|
21
|
+
from: Effect.fn("AlibabaMessages.fromRequest")(function* (req) {
|
|
22
|
+
const opts = yield* ProviderShared.validateWith(Schema.decodeUnknownEffect(Options))(req.providerOptions ?? {});
|
|
23
|
+
// Model Studio accepts enabled thinking without Anthropic's mandatory token budget.
|
|
24
|
+
const body = yield* AnthropicMessages.protocol.body.from({
|
|
25
|
+
...req,
|
|
26
|
+
providerOptions: { ...req.providerOptions, thinking: undefined },
|
|
27
|
+
});
|
|
28
|
+
const budget = opts.thinking?.budgetTokens ?? opts.thinking?.budget_tokens;
|
|
29
|
+
return {
|
|
30
|
+
...body,
|
|
31
|
+
thinking: opts.thinking === undefined
|
|
32
|
+
? undefined
|
|
33
|
+
: {
|
|
34
|
+
type: opts.thinking.type,
|
|
35
|
+
budget_tokens: budget === undefined ? undefined : ProviderShared.fitThinkingBudget(budget, body.max_tokens),
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
}),
|
|
39
|
+
},
|
|
40
|
+
stream: AnthropicMessages.protocol.stream,
|
|
41
|
+
supportsEffortUpdates: AnthropicMessages.protocol.supportsEffortUpdates,
|
|
42
|
+
toolUpdates: AnthropicMessages.protocol.toolUpdates,
|
|
43
|
+
});
|
|
44
|
+
export * as AlibabaMessages from "./alibaba-messages.js";
|