@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,378 @@
|
|
|
1
|
+
import { Effect, Schema } from "effect";
|
|
2
|
+
import { AI } from "./ai.js";
|
|
3
|
+
import type { Execute } from "./decision-client.js";
|
|
4
|
+
import { Media } from "./media.js";
|
|
5
|
+
import { AIError, type BaseRequest, type TransportOptions, ModelID, ProviderID, ProviderOptions, type OpenString } from "./schema/index.js";
|
|
6
|
+
export declare const DecisionTextPart: Schema.Struct<{
|
|
7
|
+
readonly type: Schema.Literal<"text">;
|
|
8
|
+
readonly text: Schema.String;
|
|
9
|
+
}>;
|
|
10
|
+
export declare const DecisionJsonPart: Schema.Struct<{
|
|
11
|
+
readonly type: Schema.Literal<"json">;
|
|
12
|
+
readonly value: Schema.Codec<Schema.Json, Schema.Json, never, never>;
|
|
13
|
+
}>;
|
|
14
|
+
export declare const DecisionMediaPart: Schema.Struct<{
|
|
15
|
+
readonly type: Schema.Literal<"media">;
|
|
16
|
+
readonly media: Schema.decodeTo<Schema.declare<Media.Asset, Media.Asset>, Schema.Struct<{
|
|
17
|
+
readonly source: Schema.Union<readonly [Schema.Struct<{
|
|
18
|
+
readonly type: Schema.Literal<"bytes">;
|
|
19
|
+
readonly data: Schema.Uint8Array;
|
|
20
|
+
readonly mediaType: Schema.String;
|
|
21
|
+
}>, Schema.Struct<{
|
|
22
|
+
readonly type: Schema.Literal<"base64">;
|
|
23
|
+
readonly data: Schema.String;
|
|
24
|
+
readonly mediaType: Schema.String;
|
|
25
|
+
}>, Schema.Struct<{
|
|
26
|
+
readonly type: Schema.Literal<"url">;
|
|
27
|
+
readonly url: Schema.String;
|
|
28
|
+
readonly mediaType: Schema.optional<Schema.String>;
|
|
29
|
+
readonly expiresAt: Schema.optional<Schema.Number>;
|
|
30
|
+
}>, Schema.Struct<{
|
|
31
|
+
readonly type: Schema.Literal<"ref">;
|
|
32
|
+
readonly provider: Schema.brand<Schema.String, "AI.ProviderID">;
|
|
33
|
+
readonly id: Schema.String;
|
|
34
|
+
readonly mediaType: Schema.optional<Schema.String>;
|
|
35
|
+
}>]>;
|
|
36
|
+
readonly info: Schema.optional<Schema.Struct<{
|
|
37
|
+
readonly width: Schema.optional<Schema.Number>;
|
|
38
|
+
readonly height: Schema.optional<Schema.Number>;
|
|
39
|
+
readonly durationSeconds: Schema.optional<Schema.Number>;
|
|
40
|
+
readonly sampleRate: Schema.optional<Schema.Number>;
|
|
41
|
+
readonly channels: Schema.optional<Schema.Number>;
|
|
42
|
+
readonly encoding: Schema.optional<Schema.String>;
|
|
43
|
+
readonly format: Schema.optional<Schema.String>;
|
|
44
|
+
}>>;
|
|
45
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
46
|
+
}>, never, never>;
|
|
47
|
+
readonly filename: Schema.optional<Schema.String>;
|
|
48
|
+
}>;
|
|
49
|
+
export declare const DecisionPart: Schema.toTaggedUnion<"type", readonly [Schema.Struct<{
|
|
50
|
+
readonly type: Schema.Literal<"text">;
|
|
51
|
+
readonly text: Schema.String;
|
|
52
|
+
}>, Schema.Struct<{
|
|
53
|
+
readonly type: Schema.Literal<"json">;
|
|
54
|
+
readonly value: Schema.Codec<Schema.Json, Schema.Json, never, never>;
|
|
55
|
+
}>, Schema.Struct<{
|
|
56
|
+
readonly type: Schema.Literal<"media">;
|
|
57
|
+
readonly media: Schema.decodeTo<Schema.declare<Media.Asset, Media.Asset>, Schema.Struct<{
|
|
58
|
+
readonly source: Schema.Union<readonly [Schema.Struct<{
|
|
59
|
+
readonly type: Schema.Literal<"bytes">;
|
|
60
|
+
readonly data: Schema.Uint8Array;
|
|
61
|
+
readonly mediaType: Schema.String;
|
|
62
|
+
}>, Schema.Struct<{
|
|
63
|
+
readonly type: Schema.Literal<"base64">;
|
|
64
|
+
readonly data: Schema.String;
|
|
65
|
+
readonly mediaType: Schema.String;
|
|
66
|
+
}>, Schema.Struct<{
|
|
67
|
+
readonly type: Schema.Literal<"url">;
|
|
68
|
+
readonly url: Schema.String;
|
|
69
|
+
readonly mediaType: Schema.optional<Schema.String>;
|
|
70
|
+
readonly expiresAt: Schema.optional<Schema.Number>;
|
|
71
|
+
}>, Schema.Struct<{
|
|
72
|
+
readonly type: Schema.Literal<"ref">;
|
|
73
|
+
readonly provider: Schema.brand<Schema.String, "AI.ProviderID">;
|
|
74
|
+
readonly id: Schema.String;
|
|
75
|
+
readonly mediaType: Schema.optional<Schema.String>;
|
|
76
|
+
}>]>;
|
|
77
|
+
readonly info: Schema.optional<Schema.Struct<{
|
|
78
|
+
readonly width: Schema.optional<Schema.Number>;
|
|
79
|
+
readonly height: Schema.optional<Schema.Number>;
|
|
80
|
+
readonly durationSeconds: Schema.optional<Schema.Number>;
|
|
81
|
+
readonly sampleRate: Schema.optional<Schema.Number>;
|
|
82
|
+
readonly channels: Schema.optional<Schema.Number>;
|
|
83
|
+
readonly encoding: Schema.optional<Schema.String>;
|
|
84
|
+
readonly format: Schema.optional<Schema.String>;
|
|
85
|
+
}>>;
|
|
86
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
87
|
+
}>, never, never>;
|
|
88
|
+
readonly filename: Schema.optional<Schema.String>;
|
|
89
|
+
}>]>;
|
|
90
|
+
export type DecisionPart = Schema.Schema.Type<typeof DecisionPart>;
|
|
91
|
+
/** A media part as input: `media` may be plain data, with `mediaType` naming its type when the content can't. */
|
|
92
|
+
export type DecisionMediaPartInput = Omit<typeof DecisionMediaPart.Type, "media"> & {
|
|
93
|
+
readonly media: Media.Input;
|
|
94
|
+
readonly mediaType?: string;
|
|
95
|
+
};
|
|
96
|
+
export type DecisionPartInput = Exclude<DecisionPart, {
|
|
97
|
+
readonly type: "media";
|
|
98
|
+
}> | DecisionMediaPartInput;
|
|
99
|
+
/** A plain object is one `json` part. */
|
|
100
|
+
export type DecisionInput = typeof Schema.JsonObject.Type | ReadonlyArray<DecisionPartInput>;
|
|
101
|
+
/** Choice values are typed: `true` and `"true"` are different values. */
|
|
102
|
+
export declare const ChoiceValue: Schema.Union<readonly [Schema.String, Schema.Boolean]>;
|
|
103
|
+
export type ChoiceValue = Schema.Schema.Type<typeof ChoiceValue>;
|
|
104
|
+
export declare const PredicateQuestion: Schema.Struct<{
|
|
105
|
+
readonly name: Schema.String;
|
|
106
|
+
readonly type: Schema.Literal<"predicate">;
|
|
107
|
+
readonly instructions: Schema.String;
|
|
108
|
+
/** What counts as true and as false, for statements the instructions alone leave ambiguous. */
|
|
109
|
+
readonly criteria: Schema.optional<Schema.Struct<{
|
|
110
|
+
readonly true: Schema.optional<Schema.String>;
|
|
111
|
+
readonly false: Schema.optional<Schema.String>;
|
|
112
|
+
}>>;
|
|
113
|
+
}>;
|
|
114
|
+
export type PredicateQuestion = Schema.Schema.Type<typeof PredicateQuestion>;
|
|
115
|
+
export declare const ChoiceQuestion: Schema.Struct<{
|
|
116
|
+
readonly name: Schema.String;
|
|
117
|
+
readonly type: Schema.Literal<"choice">;
|
|
118
|
+
readonly instructions: Schema.String;
|
|
119
|
+
readonly choices: Schema.$Array<Schema.Struct<{
|
|
120
|
+
readonly value: Schema.Union<readonly [Schema.String, Schema.Boolean]>;
|
|
121
|
+
readonly description: Schema.optional<Schema.String>;
|
|
122
|
+
}>>;
|
|
123
|
+
}>;
|
|
124
|
+
export type ChoiceQuestion = Schema.Schema.Type<typeof ChoiceQuestion>;
|
|
125
|
+
export declare const ScoreQuestion: Schema.Struct<{
|
|
126
|
+
readonly name: Schema.String;
|
|
127
|
+
readonly type: Schema.Literal<"score">;
|
|
128
|
+
readonly instructions: Schema.String;
|
|
129
|
+
readonly levels: Schema.$Array<Schema.Struct<{
|
|
130
|
+
readonly label: Schema.String;
|
|
131
|
+
readonly description: Schema.optional<Schema.String>;
|
|
132
|
+
}>>;
|
|
133
|
+
}>;
|
|
134
|
+
export type ScoreQuestion = Schema.Schema.Type<typeof ScoreQuestion>;
|
|
135
|
+
export declare const DecisionQuestion: Schema.toTaggedUnion<"type", readonly [Schema.Struct<{
|
|
136
|
+
readonly name: Schema.String;
|
|
137
|
+
readonly type: Schema.Literal<"predicate">;
|
|
138
|
+
readonly instructions: Schema.String;
|
|
139
|
+
/** What counts as true and as false, for statements the instructions alone leave ambiguous. */
|
|
140
|
+
readonly criteria: Schema.optional<Schema.Struct<{
|
|
141
|
+
readonly true: Schema.optional<Schema.String>;
|
|
142
|
+
readonly false: Schema.optional<Schema.String>;
|
|
143
|
+
}>>;
|
|
144
|
+
}>, Schema.Struct<{
|
|
145
|
+
readonly name: Schema.String;
|
|
146
|
+
readonly type: Schema.Literal<"choice">;
|
|
147
|
+
readonly instructions: Schema.String;
|
|
148
|
+
readonly choices: Schema.$Array<Schema.Struct<{
|
|
149
|
+
readonly value: Schema.Union<readonly [Schema.String, Schema.Boolean]>;
|
|
150
|
+
readonly description: Schema.optional<Schema.String>;
|
|
151
|
+
}>>;
|
|
152
|
+
}>, Schema.Struct<{
|
|
153
|
+
readonly name: Schema.String;
|
|
154
|
+
readonly type: Schema.Literal<"score">;
|
|
155
|
+
readonly instructions: Schema.String;
|
|
156
|
+
readonly levels: Schema.$Array<Schema.Struct<{
|
|
157
|
+
readonly label: Schema.String;
|
|
158
|
+
readonly description: Schema.optional<Schema.String>;
|
|
159
|
+
}>>;
|
|
160
|
+
}>]>;
|
|
161
|
+
export type DecisionQuestion = Schema.Schema.Type<typeof DecisionQuestion>;
|
|
162
|
+
export type DecisionQuestions = ReadonlyArray<DecisionQuestion>;
|
|
163
|
+
export declare const PredicateAnswer: Schema.Struct<{
|
|
164
|
+
readonly name: Schema.String;
|
|
165
|
+
readonly type: Schema.Literal<"predicate">;
|
|
166
|
+
readonly probability: Schema.Number;
|
|
167
|
+
}>;
|
|
168
|
+
export type PredicateAnswer = Schema.Schema.Type<typeof PredicateAnswer>;
|
|
169
|
+
export declare const ChoiceAnswer: Schema.Struct<{
|
|
170
|
+
readonly name: Schema.String;
|
|
171
|
+
readonly type: Schema.Literal<"choice">;
|
|
172
|
+
readonly choice: Schema.Union<readonly [Schema.String, Schema.Boolean]>;
|
|
173
|
+
readonly probabilities: Schema.$Array<Schema.Struct<{
|
|
174
|
+
readonly value: Schema.Union<readonly [Schema.String, Schema.Boolean]>;
|
|
175
|
+
readonly probability: Schema.Number;
|
|
176
|
+
}>>;
|
|
177
|
+
readonly confidence: Schema.Number;
|
|
178
|
+
}>;
|
|
179
|
+
export type ChoiceAnswer = Schema.Schema.Type<typeof ChoiceAnswer>;
|
|
180
|
+
/** `score` is the probability-weighted level index; `probabilities` has one entry per level. */
|
|
181
|
+
export declare const ScoreAnswer: Schema.Struct<{
|
|
182
|
+
readonly name: Schema.String;
|
|
183
|
+
readonly type: Schema.Literal<"score">;
|
|
184
|
+
readonly score: Schema.Number;
|
|
185
|
+
readonly probabilities: Schema.$Array<Schema.Struct<{
|
|
186
|
+
readonly value: Schema.Int;
|
|
187
|
+
readonly label: Schema.String;
|
|
188
|
+
readonly probability: Schema.Number;
|
|
189
|
+
}>>;
|
|
190
|
+
readonly confidence: Schema.Number;
|
|
191
|
+
}>;
|
|
192
|
+
export type ScoreAnswer = Schema.Schema.Type<typeof ScoreAnswer>;
|
|
193
|
+
/** Why a question has no answer; hosts may report reasons beyond these. */
|
|
194
|
+
export type DecisionErrorReason = OpenString<"refusal">;
|
|
195
|
+
export declare const DecisionErrorReason: Schema.Codec<DecisionErrorReason>;
|
|
196
|
+
/** This one question has no answer; the other answers still came back. */
|
|
197
|
+
export declare const DecisionErrorAnswer: Schema.Struct<{
|
|
198
|
+
readonly name: Schema.String;
|
|
199
|
+
readonly type: Schema.Literal<"error">;
|
|
200
|
+
readonly reason: Schema.Codec<DecisionErrorReason, DecisionErrorReason, never, never>;
|
|
201
|
+
readonly message: Schema.optional<Schema.String>;
|
|
202
|
+
}>;
|
|
203
|
+
export type DecisionErrorAnswer = Schema.Schema.Type<typeof DecisionErrorAnswer>;
|
|
204
|
+
export declare const DecisionAnswer: Schema.toTaggedUnion<"type", readonly [Schema.Struct<{
|
|
205
|
+
readonly name: Schema.String;
|
|
206
|
+
readonly type: Schema.Literal<"predicate">;
|
|
207
|
+
readonly probability: Schema.Number;
|
|
208
|
+
}>, Schema.Struct<{
|
|
209
|
+
readonly name: Schema.String;
|
|
210
|
+
readonly type: Schema.Literal<"choice">;
|
|
211
|
+
readonly choice: Schema.Union<readonly [Schema.String, Schema.Boolean]>;
|
|
212
|
+
readonly probabilities: Schema.$Array<Schema.Struct<{
|
|
213
|
+
readonly value: Schema.Union<readonly [Schema.String, Schema.Boolean]>;
|
|
214
|
+
readonly probability: Schema.Number;
|
|
215
|
+
}>>;
|
|
216
|
+
readonly confidence: Schema.Number;
|
|
217
|
+
}>, Schema.Struct<{
|
|
218
|
+
readonly name: Schema.String;
|
|
219
|
+
readonly type: Schema.Literal<"score">;
|
|
220
|
+
readonly score: Schema.Number;
|
|
221
|
+
readonly probabilities: Schema.$Array<Schema.Struct<{
|
|
222
|
+
readonly value: Schema.Int;
|
|
223
|
+
readonly label: Schema.String;
|
|
224
|
+
readonly probability: Schema.Number;
|
|
225
|
+
}>>;
|
|
226
|
+
readonly confidence: Schema.Number;
|
|
227
|
+
}>, Schema.Struct<{
|
|
228
|
+
readonly name: Schema.String;
|
|
229
|
+
readonly type: Schema.Literal<"error">;
|
|
230
|
+
readonly reason: Schema.Codec<DecisionErrorReason, DecisionErrorReason, never, never>;
|
|
231
|
+
readonly message: Schema.optional<Schema.String>;
|
|
232
|
+
}>]>;
|
|
233
|
+
export type DecisionAnswer = Schema.Schema.Type<typeof DecisionAnswer>;
|
|
234
|
+
type ChoiceValueOf<Question> = Question extends {
|
|
235
|
+
readonly choices: ReadonlyArray<{
|
|
236
|
+
readonly value: infer Value;
|
|
237
|
+
}>;
|
|
238
|
+
} ? Value : never;
|
|
239
|
+
export type DecisionAnswerFor<Question extends DecisionQuestion> = (Question extends {
|
|
240
|
+
readonly type: "predicate";
|
|
241
|
+
} ? PredicateAnswer & {
|
|
242
|
+
readonly name: Question["name"];
|
|
243
|
+
} : Question extends {
|
|
244
|
+
readonly type: "choice";
|
|
245
|
+
} ? {
|
|
246
|
+
readonly name: Question["name"];
|
|
247
|
+
readonly type: "choice";
|
|
248
|
+
readonly choice: ChoiceValueOf<Question>;
|
|
249
|
+
readonly probabilities: ReadonlyArray<{
|
|
250
|
+
readonly value: ChoiceValueOf<Question>;
|
|
251
|
+
readonly probability: number;
|
|
252
|
+
}>;
|
|
253
|
+
readonly confidence: number;
|
|
254
|
+
} : ScoreAnswer & {
|
|
255
|
+
readonly name: Question["name"];
|
|
256
|
+
}) | (DecisionErrorAnswer & {
|
|
257
|
+
readonly name: Question["name"];
|
|
258
|
+
});
|
|
259
|
+
/** One answer per question, in question order. */
|
|
260
|
+
export type DecisionAnswersFor<Questions extends DecisionQuestions> = {
|
|
261
|
+
readonly [Index in keyof Questions]: DecisionAnswerFor<Questions[Index]>;
|
|
262
|
+
};
|
|
263
|
+
export type DecisionOptions = Record<string, unknown>;
|
|
264
|
+
/** What a decision model's route does; `DecisionRoute.make(...).model(...)` builds one from a protocol. */
|
|
265
|
+
export interface DecisionModelRoute<Options extends DecisionOptions = DecisionOptions> {
|
|
266
|
+
readonly id: string;
|
|
267
|
+
generate(request: DecisionRequest<DecisionModel<Options>>, execute: Execute): Effect.Effect<DecisionResponse, AIError>;
|
|
268
|
+
}
|
|
269
|
+
declare const DecisionModelCompatibility_base: Schema.Class<DecisionModelCompatibility, Schema.Struct<{
|
|
270
|
+
/**
|
|
271
|
+
* Where a System One host reads media, from models.dev `[api.systemone] compatibility.media_input`, named after
|
|
272
|
+
* where the media goes in the body: `assets` (TypeSafe's assets map, referenced from the state), `state` (items
|
|
273
|
+
* inside a state list) or `root` (one top-level list per kind: `images`, `audio`, `videos`).
|
|
274
|
+
*/
|
|
275
|
+
readonly mediaInput: Schema.optional<Schema.Literals<readonly ["assets", "state", "root"]>>;
|
|
276
|
+
}>, {}>;
|
|
277
|
+
/** Host quirks a protocol adapts to, like `LanguageModelCompatibility` for language models. */
|
|
278
|
+
export declare class DecisionModelCompatibility extends DecisionModelCompatibility_base {
|
|
279
|
+
}
|
|
280
|
+
export declare namespace DecisionModelCompatibility {
|
|
281
|
+
type Input = DecisionModelCompatibility | ConstructorParameters<typeof DecisionModelCompatibility>[0];
|
|
282
|
+
const make: (input: Input) => DecisionModelCompatibility;
|
|
283
|
+
}
|
|
284
|
+
export declare class DecisionModel<Options extends DecisionOptions = DecisionOptions> {
|
|
285
|
+
protected readonly _Options: Options;
|
|
286
|
+
readonly id: ModelID;
|
|
287
|
+
readonly provider: ProviderID;
|
|
288
|
+
readonly route: DecisionModelRoute<Options>;
|
|
289
|
+
/** Deployment `http` settings, below each request's own. */
|
|
290
|
+
readonly transport?: TransportOptions;
|
|
291
|
+
readonly compatibility?: DecisionModelCompatibility;
|
|
292
|
+
/** Defaults under each request's `providerOptions`, such as options a provider package reads from its settings. */
|
|
293
|
+
readonly providerOptions?: ProviderOptions;
|
|
294
|
+
constructor(input: DecisionModel.Input<Options>);
|
|
295
|
+
static make<Options extends DecisionOptions = DecisionOptions>(input: DecisionModel.MakeInput<Options>): DecisionModel<Options>;
|
|
296
|
+
}
|
|
297
|
+
export declare namespace DecisionModel {
|
|
298
|
+
interface Input<Options extends DecisionOptions = DecisionOptions> {
|
|
299
|
+
readonly id: ModelID;
|
|
300
|
+
readonly provider: ProviderID;
|
|
301
|
+
readonly route: DecisionModelRoute<Options>;
|
|
302
|
+
readonly transport?: TransportOptions;
|
|
303
|
+
readonly compatibility?: DecisionModelCompatibility;
|
|
304
|
+
readonly providerOptions?: ProviderOptions;
|
|
305
|
+
}
|
|
306
|
+
interface MakeInput<Options extends DecisionOptions = DecisionOptions> extends Omit<Input<Options>, "id" | "provider"> {
|
|
307
|
+
readonly id: string | ModelID;
|
|
308
|
+
readonly provider: string | ProviderID;
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
export declare const DecisionModelSchema: Schema.declare<DecisionModel<DecisionOptions>, DecisionModel<DecisionOptions>>;
|
|
312
|
+
export type DecisionModelOptions<Model> = Model extends DecisionModel<infer Options> ? Options : never;
|
|
313
|
+
/** A normalized decision request, the plain object `ai.decision.request(...)` returns. */
|
|
314
|
+
export interface DecisionRequest<Model extends DecisionModel = DecisionModel, Questions extends DecisionQuestions = DecisionQuestions> extends BaseRequest<Model, DecisionModelOptions<Model>> {
|
|
315
|
+
readonly input: ReadonlyArray<DecisionPart>;
|
|
316
|
+
readonly questions: Questions;
|
|
317
|
+
}
|
|
318
|
+
/** Input accepted by `ai.decision.request` and `generate`. A `DecisionRequest` is also a valid input. */
|
|
319
|
+
export interface DecisionRequestInput<Model extends DecisionModel = DecisionModel, Questions extends DecisionQuestions = DecisionQuestions> extends BaseRequest<Model, NoInfer<DecisionModelOptions<Model>>> {
|
|
320
|
+
readonly input: DecisionInput;
|
|
321
|
+
readonly questions: Questions;
|
|
322
|
+
}
|
|
323
|
+
declare const DecisionUsage_base: Schema.Class<DecisionUsage, Schema.Struct<{
|
|
324
|
+
readonly inputTokens: Schema.optional<Schema.Number>;
|
|
325
|
+
readonly outputTokens: Schema.optional<Schema.Number>;
|
|
326
|
+
readonly totalTokens: Schema.optional<Schema.Number>;
|
|
327
|
+
/** USD the host says it charged for this request. */
|
|
328
|
+
readonly cost: Schema.optional<Schema.Number>;
|
|
329
|
+
}>, {}>;
|
|
330
|
+
/** What decision hosts report; their raw usage stays in the response's `providerMetadata`. */
|
|
331
|
+
export declare class DecisionUsage extends DecisionUsage_base {
|
|
332
|
+
}
|
|
333
|
+
declare const DecisionResponse_base: Schema.Class<DecisionResponse, Schema.Struct<{
|
|
334
|
+
readonly answers: Schema.$Array<Schema.toTaggedUnion<"type", readonly [Schema.Struct<{
|
|
335
|
+
readonly name: Schema.String;
|
|
336
|
+
readonly type: Schema.Literal<"predicate">;
|
|
337
|
+
readonly probability: Schema.Number;
|
|
338
|
+
}>, Schema.Struct<{
|
|
339
|
+
readonly name: Schema.String;
|
|
340
|
+
readonly type: Schema.Literal<"choice">;
|
|
341
|
+
readonly choice: Schema.Union<readonly [Schema.String, Schema.Boolean]>;
|
|
342
|
+
readonly probabilities: Schema.$Array<Schema.Struct<{
|
|
343
|
+
readonly value: Schema.Union<readonly [Schema.String, Schema.Boolean]>;
|
|
344
|
+
readonly probability: Schema.Number;
|
|
345
|
+
}>>;
|
|
346
|
+
readonly confidence: Schema.Number;
|
|
347
|
+
}>, Schema.Struct<{
|
|
348
|
+
readonly name: Schema.String;
|
|
349
|
+
readonly type: Schema.Literal<"score">;
|
|
350
|
+
readonly score: Schema.Number;
|
|
351
|
+
readonly probabilities: Schema.$Array<Schema.Struct<{
|
|
352
|
+
readonly value: Schema.Int;
|
|
353
|
+
readonly label: Schema.String;
|
|
354
|
+
readonly probability: Schema.Number;
|
|
355
|
+
}>>;
|
|
356
|
+
readonly confidence: Schema.Number;
|
|
357
|
+
}>, Schema.Struct<{
|
|
358
|
+
readonly name: Schema.String;
|
|
359
|
+
readonly type: Schema.Literal<"error">;
|
|
360
|
+
readonly reason: Schema.Codec<DecisionErrorReason, DecisionErrorReason, never, never>;
|
|
361
|
+
readonly message: Schema.optional<Schema.String>;
|
|
362
|
+
}>]>>;
|
|
363
|
+
readonly usage: Schema.optional<typeof DecisionUsage>;
|
|
364
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
365
|
+
}>, {}>;
|
|
366
|
+
export declare class DecisionResponse extends DecisionResponse_base {
|
|
367
|
+
}
|
|
368
|
+
export type DecisionResponseFor<Questions extends DecisionQuestions> = Omit<DecisionResponse, "answers"> & {
|
|
369
|
+
readonly answers: DecisionAnswersFor<Questions>;
|
|
370
|
+
};
|
|
371
|
+
/** Normalize decision request input into a plain `DecisionRequest`; a plain object `input` becomes one `json` part. */
|
|
372
|
+
export declare const request: <const Model extends DecisionModel, const Questions extends DecisionQuestions>(input: DecisionRequestInput<Model, Questions>) => DecisionRequest<Model, Questions>;
|
|
373
|
+
export declare function generate<const Model extends DecisionModel, const Questions extends DecisionQuestions>(input: DecisionRequestInput<Model, Questions>): Effect.Effect<DecisionResponseFor<Questions>, AIError, AI.Service>;
|
|
374
|
+
export declare const Decision: {
|
|
375
|
+
readonly request: typeof request;
|
|
376
|
+
readonly generate: typeof generate;
|
|
377
|
+
};
|
|
378
|
+
export {};
|
package/dist/decision.js
ADDED
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import { Effect, Schema } from "effect";
|
|
2
|
+
import { AI } from "./ai.js";
|
|
3
|
+
import { Media } from "./media.js";
|
|
4
|
+
import { tryRequest } from "./media-model.js";
|
|
5
|
+
import { AIError, ModelID, ProviderID, ProviderMetadata, ProviderOptions, } from "./schema/index.js";
|
|
6
|
+
// ---------------------------------------------------------------------------
|
|
7
|
+
// Input
|
|
8
|
+
// ---------------------------------------------------------------------------
|
|
9
|
+
export const DecisionTextPart = Schema.Struct({ type: Schema.Literal("text"), text: Schema.String });
|
|
10
|
+
export const DecisionJsonPart = Schema.Struct({ type: Schema.Literal("json"), value: Schema.Json });
|
|
11
|
+
export const DecisionMediaPart = Schema.Struct({
|
|
12
|
+
type: Schema.Literal("media"),
|
|
13
|
+
media: Media.AssetSchema,
|
|
14
|
+
filename: Schema.optional(Schema.String),
|
|
15
|
+
});
|
|
16
|
+
export const DecisionPart = Schema.Union([DecisionTextPart, DecisionJsonPart, DecisionMediaPart]).pipe(Schema.toTaggedUnion("type"));
|
|
17
|
+
// ---------------------------------------------------------------------------
|
|
18
|
+
// Questions
|
|
19
|
+
// ---------------------------------------------------------------------------
|
|
20
|
+
/** Choice values are typed: `true` and `"true"` are different values. */
|
|
21
|
+
export const ChoiceValue = Schema.Union([Schema.String, Schema.Boolean]);
|
|
22
|
+
export const PredicateQuestion = Schema.Struct({
|
|
23
|
+
name: Schema.String,
|
|
24
|
+
type: Schema.Literal("predicate"),
|
|
25
|
+
instructions: Schema.String,
|
|
26
|
+
/** What counts as true and as false, for statements the instructions alone leave ambiguous. */
|
|
27
|
+
criteria: Schema.optional(Schema.Struct({ true: Schema.optional(Schema.String), false: Schema.optional(Schema.String) })),
|
|
28
|
+
});
|
|
29
|
+
export const ChoiceQuestion = Schema.Struct({
|
|
30
|
+
name: Schema.String,
|
|
31
|
+
type: Schema.Literal("choice"),
|
|
32
|
+
instructions: Schema.String,
|
|
33
|
+
choices: Schema.Array(Schema.Struct({ value: ChoiceValue, description: Schema.optional(Schema.String) })),
|
|
34
|
+
});
|
|
35
|
+
export const ScoreQuestion = Schema.Struct({
|
|
36
|
+
name: Schema.String,
|
|
37
|
+
type: Schema.Literal("score"),
|
|
38
|
+
instructions: Schema.String,
|
|
39
|
+
levels: Schema.Array(Schema.Struct({ label: Schema.String, description: Schema.optional(Schema.String) })),
|
|
40
|
+
});
|
|
41
|
+
export const DecisionQuestion = Schema.Union([PredicateQuestion, ChoiceQuestion, ScoreQuestion]).pipe(Schema.toTaggedUnion("type"));
|
|
42
|
+
// Only what makes a request meaningless is checked here; counts and sizes are the host's to enforce.
|
|
43
|
+
const DecisionQuestionList = Schema.Array(DecisionQuestion).pipe(Schema.refine((x) => x.length > 0, { message: "Decision questions must not be empty" }), Schema.refine((x) => new Set(x.map((question) => question.name)).size === x.length, {
|
|
44
|
+
message: "Decision question names must be unique",
|
|
45
|
+
}));
|
|
46
|
+
// ---------------------------------------------------------------------------
|
|
47
|
+
// Answers
|
|
48
|
+
// ---------------------------------------------------------------------------
|
|
49
|
+
const Probability = Schema.Number.check(Schema.isBetween({ minimum: 0, maximum: 1 }));
|
|
50
|
+
export const PredicateAnswer = Schema.Struct({
|
|
51
|
+
name: Schema.String,
|
|
52
|
+
type: Schema.Literal("predicate"),
|
|
53
|
+
probability: Probability,
|
|
54
|
+
});
|
|
55
|
+
export const ChoiceAnswer = Schema.Struct({
|
|
56
|
+
name: Schema.String,
|
|
57
|
+
type: Schema.Literal("choice"),
|
|
58
|
+
choice: ChoiceValue,
|
|
59
|
+
probabilities: Schema.Array(Schema.Struct({ value: ChoiceValue, probability: Probability })),
|
|
60
|
+
confidence: Probability,
|
|
61
|
+
});
|
|
62
|
+
/** `score` is the probability-weighted level index; `probabilities` has one entry per level. */
|
|
63
|
+
export const ScoreAnswer = Schema.Struct({
|
|
64
|
+
name: Schema.String,
|
|
65
|
+
type: Schema.Literal("score"),
|
|
66
|
+
score: Schema.Number,
|
|
67
|
+
probabilities: Schema.Array(Schema.Struct({ value: Schema.Int, label: Schema.String, probability: Probability })),
|
|
68
|
+
confidence: Probability,
|
|
69
|
+
});
|
|
70
|
+
export const DecisionErrorReason = Schema.Union([Schema.Literal("refusal"), Schema.String]);
|
|
71
|
+
/** This one question has no answer; the other answers still came back. */
|
|
72
|
+
export const DecisionErrorAnswer = Schema.Struct({
|
|
73
|
+
name: Schema.String,
|
|
74
|
+
type: Schema.Literal("error"),
|
|
75
|
+
reason: DecisionErrorReason,
|
|
76
|
+
message: Schema.optional(Schema.String),
|
|
77
|
+
});
|
|
78
|
+
export const DecisionAnswer = Schema.Union([PredicateAnswer, ChoiceAnswer, ScoreAnswer, DecisionErrorAnswer]).pipe(Schema.toTaggedUnion("type"));
|
|
79
|
+
/** Host quirks a protocol adapts to, like `LanguageModelCompatibility` for language models. */
|
|
80
|
+
export class DecisionModelCompatibility extends Schema.Class("Decision.ModelCompatibility")({
|
|
81
|
+
/**
|
|
82
|
+
* Where a System One host reads media, from models.dev `[api.systemone] compatibility.media_input`, named after
|
|
83
|
+
* where the media goes in the body: `assets` (TypeSafe's assets map, referenced from the state), `state` (items
|
|
84
|
+
* inside a state list) or `root` (one top-level list per kind: `images`, `audio`, `videos`).
|
|
85
|
+
*/
|
|
86
|
+
mediaInput: Schema.optional(Schema.Literals(["assets", "state", "root"])),
|
|
87
|
+
}) {
|
|
88
|
+
}
|
|
89
|
+
(function (DecisionModelCompatibility) {
|
|
90
|
+
DecisionModelCompatibility.make = (input) => input instanceof DecisionModelCompatibility ? input : new DecisionModelCompatibility(input);
|
|
91
|
+
})(DecisionModelCompatibility || (DecisionModelCompatibility = {}));
|
|
92
|
+
export class DecisionModel {
|
|
93
|
+
id;
|
|
94
|
+
provider;
|
|
95
|
+
route;
|
|
96
|
+
/** Deployment `http` settings, below each request's own. */
|
|
97
|
+
transport;
|
|
98
|
+
compatibility;
|
|
99
|
+
/** Defaults under each request's `providerOptions`, such as options a provider package reads from its settings. */
|
|
100
|
+
providerOptions;
|
|
101
|
+
constructor(input) {
|
|
102
|
+
this.id = input.id;
|
|
103
|
+
this.provider = input.provider;
|
|
104
|
+
this.route = input.route;
|
|
105
|
+
this.transport = input.transport;
|
|
106
|
+
this.compatibility = input.compatibility;
|
|
107
|
+
this.providerOptions = input.providerOptions;
|
|
108
|
+
}
|
|
109
|
+
static make(input) {
|
|
110
|
+
return new DecisionModel({
|
|
111
|
+
...input,
|
|
112
|
+
id: ModelID.make(input.id),
|
|
113
|
+
provider: ProviderID.make(input.provider),
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
export const DecisionModelSchema = Schema.declare((value) => value instanceof DecisionModel, {
|
|
118
|
+
expected: "Decision.Model",
|
|
119
|
+
});
|
|
120
|
+
// ---------------------------------------------------------------------------
|
|
121
|
+
// Request and response
|
|
122
|
+
// ---------------------------------------------------------------------------
|
|
123
|
+
const DecisionRequestSchema = Schema.Struct({
|
|
124
|
+
model: DecisionModelSchema,
|
|
125
|
+
input: Schema.Array(DecisionPart),
|
|
126
|
+
questions: DecisionQuestionList,
|
|
127
|
+
providerOptions: Schema.optional(ProviderOptions),
|
|
128
|
+
});
|
|
129
|
+
/** What decision hosts report; their raw usage stays in the response's `providerMetadata`. */
|
|
130
|
+
export class DecisionUsage extends Schema.Class("Decision.Usage")({
|
|
131
|
+
inputTokens: Schema.optional(Schema.Number),
|
|
132
|
+
outputTokens: Schema.optional(Schema.Number),
|
|
133
|
+
totalTokens: Schema.optional(Schema.Number),
|
|
134
|
+
/** USD the host says it charged for this request. */
|
|
135
|
+
cost: Schema.optional(Schema.Number),
|
|
136
|
+
}) {
|
|
137
|
+
}
|
|
138
|
+
export class DecisionResponse extends Schema.Class("Decision.Response")({
|
|
139
|
+
answers: Schema.Array(DecisionAnswer),
|
|
140
|
+
usage: Schema.optional(DecisionUsage),
|
|
141
|
+
providerMetadata: Schema.optional(ProviderMetadata),
|
|
142
|
+
}) {
|
|
143
|
+
}
|
|
144
|
+
// ---------------------------------------------------------------------------
|
|
145
|
+
// Call API
|
|
146
|
+
// ---------------------------------------------------------------------------
|
|
147
|
+
/** Normalize decision request input into a plain `DecisionRequest`; a plain object `input` becomes one `json` part. */
|
|
148
|
+
export const request = (input) => ({
|
|
149
|
+
...input,
|
|
150
|
+
input: isParts(input.input) ? input.input.map(decisionPart) : [{ type: "json", value: input.input }],
|
|
151
|
+
});
|
|
152
|
+
const validate = Schema.decodeUnknownSync(DecisionRequestSchema);
|
|
153
|
+
// `Array.isArray` doesn't narrow a readonly array union, so the object branch would keep the parts type.
|
|
154
|
+
const isParts = (input) => Array.isArray(input);
|
|
155
|
+
const decisionPart = (part) => {
|
|
156
|
+
if (part.type !== "media")
|
|
157
|
+
return part;
|
|
158
|
+
const { mediaType, ...rest } = part;
|
|
159
|
+
return { ...rest, media: Media.make(part.media, mediaType) };
|
|
160
|
+
};
|
|
161
|
+
export function generate(input) {
|
|
162
|
+
return tryRequest(() => {
|
|
163
|
+
const normalized = request(input);
|
|
164
|
+
validate(normalized);
|
|
165
|
+
return normalized;
|
|
166
|
+
}).pipe(Effect.flatMap((request) => AI.Service.use((ai) => ai.decision.generate(request))));
|
|
167
|
+
}
|
|
168
|
+
export const Decision = {
|
|
169
|
+
request,
|
|
170
|
+
generate,
|
|
171
|
+
};
|
package/dist/effect.d.ts
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { LLM } from "./llm.js";
|
|
2
|
+
/** The Effect API: the same shape as `ai` from `@radheim/ai`, returning `Effect` and `Stream`. */
|
|
3
|
+
export declare const ai: {
|
|
4
|
+
readonly request: typeof LLM.request;
|
|
5
|
+
readonly generate: typeof LLM.generate;
|
|
6
|
+
readonly text: typeof LLM.text;
|
|
7
|
+
readonly object: typeof LLM.object;
|
|
8
|
+
readonly stream: typeof LLM.stream;
|
|
9
|
+
readonly loop: typeof LLM.loop;
|
|
10
|
+
readonly collect: typeof LLM.collect;
|
|
11
|
+
readonly compact: typeof LLM.compact;
|
|
12
|
+
readonly canCompact: typeof LLM.canCompact;
|
|
13
|
+
readonly image: {
|
|
14
|
+
readonly request: typeof import("./image.js").request;
|
|
15
|
+
readonly generate: typeof import("./image.js").generate;
|
|
16
|
+
readonly stream: typeof import("./image.js").stream;
|
|
17
|
+
readonly start: typeof import("./image.js").start;
|
|
18
|
+
readonly status: typeof import("./image.js").status;
|
|
19
|
+
readonly result: typeof import("./image.js").result;
|
|
20
|
+
readonly cancel: typeof import("./image.js").cancel;
|
|
21
|
+
};
|
|
22
|
+
readonly decision: {
|
|
23
|
+
readonly request: typeof import("./decision.js").request;
|
|
24
|
+
readonly generate: typeof import("./decision.js").generate;
|
|
25
|
+
};
|
|
26
|
+
readonly embedding: {
|
|
27
|
+
readonly request: typeof import("./embedding.js").request;
|
|
28
|
+
readonly generate: typeof import("./embedding.js").generate;
|
|
29
|
+
};
|
|
30
|
+
readonly video: {
|
|
31
|
+
readonly request: typeof import("./video.js").request;
|
|
32
|
+
readonly start: typeof import("./video.js").start;
|
|
33
|
+
readonly status: typeof import("./video.js").status;
|
|
34
|
+
readonly result: typeof import("./video.js").result;
|
|
35
|
+
readonly cancel: typeof import("./video.js").cancel;
|
|
36
|
+
};
|
|
37
|
+
/** Experimental: may change without compatibility guarantees. */
|
|
38
|
+
readonly experimental: {
|
|
39
|
+
readonly speech: {
|
|
40
|
+
readonly request: typeof import("./speech.js").request;
|
|
41
|
+
readonly generate: typeof import("./speech.js").generate;
|
|
42
|
+
readonly stream: typeof import("./speech.js").stream;
|
|
43
|
+
};
|
|
44
|
+
readonly transcription: {
|
|
45
|
+
readonly request: typeof import("./transcription.js").request;
|
|
46
|
+
readonly generate: typeof import("./transcription.js").generate;
|
|
47
|
+
readonly stream: typeof import("./transcription.js").stream;
|
|
48
|
+
readonly start: typeof import("./transcription.js").start;
|
|
49
|
+
readonly resume: typeof import("./transcription.js").resume;
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
export { AI } from "./ai.js";
|
|
54
|
+
export type { AIService } from "./ai.js";
|
|
55
|
+
export { Generation } from "./generation.js";
|
|
56
|
+
export { ToolFailure, tool } from "./tool.js";
|
|
57
|
+
export { ToolRuntime } from "./tool-runtime.js";
|
|
58
|
+
export type { ToolSettlement } from "./tool-runtime.js";
|
|
59
|
+
export * from "./public.js";
|
package/dist/effect.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Decision } from "./decision.js";
|
|
2
|
+
import { Embedding } from "./embedding.js";
|
|
3
|
+
import { Image } from "./image.js";
|
|
4
|
+
import { LLM } from "./llm.js";
|
|
5
|
+
import { Speech } from "./speech.js";
|
|
6
|
+
import { Transcription } from "./transcription.js";
|
|
7
|
+
import { Video } from "./video.js";
|
|
8
|
+
/** The Effect API: the same shape as `ai` from `@radheim/ai`, returning `Effect` and `Stream`. */
|
|
9
|
+
export const ai = {
|
|
10
|
+
request: LLM.request,
|
|
11
|
+
generate: LLM.generate,
|
|
12
|
+
text: LLM.text,
|
|
13
|
+
object: LLM.object,
|
|
14
|
+
stream: LLM.stream,
|
|
15
|
+
loop: LLM.loop,
|
|
16
|
+
collect: LLM.collect,
|
|
17
|
+
compact: LLM.compact,
|
|
18
|
+
canCompact: LLM.canCompact,
|
|
19
|
+
image: Image,
|
|
20
|
+
decision: Decision,
|
|
21
|
+
embedding: Embedding,
|
|
22
|
+
video: Video,
|
|
23
|
+
/** Experimental: may change without compatibility guarantees. */
|
|
24
|
+
experimental: {
|
|
25
|
+
speech: Speech,
|
|
26
|
+
transcription: Transcription,
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
export { AI } from "./ai.js";
|
|
30
|
+
export { Generation } from "./generation.js";
|
|
31
|
+
export { ToolFailure, tool } from "./tool.js";
|
|
32
|
+
export { ToolRuntime } from "./tool-runtime.js";
|
|
33
|
+
export * from "./public.js";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type LLMRequest, type EffortPart, type Message } from "./schema/messages.js";
|
|
2
|
+
export declare const effortUpdate: (message: Message) => EffortPart | undefined;
|
|
3
|
+
export declare const stripEffortUpdates: (request: LLMRequest) => LLMRequest<import("./public.js").LanguageModel<{
|
|
4
|
+
readonly [x: string]: unknown;
|
|
5
|
+
}, import("./route.js").CompactionOperations | undefined>>;
|
|
6
|
+
export declare const applyEffortUpdates: (request: LLMRequest) => LLMRequest;
|
|
7
|
+
export declare const resolveEffortUpdates: (request: LLMRequest, current: string | undefined) => {
|
|
8
|
+
request: LLMRequest<import("./public.js").LanguageModel<{
|
|
9
|
+
readonly [x: string]: unknown;
|
|
10
|
+
}, import("./route.js").CompactionOperations | undefined>>;
|
|
11
|
+
effort: string | undefined;
|
|
12
|
+
};
|