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

Error when connecting to Claude through OpenRouter #2

Closed
ghost opened this issue Jul 5, 2024 · 7 comments
Closed

Error when connecting to Claude through OpenRouter #2

ghost opened this issue Jul 5, 2024 · 7 comments
Labels
enhancement New feature or request

Comments

@ghost
Copy link

ghost commented Jul 5, 2024

Hi @zeitlings , I've been able to use the workflow to access OpenRouter and the anthropic/claude-3.5-sonnet model, but the following error message appears at the end of every output:

􀇾 [Decoding Error > Data Corrupted] Cannot initialize StopReasonOpenAI from invalid String value endturn.
Coding Path: [CodingKeys(stringValue: "choices", intValue: nil), JSONKey(stringValue: "Index 0", intValue: 0), CodingKeys(stringValue: "finish_reason", intValue: nil)].

image

Thanks in advance!

@ghost
Copy link
Author

ghost commented Jul 5, 2024

And here are the model details from OpenRouter:

image

@zeitlings
Copy link
Owner

Hey @glowacky
In general, the API responses are expected to mirror those of OpenAI exactly, including the stop reason.
However, I'll probably add this particular exception. Might take a while to get around to it though.

@ghost
Copy link
Author

ghost commented Jul 8, 2024

I think you're right – on this OpenAI page, it seems like the equivalent finish_reason would be "stop"

No rush – will be on the lookout for the exception, thanks! 🙏

@ghost
Copy link
Author

ghost commented Aug 16, 2024

Hi @zeitlings ! Was this resolved? Still getting the error in alpha-4.

It occurred to me that finish_reason could maybe become another environment variable (openai_alternative_proxy_finish_reason). What do you think?

@zeitlings
Copy link
Owner

Hey @glowacky

Thanks for the suggestion, I think that's a very good idea. The next version will consider the environment variable openai_alternative_shared_finish_reasons (a comma separated list) as a fallback where decoding the finish reason initially fails.

@zeitlings
Copy link
Owner

@glowacky alpha.5 is ready to go now. Let me know if everything works as expected!

@ghost
Copy link
Author

ghost commented Aug 19, 2024

Seems to be working great, thanks!

@zeitlings zeitlings added the enhancement New feature or request label Aug 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant