zeitlings / ayai-gpt-nexus

OpenAI, Anthropic, and Gemini integrations with support for local LLMs
11 stars 0 forks source link

Error when connecting to Claude through OpenRouter #2

Open glowacky opened 4 days ago

glowacky commented 4 days ago

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!

glowacky commented 4 days ago

And here are the model details from OpenRouter:

image

zeitlings commented 1 day ago

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.

glowacky commented 1 day ago

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

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