Embeddings done by Bedrock-Cohere are not working properly (at least in us-east-1)

0

Hello,

I know that Cohere (through Bedrock) has a limit of 512 tokens (also known as 2048 characters) in the Bedrock API.

But when I try to create embeddings I got this error: Input is too long for requested model even when the "texts" field has less than 900 characters. This is the failing node:

{"texts": ["page_label: 2\ngenai_document_id: a57d2b98-1d1d-4e71-a151-792aca2921d4\ngenai_tenant_id: 5853\ngenai_created_date_utc: 2024-05-09T16:50:45.000Z\ngenai_key1: value 1\ngenai_key2: value 2\ngenai_application: CE\ngenai_entitytype: Program\ngenai_entityid: 51137\ngenai_llmmodel: anthropic.claude-3-haiku-20240307-v1:0\ngenai_embeddingmodel: cohere.embed-english-v3\ngenai_embeddingdimension: 1024\n\nIT Change Management \nUTRGV 2 \n \nTable of Contents \nIntroduction ............................................................................................................................................................. 3 \nDefining Change .................................................................................................................................................... 3 \nRoles and Responsibilities .............."], "input_type": "search_document", "truncate": "NONE"}

If I remove some characters from "texts" it works without issues.

Any advice?

(NOTE: I am using cohere.embed-english-v3 and I have access to the model).

UPDATE: I have finally found the issue.

This is caused by the TRUNCATE option being set to 'NONE'. If I remove this parameter, it works as expected. However, this doesn't make sense because 'NONE' is supposed to be the default value, so removing the parameter should not make any difference.

Please, Bedrock team, fix this bug.

  • I have finally found the issue.

    This is caused by the TRUNCATE option being set to 'NONE'. If I remove this parameter, it works as expected. However, this doesn't make sense because 'NONE' is supposed to be the default value, so removing the parameter should not make any difference.

    Please, Bedrock team, fix this bug.

asked 20 days ago377 views
No Answers

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions