spring-projects / spring-ai

An Application Framework for AI Engineering
https://docs.spring.io/spring-ai/reference/index.html
Apache License 2.0
3.35k stars 866 forks source link

Bedrock Titan Embeddings - Malformed input request / 2 validation errors #788

Closed kennyk65 closed 2 months ago

kennyk65 commented 6 months ago

Bug description I'm experimenting with embeddings and encountered this error when using Bedrock / Titan embedding models: software.amazon.awssdk.services.bedrockruntime.model.ValidationException: Malformed input request: 2 schema violations found, please reformat your input and try again. (Service: BedrockRuntime, Status Code: 400, Request ID: 062cc802-99ce-4d2f-99e2-ea9102c091f3)"

I don't get this error when using embeddings with OpenAI or anything else, so it seems to be Bedrock / Titan specific. Sorry I don't have more information - I'm just experimenting and wanted to pass this info on.

Environment Spring AI version 1.0.0-M1, Java 1.21, no vector store. AWS account with the Titan models enabled.

Steps to reproduce I followed the steps in the documentation here (https://docs.spring.io/spring-ai/reference/api/embeddings/bedrock-titan-embedding.html), though I switched models to amazon.titan-embed-text-v1 and amazon.titan-embed-text-v2:0.

Expected behavior I was expecting a normal API call to Bedrock

Minimal Complete Reproducible example See: https://docs.spring.io/spring-ai/reference/api/embeddings/bedrock-titan-embedding.html, but try models amazon.titan-embed-text-v1 and amazon.titan-embed-text-v2:0.

maxjiang153 commented 5 months ago

Hi @kennyk65 could you provide a demo to reproduce this issue?

csterwa commented 2 months ago

Underlying API has been changed for Bedrock SDK and will verify separately.