@llumiverse/drivers 1.2.0 → 1.4.0-dev.20260629.090753Z
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/lib/{types/adobe → adobe}/firefly.d.ts +2 -1
- package/lib/adobe/firefly.d.ts.map +1 -0
- package/lib/adobe/firefly.js +120 -0
- package/lib/adobe/firefly.js.map +1 -0
- package/lib/anthropic/index.d.ts +23 -0
- package/lib/anthropic/index.d.ts.map +1 -0
- package/lib/anthropic/index.js +68 -0
- package/lib/anthropic/index.js.map +1 -0
- package/lib/{types/azure → azure}/azure_foundry.d.ts +9 -7
- package/lib/azure/azure_foundry.d.ts.map +1 -0
- package/lib/{esm/azure → azure}/azure_foundry.js +138 -124
- package/lib/azure/azure_foundry.js.map +1 -0
- package/lib/{types/bedrock → bedrock}/converse.d.ts +2 -2
- package/lib/bedrock/converse.d.ts.map +1 -0
- package/lib/{esm/bedrock → bedrock}/converse.js +86 -79
- package/lib/bedrock/converse.js.map +1 -0
- package/lib/bedrock/embeddings.d.ts +4 -0
- package/lib/bedrock/embeddings.d.ts.map +1 -0
- package/lib/bedrock/embeddings.js +359 -0
- package/lib/bedrock/embeddings.js.map +1 -0
- package/lib/{types/bedrock → bedrock}/index.d.ts +33 -9
- package/lib/bedrock/index.d.ts.map +1 -0
- package/lib/{esm/bedrock → bedrock}/index.js +599 -324
- package/lib/bedrock/index.js.map +1 -0
- package/lib/{types/bedrock → bedrock}/nova-image-payload.d.ts +5 -5
- package/lib/bedrock/nova-image-payload.d.ts.map +1 -0
- package/lib/{esm/bedrock → bedrock}/nova-image-payload.js +31 -36
- package/lib/bedrock/nova-image-payload.js.map +1 -0
- package/lib/{types/bedrock → bedrock}/payloads.d.ts +1 -1
- package/lib/bedrock/payloads.d.ts.map +1 -0
- package/lib/{cjs/bedrock → bedrock}/payloads.js.map +1 -1
- package/lib/{types/bedrock → bedrock}/s3.d.ts +3 -2
- package/lib/bedrock/s3.d.ts.map +1 -0
- package/lib/{esm/bedrock → bedrock}/s3.js +27 -23
- package/lib/bedrock/s3.js.map +1 -0
- package/lib/{types/bedrock → bedrock}/twelvelabs.d.ts +8 -9
- package/lib/bedrock/twelvelabs.d.ts.map +1 -0
- package/lib/{esm/bedrock → bedrock}/twelvelabs.js +17 -21
- package/lib/bedrock/twelvelabs.js.map +1 -0
- package/lib/{types/groq → groq}/index.d.ts +6 -4
- package/lib/groq/index.d.ts.map +1 -0
- package/lib/{esm/groq → groq}/index.js +72 -39
- package/lib/groq/index.js.map +1 -0
- package/lib/{types/huggingface_ie.d.ts → huggingface_ie.d.ts} +4 -3
- package/lib/huggingface_ie.d.ts.map +1 -0
- package/lib/{esm/huggingface_ie.js → huggingface_ie.js} +32 -31
- package/lib/huggingface_ie.js.map +1 -0
- package/lib/index.d.ts +16 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +16 -0
- package/lib/index.js.map +1 -0
- package/lib/{types/mistral → mistral}/index.d.ts +6 -5
- package/lib/mistral/index.d.ts.map +1 -0
- package/lib/{esm/mistral → mistral}/index.js +66 -38
- package/lib/mistral/index.js.map +1 -0
- package/lib/{types/mistral → mistral}/types.d.ts +1 -0
- package/lib/mistral/types.d.ts.map +1 -0
- package/lib/mistral/types.js.map +1 -0
- package/lib/{types/openai → openai}/azure_openai.d.ts +5 -4
- package/lib/openai/azure_openai.d.ts.map +1 -0
- package/lib/{esm/openai → openai}/azure_openai.js +17 -14
- package/lib/openai/azure_openai.js.map +1 -0
- package/lib/openai/drivers.d.ts +4 -0
- package/lib/openai/drivers.d.ts.map +1 -0
- package/lib/openai/drivers.js +9 -0
- package/lib/openai/drivers.js.map +1 -0
- package/lib/{types/openai → openai}/index.d.ts +17 -5
- package/lib/openai/index.d.ts.map +1 -0
- package/lib/{esm/openai → openai}/index.js +254 -148
- package/lib/openai/index.js.map +1 -0
- package/lib/{types/openai → openai}/openai.d.ts +3 -3
- package/lib/openai/openai.d.ts.map +1 -0
- package/lib/openai/openai.js +15 -0
- package/lib/openai/openai.js.map +1 -0
- package/lib/{types/openai → openai}/openai_compatible.d.ts +3 -3
- package/lib/openai/openai_compatible.d.ts.map +1 -0
- package/lib/{esm/openai → openai}/openai_compatible.js +14 -11
- package/lib/openai/openai_compatible.js.map +1 -0
- package/lib/{types/openai → openai}/openai_format.d.ts +3 -2
- package/lib/openai/openai_format.d.ts.map +1 -0
- package/lib/{esm/openai → openai}/openai_format.js +66 -24
- package/lib/openai/openai_format.js.map +1 -0
- package/lib/{types/replicate.d.ts → replicate.d.ts} +3 -2
- package/lib/replicate.d.ts.map +1 -0
- package/lib/{esm/replicate.js → replicate.js} +59 -49
- package/lib/replicate.js.map +1 -0
- package/lib/shared/claude-messages.d.ts +99 -0
- package/lib/shared/claude-messages.d.ts.map +1 -0
- package/lib/shared/claude-messages.js +869 -0
- package/lib/shared/claude-messages.js.map +1 -0
- package/lib/{types/shared → shared}/claude-thinking.d.ts +1 -1
- package/lib/shared/claude-thinking.d.ts.map +1 -0
- package/lib/{esm/shared → shared}/claude-thinking.js +5 -7
- package/lib/shared/claude-thinking.js.map +1 -0
- package/lib/shared/debug-prompt.d.ts +5 -0
- package/lib/shared/debug-prompt.d.ts.map +1 -0
- package/lib/shared/debug-prompt.js +25 -0
- package/lib/shared/debug-prompt.js.map +1 -0
- package/lib/{types/test-driver → test-driver}/TestErrorCompletionStream.d.ts +1 -1
- package/lib/test-driver/TestErrorCompletionStream.d.ts.map +1 -0
- package/lib/test-driver/TestErrorCompletionStream.js +16 -0
- package/lib/test-driver/TestErrorCompletionStream.js.map +1 -0
- package/lib/{types/test-driver → test-driver}/TestValidationErrorCompletionStream.d.ts +1 -1
- package/lib/test-driver/TestValidationErrorCompletionStream.d.ts.map +1 -0
- package/lib/{esm/test-driver → test-driver}/TestValidationErrorCompletionStream.js +4 -4
- package/lib/test-driver/TestValidationErrorCompletionStream.js.map +1 -0
- package/lib/{types/test-driver → test-driver}/index.d.ts +3 -3
- package/lib/test-driver/index.d.ts.map +1 -0
- package/lib/{esm/test-driver → test-driver}/index.js +20 -20
- package/lib/test-driver/index.js.map +1 -0
- package/lib/{types/test-driver → test-driver}/utils.d.ts +1 -1
- package/lib/test-driver/utils.d.ts.map +1 -0
- package/lib/{esm/test-driver → test-driver}/utils.js +4 -4
- package/lib/test-driver/utils.js.map +1 -0
- package/lib/togetherai/index.d.ts +15 -0
- package/lib/togetherai/index.d.ts.map +1 -0
- package/lib/togetherai/index.js +54 -0
- package/lib/togetherai/index.js.map +1 -0
- package/lib/{types/togetherai → togetherai}/interfaces.d.ts +1 -1
- package/lib/togetherai/interfaces.d.ts.map +1 -0
- package/lib/{cjs/watsonx → togetherai}/interfaces.js.map +1 -1
- package/lib/vertexai/debug.d.ts +2 -0
- package/lib/vertexai/debug.d.ts.map +1 -0
- package/lib/{esm/vertexai → vertexai}/debug.js +1 -1
- package/lib/vertexai/debug.js.map +1 -0
- package/lib/vertexai/embeddings/embed-legacy-multimodal.d.ts +9 -0
- package/lib/vertexai/embeddings/embed-legacy-multimodal.d.ts.map +1 -0
- package/lib/vertexai/embeddings/embed-legacy-multimodal.js +141 -0
- package/lib/vertexai/embeddings/embed-legacy-multimodal.js.map +1 -0
- package/lib/vertexai/embeddings/embed.d.ts +13 -0
- package/lib/vertexai/embeddings/embed.d.ts.map +1 -0
- package/lib/vertexai/embeddings/embed.js +162 -0
- package/lib/vertexai/embeddings/embed.js.map +1 -0
- package/lib/vertexai/embeddings/source-utils.d.ts +9 -0
- package/lib/vertexai/embeddings/source-utils.d.ts.map +1 -0
- package/lib/vertexai/embeddings/source-utils.js +18 -0
- package/lib/vertexai/embeddings/source-utils.js.map +1 -0
- package/lib/{types/vertexai → vertexai}/index.d.ts +31 -19
- package/lib/vertexai/index.d.ts.map +1 -0
- package/lib/{esm/vertexai → vertexai}/index.js +221 -159
- package/lib/vertexai/index.js.map +1 -0
- package/lib/vertexai/models/claude.d.ts +16 -0
- package/lib/vertexai/models/claude.d.ts.map +1 -0
- package/lib/vertexai/models/claude.js +65 -0
- package/lib/vertexai/models/claude.js.map +1 -0
- package/lib/{types/vertexai → vertexai}/models/gemini.d.ts +29 -5
- package/lib/vertexai/models/gemini.d.ts.map +1 -0
- package/lib/{esm/vertexai → vertexai}/models/gemini.js +255 -127
- package/lib/vertexai/models/gemini.js.map +1 -0
- package/lib/{types/vertexai → vertexai}/models/imagen.d.ts +12 -11
- package/lib/vertexai/models/imagen.d.ts.map +1 -0
- package/lib/{esm/vertexai → vertexai}/models/imagen.js +74 -47
- package/lib/vertexai/models/imagen.js.map +1 -0
- package/lib/{types/vertexai → vertexai}/models/llama.d.ts +4 -4
- package/lib/vertexai/models/llama.d.ts.map +1 -0
- package/lib/{esm/vertexai → vertexai}/models/llama.js +37 -33
- package/lib/vertexai/models/llama.js.map +1 -0
- package/lib/vertexai/models.d.ts +21 -0
- package/lib/vertexai/models.d.ts.map +1 -0
- package/lib/{esm/vertexai → vertexai}/models.js +12 -9
- package/lib/vertexai/models.js.map +1 -0
- package/lib/{types/watsonx → watsonx}/index.d.ts +4 -3
- package/lib/watsonx/index.d.ts.map +1 -0
- package/lib/{esm/watsonx → watsonx}/index.js +69 -41
- package/lib/watsonx/index.js.map +1 -0
- package/lib/watsonx/interfaces.d.ts.map +1 -0
- package/lib/{esm/watsonx → watsonx}/interfaces.js.map +1 -1
- package/lib/{types/xai → xai}/index.d.ts +4 -4
- package/lib/xai/index.d.ts.map +1 -0
- package/lib/{esm/xai → xai}/index.js +22 -18
- package/lib/xai/index.js.map +1 -0
- package/package.json +88 -36
- package/src/adobe/firefly.ts +60 -43
- package/src/anthropic/index.ts +121 -0
- package/src/azure/azure_foundry.ts +210 -165
- package/src/bedrock/converse.ts +124 -101
- package/src/bedrock/embeddings.test.ts +508 -0
- package/src/bedrock/embeddings.ts +517 -0
- package/src/bedrock/error-handling.test.ts +62 -14
- package/src/bedrock/index.ts +832 -466
- package/src/bedrock/nova-image-payload.ts +98 -91
- package/src/bedrock/payloads.ts +9 -9
- package/src/bedrock/s3.test.ts +39 -0
- package/src/bedrock/s3.ts +57 -38
- package/src/bedrock/streaming-tool-use.test.ts +86 -69
- package/src/bedrock/twelvelabs.ts +35 -32
- package/src/groq/index.ts +143 -60
- package/src/http-timeout-wiring.test.ts +263 -0
- package/src/huggingface_ie.ts +45 -61
- package/src/index.ts +15 -15
- package/src/mistral/index.ts +97 -48
- package/src/mistral/types.ts +13 -12
- package/src/openai/azure_openai.ts +35 -27
- package/src/openai/drivers.ts +9 -0
- package/src/openai/error-handling.test.ts +308 -113
- package/src/openai/index.ts +389 -254
- package/src/openai/openai.ts +6 -13
- package/src/openai/openai_compatible.ts +35 -25
- package/src/openai/openai_format.ts +90 -40
- package/src/replicate.ts +108 -86
- package/src/shared/claude-messages.test.ts +37 -0
- package/src/shared/claude-messages.ts +1085 -0
- package/src/shared/claude-thinking.ts +6 -12
- package/src/shared/debug-prompt.ts +28 -0
- package/src/test-driver/TestErrorCompletionStream.ts +9 -10
- package/src/test-driver/TestValidationErrorCompletionStream.ts +9 -10
- package/src/test-driver/index.ts +43 -27
- package/src/test-driver/utils.ts +8 -8
- package/src/togetherai/index.test.ts +32 -0
- package/src/togetherai/index.ts +64 -128
- package/src/togetherai/interfaces.ts +5 -5
- package/src/vertexai/debug.ts +3 -3
- package/src/vertexai/embeddings/embed-legacy-multimodal.ts +211 -0
- package/src/vertexai/embeddings/embed.ts +206 -0
- package/src/vertexai/embeddings/embeddings.test.ts +497 -0
- package/src/vertexai/embeddings/source-utils.test.ts +54 -0
- package/src/vertexai/embeddings/source-utils.ts +29 -0
- package/src/vertexai/index.ts +339 -253
- package/src/vertexai/models/claude-error-handling.test.ts +86 -39
- package/src/vertexai/models/claude-streaming-spacing.test.ts +82 -75
- package/src/vertexai/models/claude.ts +84 -1041
- package/src/vertexai/models/gemini-conversation-mutation.test.ts +65 -23
- package/src/vertexai/models/gemini-error-handling.test.ts +126 -10
- package/src/vertexai/models/gemini-orphaned-tool-result.test.ts +118 -0
- package/src/vertexai/models/gemini.ts +372 -182
- package/src/vertexai/models/imagen.ts +164 -100
- package/src/vertexai/models/llama.ts +70 -48
- package/src/vertexai/models.ts +36 -16
- package/src/watsonx/index.ts +101 -65
- package/src/watsonx/interfaces.ts +10 -15
- package/src/xai/index.ts +30 -30
- package/lib/cjs/adobe/firefly.js +0 -120
- package/lib/cjs/adobe/firefly.js.map +0 -1
- package/lib/cjs/azure/azure_foundry.js +0 -432
- package/lib/cjs/azure/azure_foundry.js.map +0 -1
- package/lib/cjs/bedrock/converse.js +0 -359
- package/lib/cjs/bedrock/converse.js.map +0 -1
- package/lib/cjs/bedrock/index.js +0 -1508
- package/lib/cjs/bedrock/index.js.map +0 -1
- package/lib/cjs/bedrock/nova-image-payload.js +0 -207
- package/lib/cjs/bedrock/nova-image-payload.js.map +0 -1
- package/lib/cjs/bedrock/payloads.js +0 -3
- package/lib/cjs/bedrock/s3.js +0 -107
- package/lib/cjs/bedrock/s3.js.map +0 -1
- package/lib/cjs/bedrock/twelvelabs.js +0 -87
- package/lib/cjs/bedrock/twelvelabs.js.map +0 -1
- package/lib/cjs/groq/index.js +0 -328
- package/lib/cjs/groq/index.js.map +0 -1
- package/lib/cjs/huggingface_ie.js +0 -201
- package/lib/cjs/huggingface_ie.js.map +0 -1
- package/lib/cjs/index.js +0 -31
- package/lib/cjs/index.js.map +0 -1
- package/lib/cjs/mistral/index.js +0 -176
- package/lib/cjs/mistral/index.js.map +0 -1
- package/lib/cjs/mistral/types.js +0 -83
- package/lib/cjs/mistral/types.js.map +0 -1
- package/lib/cjs/openai/azure_openai.js +0 -72
- package/lib/cjs/openai/azure_openai.js.map +0 -1
- package/lib/cjs/openai/index.js +0 -1129
- package/lib/cjs/openai/index.js.map +0 -1
- package/lib/cjs/openai/openai.js +0 -21
- package/lib/cjs/openai/openai.js.map +0 -1
- package/lib/cjs/openai/openai_compatible.js +0 -63
- package/lib/cjs/openai/openai_compatible.js.map +0 -1
- package/lib/cjs/openai/openai_format.js +0 -131
- package/lib/cjs/openai/openai_format.js.map +0 -1
- package/lib/cjs/package.json +0 -3
- package/lib/cjs/replicate.js +0 -275
- package/lib/cjs/replicate.js.map +0 -1
- package/lib/cjs/shared/claude-thinking.js +0 -60
- package/lib/cjs/shared/claude-thinking.js.map +0 -1
- package/lib/cjs/test-driver/TestErrorCompletionStream.js +0 -20
- package/lib/cjs/test-driver/TestErrorCompletionStream.js.map +0 -1
- package/lib/cjs/test-driver/TestValidationErrorCompletionStream.js +0 -24
- package/lib/cjs/test-driver/TestValidationErrorCompletionStream.js.map +0 -1
- package/lib/cjs/test-driver/index.js +0 -109
- package/lib/cjs/test-driver/index.js.map +0 -1
- package/lib/cjs/test-driver/utils.js +0 -30
- package/lib/cjs/test-driver/utils.js.map +0 -1
- package/lib/cjs/togetherai/index.js +0 -126
- package/lib/cjs/togetherai/index.js.map +0 -1
- package/lib/cjs/togetherai/interfaces.js +0 -3
- package/lib/cjs/togetherai/interfaces.js.map +0 -1
- package/lib/cjs/vertexai/debug.js +0 -12
- package/lib/cjs/vertexai/debug.js.map +0 -1
- package/lib/cjs/vertexai/embeddings/embeddings-image.js +0 -27
- package/lib/cjs/vertexai/embeddings/embeddings-image.js.map +0 -1
- package/lib/cjs/vertexai/embeddings/embeddings-text.js +0 -23
- package/lib/cjs/vertexai/embeddings/embeddings-text.js.map +0 -1
- package/lib/cjs/vertexai/index.js +0 -644
- package/lib/cjs/vertexai/index.js.map +0 -1
- package/lib/cjs/vertexai/models/claude.js +0 -917
- package/lib/cjs/vertexai/models/claude.js.map +0 -1
- package/lib/cjs/vertexai/models/gemini.js +0 -858
- package/lib/cjs/vertexai/models/gemini.js.map +0 -1
- package/lib/cjs/vertexai/models/imagen.js +0 -303
- package/lib/cjs/vertexai/models/imagen.js.map +0 -1
- package/lib/cjs/vertexai/models/llama.js +0 -183
- package/lib/cjs/vertexai/models/llama.js.map +0 -1
- package/lib/cjs/vertexai/models.js +0 -35
- package/lib/cjs/vertexai/models.js.map +0 -1
- package/lib/cjs/watsonx/index.js +0 -161
- package/lib/cjs/watsonx/index.js.map +0 -1
- package/lib/cjs/watsonx/interfaces.js +0 -3
- package/lib/cjs/xai/index.js +0 -65
- package/lib/cjs/xai/index.js.map +0 -1
- package/lib/esm/adobe/firefly.js +0 -116
- package/lib/esm/adobe/firefly.js.map +0 -1
- package/lib/esm/azure/azure_foundry.js.map +0 -1
- package/lib/esm/bedrock/converse.js.map +0 -1
- package/lib/esm/bedrock/index.js.map +0 -1
- package/lib/esm/bedrock/nova-image-payload.js.map +0 -1
- package/lib/esm/bedrock/payloads.js.map +0 -1
- package/lib/esm/bedrock/s3.js.map +0 -1
- package/lib/esm/bedrock/twelvelabs.js.map +0 -1
- package/lib/esm/groq/index.js.map +0 -1
- package/lib/esm/huggingface_ie.js.map +0 -1
- package/lib/esm/index.js +0 -15
- package/lib/esm/index.js.map +0 -1
- package/lib/esm/mistral/index.js.map +0 -1
- package/lib/esm/mistral/types.js.map +0 -1
- package/lib/esm/openai/azure_openai.js.map +0 -1
- package/lib/esm/openai/index.js.map +0 -1
- package/lib/esm/openai/openai.js +0 -14
- package/lib/esm/openai/openai.js.map +0 -1
- package/lib/esm/openai/openai_compatible.js.map +0 -1
- package/lib/esm/openai/openai_format.js.map +0 -1
- package/lib/esm/replicate.js.map +0 -1
- package/lib/esm/shared/claude-thinking.js.map +0 -1
- package/lib/esm/test-driver/TestErrorCompletionStream.js +0 -16
- package/lib/esm/test-driver/TestErrorCompletionStream.js.map +0 -1
- package/lib/esm/test-driver/TestValidationErrorCompletionStream.js.map +0 -1
- package/lib/esm/test-driver/index.js.map +0 -1
- package/lib/esm/test-driver/utils.js.map +0 -1
- package/lib/esm/togetherai/index.js +0 -122
- package/lib/esm/togetherai/index.js.map +0 -1
- package/lib/esm/togetherai/interfaces.js.map +0 -1
- package/lib/esm/vertexai/debug.js.map +0 -1
- package/lib/esm/vertexai/embeddings/embeddings-image.js +0 -24
- package/lib/esm/vertexai/embeddings/embeddings-image.js.map +0 -1
- package/lib/esm/vertexai/embeddings/embeddings-text.js +0 -20
- package/lib/esm/vertexai/embeddings/embeddings-text.js.map +0 -1
- package/lib/esm/vertexai/index.js.map +0 -1
- package/lib/esm/vertexai/models/claude.js +0 -906
- package/lib/esm/vertexai/models/claude.js.map +0 -1
- package/lib/esm/vertexai/models/gemini.js.map +0 -1
- package/lib/esm/vertexai/models/imagen.js.map +0 -1
- package/lib/esm/vertexai/models/llama.js.map +0 -1
- package/lib/esm/vertexai/models.js.map +0 -1
- package/lib/esm/watsonx/index.js.map +0 -1
- package/lib/esm/xai/index.js.map +0 -1
- package/lib/types/adobe/firefly.d.ts.map +0 -1
- package/lib/types/azure/azure_foundry.d.ts.map +0 -1
- package/lib/types/bedrock/converse.d.ts.map +0 -1
- package/lib/types/bedrock/index.d.ts.map +0 -1
- package/lib/types/bedrock/nova-image-payload.d.ts.map +0 -1
- package/lib/types/bedrock/payloads.d.ts.map +0 -1
- package/lib/types/bedrock/s3.d.ts.map +0 -1
- package/lib/types/bedrock/twelvelabs.d.ts.map +0 -1
- package/lib/types/groq/index.d.ts.map +0 -1
- package/lib/types/huggingface_ie.d.ts.map +0 -1
- package/lib/types/index.d.ts +0 -15
- package/lib/types/index.d.ts.map +0 -1
- package/lib/types/mistral/index.d.ts.map +0 -1
- package/lib/types/mistral/types.d.ts.map +0 -1
- package/lib/types/openai/azure_openai.d.ts.map +0 -1
- package/lib/types/openai/index.d.ts.map +0 -1
- package/lib/types/openai/openai.d.ts.map +0 -1
- package/lib/types/openai/openai_compatible.d.ts.map +0 -1
- package/lib/types/openai/openai_format.d.ts.map +0 -1
- package/lib/types/replicate.d.ts.map +0 -1
- package/lib/types/shared/claude-thinking.d.ts.map +0 -1
- package/lib/types/test-driver/TestErrorCompletionStream.d.ts.map +0 -1
- package/lib/types/test-driver/TestValidationErrorCompletionStream.d.ts.map +0 -1
- package/lib/types/test-driver/index.d.ts.map +0 -1
- package/lib/types/test-driver/utils.d.ts.map +0 -1
- package/lib/types/togetherai/index.d.ts +0 -23
- package/lib/types/togetherai/index.d.ts.map +0 -1
- package/lib/types/togetherai/interfaces.d.ts.map +0 -1
- package/lib/types/vertexai/debug.d.ts +0 -2
- package/lib/types/vertexai/debug.d.ts.map +0 -1
- package/lib/types/vertexai/embeddings/embeddings-image.d.ts +0 -11
- package/lib/types/vertexai/embeddings/embeddings-image.d.ts.map +0 -1
- package/lib/types/vertexai/embeddings/embeddings-text.d.ts +0 -10
- package/lib/types/vertexai/embeddings/embeddings-text.d.ts.map +0 -1
- package/lib/types/vertexai/index.d.ts.map +0 -1
- package/lib/types/vertexai/models/claude.d.ts +0 -119
- package/lib/types/vertexai/models/claude.d.ts.map +0 -1
- package/lib/types/vertexai/models/gemini.d.ts.map +0 -1
- package/lib/types/vertexai/models/imagen.d.ts.map +0 -1
- package/lib/types/vertexai/models/llama.d.ts.map +0 -1
- package/lib/types/vertexai/models.d.ts +0 -20
- package/lib/types/vertexai/models.d.ts.map +0 -1
- package/lib/types/watsonx/index.d.ts.map +0 -1
- package/lib/types/watsonx/interfaces.d.ts.map +0 -1
- package/lib/types/xai/index.d.ts.map +0 -1
- package/src/vertexai/embeddings/embeddings-image.ts +0 -52
- package/src/vertexai/embeddings/embeddings-text.ts +0 -54
- /package/lib/{esm/bedrock → bedrock}/payloads.js +0 -0
- /package/lib/{esm/mistral → mistral}/types.js +0 -0
- /package/lib/{esm/togetherai → togetherai}/interfaces.js +0 -0
- /package/lib/{types/watsonx → watsonx}/interfaces.d.ts +0 -0
- /package/lib/{esm/watsonx → watsonx}/interfaces.js +0 -0
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
import type { OutputConfig, ThinkingConfigParam } from
|
|
2
|
-
import {
|
|
3
|
-
hasSamplingParameterRestriction,
|
|
4
|
-
isClaudeVersionGTE,
|
|
5
|
-
supportsAdaptiveThinking,
|
|
6
|
-
} from "@llumiverse/core";
|
|
1
|
+
import type { OutputConfig, ThinkingConfigParam } from '@anthropic-ai/sdk/resources/messages.js';
|
|
2
|
+
import { hasSamplingParameterRestriction, isClaudeVersionGTE, supportsAdaptiveThinking } from '@llumiverse/core';
|
|
7
3
|
|
|
8
4
|
/**
|
|
9
5
|
* Common Claude model options relevant to thinking/effort configuration.
|
|
@@ -59,25 +55,23 @@ export function resolveClaudeThinking(model: string, options?: ClaudeThinkingInp
|
|
|
59
55
|
// Explicit budget — use extended thinking regardless of adaptive support.
|
|
60
56
|
// On adaptive models this uses the deprecated path, but user input takes priority.
|
|
61
57
|
thinking = {
|
|
62
|
-
type:
|
|
58
|
+
type: 'enabled' as const,
|
|
63
59
|
budget_tokens: budgetTokens,
|
|
64
60
|
};
|
|
65
61
|
} else if (supportsAdaptive) {
|
|
66
62
|
// Adaptive models: enable when effort is set, omit otherwise (thinking is OFF by default).
|
|
67
63
|
// display controls whether thinking blocks are returned; defaults to omitted.
|
|
68
64
|
thinking = adaptiveEnabled
|
|
69
|
-
? { type:
|
|
65
|
+
? { type: 'adaptive' as const, display: options?.include_thoughts ? 'summarized' : 'omitted' }
|
|
70
66
|
: undefined;
|
|
71
67
|
} else {
|
|
72
68
|
// Older thinking models (3.7, 4.5): no adaptive support, thinking is always disabled
|
|
73
69
|
// unless an explicit budget is provided (handled above).
|
|
74
|
-
thinking = { type:
|
|
70
|
+
thinking = { type: 'disabled' as const };
|
|
75
71
|
}
|
|
76
72
|
|
|
77
73
|
// Output config for effort parameter (Opus 4.5+, Sonnet 4.6+, all 4.7+)
|
|
78
|
-
const outputConfig: OutputConfig | undefined = options?.effort
|
|
79
|
-
? { effort: options.effort }
|
|
80
|
-
: undefined;
|
|
74
|
+
const outputConfig: OutputConfig | undefined = options?.effort ? { effort: options.effort } : undefined;
|
|
81
75
|
|
|
82
76
|
return {
|
|
83
77
|
thinking,
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export const BINARY_TRUNCATED_MARKER = '...[truncated binary]...';
|
|
2
|
+
|
|
3
|
+
const BINARY_DEBUG_EDGE_CHARS = 10;
|
|
4
|
+
|
|
5
|
+
export function truncateBinaryForDebug(value: string): string {
|
|
6
|
+
if (value.length <= BINARY_DEBUG_EDGE_CHARS * 2 + BINARY_TRUNCATED_MARKER.length) {
|
|
7
|
+
return value;
|
|
8
|
+
}
|
|
9
|
+
return `${value.slice(0, BINARY_DEBUG_EDGE_CHARS)}${BINARY_TRUNCATED_MARKER}${value.slice(-BINARY_DEBUG_EDGE_CHARS)}`;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function truncateDataUrlForDebug(value: string): string {
|
|
13
|
+
const base64Marker = ';base64,';
|
|
14
|
+
const markerIndex = value.indexOf(base64Marker);
|
|
15
|
+
if (!value.startsWith('data:') || markerIndex === -1) {
|
|
16
|
+
return value;
|
|
17
|
+
}
|
|
18
|
+
const payloadStart = markerIndex + base64Marker.length;
|
|
19
|
+
return value.slice(0, payloadStart) + truncateBinaryForDebug(value.slice(payloadStart));
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export function uint8ArrayToBase64ForDebug(bytes: Uint8Array): string {
|
|
23
|
+
let binary = '';
|
|
24
|
+
for (let i = 0; i < bytes.byteLength; i++) {
|
|
25
|
+
binary += String.fromCharCode(bytes[i]);
|
|
26
|
+
}
|
|
27
|
+
return btoa(binary);
|
|
28
|
+
}
|
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
import { CompletionStream, ExecutionOptions, ExecutionResponse, PromptSegment } from
|
|
2
|
-
import { sleep, throwError } from
|
|
1
|
+
import type { CompletionStream, ExecutionOptions, ExecutionResponse, PromptSegment } from '@llumiverse/core';
|
|
2
|
+
import { sleep, throwError } from './utils.js';
|
|
3
3
|
|
|
4
4
|
export class TestErrorCompletionStream implements CompletionStream<PromptSegment[]> {
|
|
5
|
-
|
|
6
5
|
completion: ExecutionResponse<PromptSegment[]> | undefined;
|
|
7
6
|
|
|
8
|
-
constructor(
|
|
9
|
-
public
|
|
10
|
-
|
|
7
|
+
constructor(
|
|
8
|
+
public segments: PromptSegment[],
|
|
9
|
+
public options: ExecutionOptions,
|
|
10
|
+
) {}
|
|
11
11
|
async *[Symbol.asyncIterator]() {
|
|
12
|
-
yield
|
|
13
|
-
sleep(1000);
|
|
14
|
-
throwError(
|
|
12
|
+
yield 'Started TestError. Next we will thrown an error.\n';
|
|
13
|
+
await sleep(1000);
|
|
14
|
+
throwError('Testing stream completion error.', this.segments);
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
|
-
|
|
@@ -1,20 +1,19 @@
|
|
|
1
|
-
import { CompletionStream, ExecutionOptions, ExecutionResponse, PromptSegment } from
|
|
2
|
-
import { createValidationErrorCompletion, sleep } from
|
|
3
|
-
|
|
1
|
+
import type { CompletionStream, ExecutionOptions, ExecutionResponse, PromptSegment } from '@llumiverse/core';
|
|
2
|
+
import { createValidationErrorCompletion, sleep } from './utils.js';
|
|
4
3
|
|
|
5
4
|
export class TestValidationErrorCompletionStream implements CompletionStream<PromptSegment[]> {
|
|
6
|
-
|
|
7
5
|
completion: ExecutionResponse<PromptSegment[]> | undefined;
|
|
8
6
|
|
|
9
|
-
constructor(
|
|
10
|
-
public
|
|
11
|
-
|
|
7
|
+
constructor(
|
|
8
|
+
public segments: PromptSegment[],
|
|
9
|
+
public options: ExecutionOptions,
|
|
10
|
+
) {}
|
|
12
11
|
async *[Symbol.asyncIterator]() {
|
|
13
|
-
yield
|
|
12
|
+
yield 'Started TestValidationError.\n';
|
|
14
13
|
await sleep(1000);
|
|
15
|
-
yield
|
|
14
|
+
yield 'chunk1\n';
|
|
16
15
|
await sleep(1000);
|
|
17
|
-
yield
|
|
16
|
+
yield 'chunk2\n';
|
|
18
17
|
await sleep(1000);
|
|
19
18
|
this.completion = createValidationErrorCompletion(this.segments);
|
|
20
19
|
}
|
package/src/test-driver/index.ts
CHANGED
|
@@ -1,39 +1,50 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import {
|
|
2
|
+
type AIModel,
|
|
3
|
+
AIModelStatus,
|
|
4
|
+
type CompletionStream,
|
|
5
|
+
type Driver,
|
|
6
|
+
type EmbeddingsResult,
|
|
7
|
+
type ExecutionOptions,
|
|
8
|
+
type ExecutionResponse,
|
|
9
|
+
ModelType,
|
|
10
|
+
type PromptSegment,
|
|
11
|
+
type TrainingJob,
|
|
12
|
+
} from '@llumiverse/core';
|
|
13
|
+
import { TestErrorCompletionStream } from './TestErrorCompletionStream.js';
|
|
14
|
+
import { TestValidationErrorCompletionStream } from './TestValidationErrorCompletionStream.js';
|
|
15
|
+
import { createValidationErrorCompletion, sleep, throwError } from './utils.js';
|
|
5
16
|
|
|
6
|
-
export * from
|
|
7
|
-
export * from
|
|
17
|
+
export * from './TestErrorCompletionStream.js';
|
|
18
|
+
export * from './TestValidationErrorCompletionStream.js';
|
|
8
19
|
|
|
9
20
|
export enum TestDriverModels {
|
|
10
|
-
executionError =
|
|
11
|
-
validationError =
|
|
21
|
+
executionError = 'execution-error',
|
|
22
|
+
validationError = 'validation-error',
|
|
12
23
|
}
|
|
13
24
|
|
|
14
25
|
export class TestDriver implements Driver<PromptSegment[]> {
|
|
15
|
-
provider =
|
|
26
|
+
provider = 'test';
|
|
16
27
|
|
|
17
28
|
createTrainingPrompt(): Promise<string> {
|
|
18
|
-
throw new Error(
|
|
29
|
+
throw new Error('Method not implemented.');
|
|
19
30
|
}
|
|
20
31
|
|
|
21
32
|
startTraining(): Promise<TrainingJob> {
|
|
22
|
-
throw new Error(
|
|
33
|
+
throw new Error('Method not implemented.');
|
|
23
34
|
}
|
|
24
35
|
|
|
25
36
|
cancelTraining(): Promise<TrainingJob> {
|
|
26
|
-
throw new Error(
|
|
37
|
+
throw new Error('Method not implemented.');
|
|
27
38
|
}
|
|
28
39
|
|
|
29
40
|
getTrainingJob(_jobId: string): Promise<TrainingJob> {
|
|
30
|
-
throw new Error(
|
|
41
|
+
throw new Error('Method not implemented.');
|
|
31
42
|
}
|
|
32
43
|
|
|
33
44
|
async createPrompt(segments: PromptSegment[], _opts: ExecutionOptions): Promise<PromptSegment[]> {
|
|
34
45
|
return segments;
|
|
35
46
|
}
|
|
36
|
-
|
|
47
|
+
|
|
37
48
|
execute(segments: PromptSegment[], options: ExecutionOptions): Promise<ExecutionResponse<PromptSegment[]>> {
|
|
38
49
|
switch (options.model) {
|
|
39
50
|
case TestDriverModels.executionError:
|
|
@@ -41,7 +52,7 @@ export class TestDriver implements Driver<PromptSegment[]> {
|
|
|
41
52
|
case TestDriverModels.validationError:
|
|
42
53
|
return this.executeValidationError(segments, options);
|
|
43
54
|
default:
|
|
44
|
-
throwError(
|
|
55
|
+
throwError(`[test driver] Unknown model: ${options.model}`, segments);
|
|
45
56
|
}
|
|
46
57
|
}
|
|
47
58
|
async stream(segments: PromptSegment[], options: ExecutionOptions): Promise<CompletionStream<PromptSegment[]>> {
|
|
@@ -51,7 +62,7 @@ export class TestDriver implements Driver<PromptSegment[]> {
|
|
|
51
62
|
case TestDriverModels.validationError:
|
|
52
63
|
return new TestValidationErrorCompletionStream(segments, options);
|
|
53
64
|
default:
|
|
54
|
-
throwError(
|
|
65
|
+
throwError(`[test driver] Unknown model: ${options.model}`, segments);
|
|
55
66
|
}
|
|
56
67
|
}
|
|
57
68
|
|
|
@@ -63,40 +74,45 @@ export class TestDriver implements Driver<PromptSegment[]> {
|
|
|
63
74
|
return [
|
|
64
75
|
{
|
|
65
76
|
id: TestDriverModels.executionError,
|
|
66
|
-
name:
|
|
77
|
+
name: 'Execution Error',
|
|
67
78
|
type: ModelType.Test,
|
|
68
79
|
provider: this.provider,
|
|
69
80
|
status: AIModelStatus.Available,
|
|
70
|
-
description:
|
|
81
|
+
description: 'Test execution errors',
|
|
71
82
|
tags: [],
|
|
72
83
|
},
|
|
73
84
|
{
|
|
74
85
|
id: TestDriverModels.validationError,
|
|
75
|
-
name:
|
|
86
|
+
name: 'Validation Error',
|
|
76
87
|
type: ModelType.Test,
|
|
77
88
|
provider: this.provider,
|
|
78
89
|
status: AIModelStatus.Available,
|
|
79
|
-
description:
|
|
90
|
+
description: 'Test validation errors',
|
|
80
91
|
tags: [],
|
|
81
92
|
},
|
|
82
|
-
]
|
|
93
|
+
];
|
|
83
94
|
}
|
|
84
95
|
validateConnection(): Promise<boolean> {
|
|
85
|
-
throw new Error(
|
|
96
|
+
throw new Error('Method not implemented.');
|
|
86
97
|
}
|
|
87
98
|
generateEmbeddings(): Promise<EmbeddingsResult> {
|
|
88
|
-
throw new Error(
|
|
99
|
+
throw new Error('Method not implemented.');
|
|
89
100
|
}
|
|
90
101
|
|
|
91
102
|
// ============== execution error ==================
|
|
92
|
-
async executeError(
|
|
103
|
+
async executeError(
|
|
104
|
+
segments: PromptSegment[],
|
|
105
|
+
_options: ExecutionOptions,
|
|
106
|
+
): Promise<ExecutionResponse<PromptSegment[]>> {
|
|
93
107
|
await sleep(1000);
|
|
94
|
-
throwError(
|
|
108
|
+
throwError('Testing stream completion error.', segments);
|
|
95
109
|
}
|
|
96
110
|
// ============== validation error ==================
|
|
97
|
-
async executeValidationError(
|
|
111
|
+
async executeValidationError(
|
|
112
|
+
segments: PromptSegment[],
|
|
113
|
+
_options: ExecutionOptions,
|
|
114
|
+
): Promise<ExecutionResponse<PromptSegment[]>> {
|
|
98
115
|
await sleep(3000);
|
|
99
116
|
return createValidationErrorCompletion(segments);
|
|
100
117
|
}
|
|
101
|
-
|
|
102
118
|
}
|
package/src/test-driver/utils.ts
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { ExecutionResponse, PromptSegment } from
|
|
1
|
+
import type { ExecutionResponse, PromptSegment } from '@llumiverse/core';
|
|
2
2
|
|
|
3
3
|
export function throwError(message: string, prompt: PromptSegment[]): never {
|
|
4
|
-
const err = new Error(message);
|
|
5
|
-
|
|
4
|
+
const err = new Error(message) as Error & { prompt?: PromptSegment[] };
|
|
5
|
+
err.prompt = prompt;
|
|
6
6
|
throw err;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
export function createValidationErrorCompletion(segments: PromptSegment[]) {
|
|
10
10
|
return {
|
|
11
|
-
result: [{ type:
|
|
11
|
+
result: [{ type: 'text', value: 'An invalid result' }],
|
|
12
12
|
prompt: segments,
|
|
13
13
|
execution_time: 3000,
|
|
14
14
|
error: {
|
|
15
|
-
code:
|
|
16
|
-
message:
|
|
15
|
+
code: 'validation_error',
|
|
16
|
+
message: 'Result cannot be validated!',
|
|
17
17
|
},
|
|
18
18
|
token_usage: {
|
|
19
19
|
result: 10,
|
|
@@ -24,5 +24,5 @@ export function createValidationErrorCompletion(segments: PromptSegment[]) {
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
export function sleep(ms: number) {
|
|
27
|
-
return new Promise(resolve => setTimeout(resolve, ms));
|
|
28
|
-
}
|
|
27
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
28
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { ModelType, Providers } from '@llumiverse/core';
|
|
2
|
+
import { describe, expect, it, vi } from 'vitest';
|
|
3
|
+
import { TogetherAIDriver } from './index.js';
|
|
4
|
+
|
|
5
|
+
describe('TogetherAIDriver', () => {
|
|
6
|
+
it('maps Together array-shaped model catalog responses', async () => {
|
|
7
|
+
const driver = new TogetherAIDriver({ apiKey: 'test-key' });
|
|
8
|
+
const get = vi.fn(async () => [
|
|
9
|
+
{
|
|
10
|
+
id: 'Qwen/Qwen3.5-9B',
|
|
11
|
+
display_name: 'Qwen3.5 9B',
|
|
12
|
+
organization: 'Qwen',
|
|
13
|
+
type: 'chat',
|
|
14
|
+
},
|
|
15
|
+
]);
|
|
16
|
+
driver.service = { get } as unknown as TogetherAIDriver['service'];
|
|
17
|
+
|
|
18
|
+
const models = await driver.listModels();
|
|
19
|
+
|
|
20
|
+
expect(get).toHaveBeenCalledWith('/models');
|
|
21
|
+
expect(models).toEqual([
|
|
22
|
+
expect.objectContaining({
|
|
23
|
+
id: 'Qwen/Qwen3.5-9B',
|
|
24
|
+
name: 'Qwen3.5 9B',
|
|
25
|
+
owner: 'Qwen',
|
|
26
|
+
provider: Providers.togetherai,
|
|
27
|
+
type: ModelType.Chat,
|
|
28
|
+
tool_support: true,
|
|
29
|
+
}),
|
|
30
|
+
]);
|
|
31
|
+
});
|
|
32
|
+
});
|
package/src/togetherai/index.ts
CHANGED
|
@@ -1,142 +1,78 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import {
|
|
2
|
+
type AIModel,
|
|
3
|
+
type DriverOptions,
|
|
4
|
+
getModelCapabilities,
|
|
5
|
+
ModelType,
|
|
6
|
+
modelModalitiesToArray,
|
|
7
|
+
Providers,
|
|
8
|
+
} from '@llumiverse/core';
|
|
9
|
+
import OpenAI from 'openai';
|
|
10
|
+
import { BaseOpenAIDriver } from '../openai/index.js';
|
|
11
|
+
|
|
12
|
+
export interface TogetherAIDriverOptions extends DriverOptions {
|
|
7
13
|
apiKey: string;
|
|
14
|
+
endpoint?: string;
|
|
8
15
|
}
|
|
9
16
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
constructor(options: TogetherAIDriverOptions) {
|
|
17
|
-
super(options);
|
|
18
|
-
this.apiKey = options.apiKey;
|
|
19
|
-
this.fetchClient = new FetchClient('https://api.together.xyz').withHeaders({
|
|
20
|
-
authorization: `Bearer ${this.apiKey}`
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
getResponseFormat = (options: ExecutionOptions): { type: string; schema: any } | undefined => {
|
|
25
|
-
return options.result_schema ?
|
|
26
|
-
{
|
|
27
|
-
type: "json_object",
|
|
28
|
-
schema: options.result_schema
|
|
29
|
-
} : undefined;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
async requestTextCompletion(prompt: string, options: ExecutionOptions): Promise<Completion> {
|
|
33
|
-
if (options.model_options?._option_id !== undefined && options.model_options?._option_id !== "text-fallback") {
|
|
34
|
-
this.logger.debug({ options: options.model_options }, "Unexpected option id");
|
|
35
|
-
}
|
|
36
|
-
options.model_options = options.model_options as TextFallbackOptions;
|
|
17
|
+
interface TogetherModel {
|
|
18
|
+
id: string;
|
|
19
|
+
display_name?: string;
|
|
20
|
+
organization?: string;
|
|
21
|
+
type?: string;
|
|
22
|
+
}
|
|
37
23
|
|
|
38
|
-
|
|
24
|
+
export class TogetherAIDriver extends BaseOpenAIDriver {
|
|
25
|
+
static readonly PROVIDER = Providers.togetherai;
|
|
26
|
+
readonly provider = Providers.togetherai;
|
|
27
|
+
service: OpenAI;
|
|
39
28
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
model: options.model,
|
|
43
|
-
prompt: prompt,
|
|
44
|
-
response_format: this.getResponseFormat(options),
|
|
45
|
-
max_tokens: options.model_options?.max_tokens,
|
|
46
|
-
temperature: options.model_options?.temperature,
|
|
47
|
-
top_p: options.model_options?.top_p,
|
|
48
|
-
top_k: options.model_options?.top_k,
|
|
49
|
-
//logprobs: options.top_logprobs, //Logprobs output currently not supported
|
|
50
|
-
frequency_penalty: options.model_options?.frequency_penalty,
|
|
51
|
-
presence_penalty: options.model_options?.presence_penalty,
|
|
52
|
-
stop: [
|
|
53
|
-
"</s>",
|
|
54
|
-
"[/INST]",
|
|
55
|
-
...stop_seq,
|
|
56
|
-
],
|
|
57
|
-
}
|
|
58
|
-
}) as TextCompletion;
|
|
59
|
-
const choice = res.choices[0];
|
|
60
|
-
const text = choice.text ?? '';
|
|
61
|
-
const usage = res.usage || {};
|
|
62
|
-
return {
|
|
63
|
-
result: [{ type: "text", value: text }],
|
|
64
|
-
token_usage: {
|
|
65
|
-
prompt: usage.prompt_tokens,
|
|
66
|
-
result: usage.completion_tokens,
|
|
67
|
-
total: usage.total_tokens,
|
|
68
|
-
},
|
|
69
|
-
finish_reason: choice.finish_reason, //Uses expected "stop" , "length" format
|
|
70
|
-
original_response: options.include_original_response ? res : undefined,
|
|
71
|
-
}
|
|
72
|
-
}
|
|
29
|
+
constructor(opts: TogetherAIDriverOptions) {
|
|
30
|
+
super(opts);
|
|
73
31
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
this.logger.debug({ options: options.model_options }, "Unexpected option id");
|
|
32
|
+
if (!opts.apiKey) {
|
|
33
|
+
throw new Error('apiKey is required');
|
|
77
34
|
}
|
|
78
|
-
options.model_options = options.model_options as TextFallbackOptions;
|
|
79
|
-
|
|
80
|
-
const stop_seq = options.model_options?.stop_sequence ?? [];
|
|
81
|
-
const stream = await this.fetchClient.post('/v1/completions', {
|
|
82
|
-
payload: {
|
|
83
|
-
model: options.model,
|
|
84
|
-
prompt: prompt,
|
|
85
|
-
max_tokens: options.model_options?.max_tokens,
|
|
86
|
-
temperature: options.model_options?.temperature,
|
|
87
|
-
response_format: this.getResponseFormat(options),
|
|
88
|
-
top_p: options.model_options?.top_p,
|
|
89
|
-
top_k: options.model_options?.top_k,
|
|
90
|
-
//logprobs: options.top_logprobs, //Logprobs output currently not supported
|
|
91
|
-
frequency_penalty: options.model_options?.frequency_penalty,
|
|
92
|
-
presence_penalty: options.model_options?.presence_penalty,
|
|
93
|
-
stream: true,
|
|
94
|
-
stop: [
|
|
95
|
-
"</s>",
|
|
96
|
-
"[/INST]",
|
|
97
|
-
...stop_seq,
|
|
98
|
-
],
|
|
99
|
-
},
|
|
100
|
-
reader: 'sse'
|
|
101
|
-
})
|
|
102
35
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
finish_reason: json.choices[0]?.finish_reason, //Uses expected "stop" , "length" format
|
|
108
|
-
token_usage: {
|
|
109
|
-
prompt: json.usage?.prompt_tokens,
|
|
110
|
-
result: json.usage?.completion_tokens,
|
|
111
|
-
total: json.usage?.prompt_tokens + json.usage?.completion_tokens,
|
|
112
|
-
}
|
|
113
|
-
};
|
|
36
|
+
this.service = new OpenAI({
|
|
37
|
+
apiKey: opts.apiKey,
|
|
38
|
+
baseURL: opts.endpoint ?? 'https://api.together.ai/v1',
|
|
39
|
+
fetch: this.getDriverFetch(),
|
|
114
40
|
});
|
|
115
|
-
|
|
116
41
|
}
|
|
117
42
|
|
|
118
|
-
async listModels(): Promise<AIModel
|
|
119
|
-
const
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
43
|
+
async listModels(): Promise<AIModel[]> {
|
|
44
|
+
const result = await this.service.get<TogetherModel[]>('/models');
|
|
45
|
+
return result
|
|
46
|
+
.map((model) => {
|
|
47
|
+
const modelCapability = getModelCapabilities(model.id, this.provider);
|
|
48
|
+
return {
|
|
49
|
+
id: model.id,
|
|
50
|
+
name: model.display_name ?? model.id,
|
|
51
|
+
provider: this.provider,
|
|
52
|
+
owner: model.organization,
|
|
53
|
+
type: togetherModelType(model.type),
|
|
54
|
+
can_stream: true,
|
|
55
|
+
is_multimodal: modelCapability.input.image === true,
|
|
56
|
+
input_modalities: modelModalitiesToArray(modelCapability.input),
|
|
57
|
+
output_modalities: modelModalitiesToArray(modelCapability.output),
|
|
58
|
+
tool_support: modelCapability.tool_support,
|
|
59
|
+
} satisfies AIModel<string>;
|
|
60
|
+
})
|
|
61
|
+
.sort((a, b) => a.id.localeCompare(b.id));
|
|
133
62
|
}
|
|
63
|
+
}
|
|
134
64
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
65
|
+
function togetherModelType(type?: string): ModelType {
|
|
66
|
+
switch (type) {
|
|
67
|
+
case 'chat':
|
|
68
|
+
return ModelType.Chat;
|
|
69
|
+
case 'code':
|
|
70
|
+
return ModelType.Code;
|
|
71
|
+
case 'image':
|
|
72
|
+
return ModelType.Image;
|
|
73
|
+
case 'embedding':
|
|
74
|
+
return ModelType.Embedding;
|
|
75
|
+
default:
|
|
76
|
+
return ModelType.Text;
|
|
140
77
|
}
|
|
141
|
-
|
|
142
|
-
}
|
|
78
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
interface ModelInstanceConfig {
|
|
2
|
-
appearsIn:
|
|
2
|
+
appearsIn: unknown[];
|
|
3
3
|
order: number;
|
|
4
4
|
}
|
|
5
5
|
|
|
@@ -90,15 +90,15 @@ export interface TogetherModelInfo {
|
|
|
90
90
|
export interface TextCompletion {
|
|
91
91
|
id: string;
|
|
92
92
|
choices: {
|
|
93
|
-
text: string
|
|
94
|
-
finish_reason: string
|
|
93
|
+
text: string;
|
|
94
|
+
finish_reason: string; // stop | length ?
|
|
95
95
|
}[];
|
|
96
96
|
usage: {
|
|
97
97
|
prompt_tokens: number;
|
|
98
98
|
completion_tokens: number;
|
|
99
99
|
total_tokens: number;
|
|
100
|
-
}
|
|
100
|
+
};
|
|
101
101
|
created: number;
|
|
102
102
|
model: string;
|
|
103
103
|
object: string;
|
|
104
|
-
}
|
|
104
|
+
}
|
package/src/vertexai/debug.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import util from 'util';
|
|
1
|
+
import util from 'node:util';
|
|
2
2
|
|
|
3
|
-
export function logObject(prefix: string, obj:
|
|
3
|
+
export function logObject(prefix: string, obj: unknown) {
|
|
4
4
|
const fullObj = util.inspect(obj, { showHidden: false, depth: null, colors: true });
|
|
5
|
-
console.log(prefix, fullObj)
|
|
5
|
+
console.log(prefix, fullObj);
|
|
6
6
|
}
|