gateway
gateway copied to clipboard
feat: multimodal embeddings for bedrock titan and cohere
trafficstars
This PR adds support for multimodal embeddings in compliance with the portkey signature:
example requests:
- Titan text embedding:
curl --location 'http://localhost:8787/v1/embeddings' \
--header 'x-portkey-provider: bedrock' \
--header 'Content-Type: application/json' \
--header 'x-portkey-aws-access-key-id: ID' \
--header 'x-portkey-aws-secret-access-key: KEY' \
--header 'x-portkey-aws-region: us-east-1' \
--data '{
"model": "amazon.titan-embed-text-v2:0",
"input": "Hello this is a test",
"normalize": false
}'
- Titan image embedding:
curl --location 'http://localhost:8787/v1/embeddings' \
--header 'x-portkey-provider: bedrock' \
--header 'Content-Type: application/json' \
--header 'x-portkey-aws-access-key-id: ID' \
--header 'x-portkey-aws-secret-access-key: KEY' \
--header 'x-portkey-aws-region: us-east-1' \
--data '{
"model": "amazon.titan-embed-image-v1",
"dimensions": 256,
"input": [
{
"text": "this is the caption of the image",
"image": {
"base64": "UklGRkac....."
}
}
]
}'
- Cohere text embedding:
curl --location 'http://localhost:8787/v1/embeddings' \
--header 'x-portkey-provider: bedrock' \
--header 'Content-Type: application/json' \
--header 'x-portkey-aws-access-key-id: ID' \
--header 'x-portkey-aws-secret-access-key: KEY' \
--header 'x-portkey-aws-region: us-east-1' \
--data '{
"model": "cohere.embed-english-v3",
"input": ["Hello this is a test", "skibidi"],
"input_type": "classification"
}'
- Cohere Multimodal embedding:
curl --location 'http://localhost:8787/v1/embeddings' \
--header 'x-portkey-provider: bedrock' \
--header 'Content-Type: application/json' \
--header 'x-portkey-aws-access-key-id: ID' \
--header 'x-portkey-aws-secret-access-key: KEY' \
--header 'x-portkey-aws-region: us-east-1' \
--data '{
"model": "cohere.embed-english-v3",
"input_type": "image",
"dimensions": 256,
"input": [
{
"image": {
"base64": "UklGRkac....."
}
}
]
}'