Skip to content

Cohere embeddings models do not work in @ai-sdk/amazon-bedrock #5055

Open
@apalchys

Description

@apalchys

Description

According to the type definitions, @ai-sdk/amazon-bedrock supports Cohere embedding models

| 'cohere.embed-english-v3'
| 'cohere.embed-multilingual-v3'

In practice, Cohere models require a different request format than Amazon Titan models (here), causing the provider to fail with an error when attempting to use them.

Malformed input request: #: required key [images] not found#: required key [texts] not found#: required key [texts] not found#: required key [texts] not found#: required key [texts] not found#: required key [input_type] not found#: extraneous key [inputText] is not permitted, please reformat your input and try again.

Code example

import { createAmazonBedrock, bedrock } from '@ai-sdk/amazon-bedrock';
import { embedMany } from 'ai';

...
const response = await embedMany({
    model: bedrock.textEmbeddingModel('cohere.embed-english-v3'),
    values: ['foo', 'bar'],
})

AI provider

@ai-sdk/amazon-bedrock v2.0.5

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions