Skip to content
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

Index 0 out of bounds for length 0 exception in BedrockAnthropic3ChatModel #757

Open
ShaunDeng opened this issue May 23, 2024 · 1 comment

Comments

@ShaunDeng
Copy link

Bug description
Some models like BedrockAnthropic3 support stopSequences parameter, while the completions meet that token it will stop to generate. So there's a change to make model not generate anything. For example, we pass the prompt as 'Hi' and set stopSequences to 'Hello', that probably make model not generate anything.

Environment
Spring AI 1.0.0-SNAPSHOT, Java 17

Steps to reproduce
BedrockAnthropic3ChatModelIssue

Expected behavior
Since 1.0.0-SNAPSHOT is not stable, this case serves as a reminder in case you incorporate the following code snippet into the stable version.
···
return new ChatResponse(List.of(new Generation(((Anthropic3ChatBedrockApi.MediaContent)response.content().get(0)).text())));
···

@maxjiang153
Copy link
Contributor

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

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

No branches or pull requests

2 participants