Skip to content

feat: multimodal embeddings for bedrock titan and cohere #1130

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

narengogi
Copy link
Collaborator

This PR adds support for multimodal embeddings in compliance with the portkey signature:

example requests:

  1. 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
}'
  1. 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....."
            }
        }
    ]
}'
  1. 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"
}'
  1. 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....."
            }
        }
    ]
}'

@narengogi narengogi requested review from VisargD and sk-portkey June 10, 2025 12:15
Copy link

@matter-code-review matter-code-review bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR adds multimodal embedding support for Bedrock Titan and Cohere providers, allowing both text and image inputs. The implementation is well-structured, but I've identified a few improvements that could enhance error handling and type safety.

@Portkey-AI Portkey-AI deleted a comment from matter-code-review bot Jun 10, 2025
@Portkey-AI Portkey-AI deleted a comment from matter-code-review bot Jun 10, 2025
Copy link

Important

PR Review Skipped

PR review skipped as per the configuration setting. Run a manually review by commenting /matter review

💡Tips to use Matter AI

Command List

  • /matter summary: Generate AI Summary for the PR
  • /matter review: Generate AI Reviews for the latest commit in the PR
  • /matter review-full: Generate AI Reviews for the complete PR
  • /matter release-notes: Generate AI release-notes for the PR
  • /matter : Chat with your PR with Matter AI Agent
  • /matter remember : Generate AI memories for the PR
  • /matter explain: Get an explanation of the PR
  • /matter help: Show the list of available commands and documentation
  • Need help? Join our Discord server: https://discord.gg/fJU5DvanU3

input_type: {
param: 'input_type',
required: false,
},
embedding_types: {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we keep the support for embedding_types param as well for now? Don't want this to become a breaking change for anyone. We can do another release which removes it along with a notice

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants