Skip to content

Conversation

@mjp0
Copy link

@mjp0 mjp0 commented May 27, 2024

Generating text using Anthropic's models through OpenRouter crashes because their finish reason is "end_turn".

As I just debugged this quickly, I'm not sure if there are other places where this needs to be added?

TypeValidationError: Type validation failed: Value: {"id":"gen-xxx","model":"anthropic/claude-3-opus","object":"chat.completion","created":1716730125,"choices":[{"index":0,"message":{"role":"assistant","content":"Hello! How can I assist you today?"},"finish_reason":"end_turn"}],"usage":{"prompt_tokens":10,"completion_tokens":12,"total_tokens":22}}.
Error message: [
  {
    "received": "end_turn",
    "code": "invalid_enum_value",
    "options": [
      "stop",
      "length",
      "tool_calls",
      "content_filter",
      "function_call"
    ],
    "path": [
      "choices",
      0,
      "finish_reason"
    ],
    "message": "Invalid enum value. Expected 'stop' | 'length' | 'tool_calls' | 'content_filter' | 'function_call', received 'end_turn'"
  }
]
 cause: {
  "issues": [
    {
      "received": "end_turn",
      "code": "invalid_enum_value",
      "options": [
        "stop",
        "length",
        "tool_calls",
        "content_filter",
        "function_call"
      ],
      "path": [
        "choices",
        0,
        "finish_reason"
      ],
      "message": "Invalid enum value. Expected 'stop' | 'length' | 'tool_calls' | 'content_filter' | 'function_call', received 'end_turn'"
    }
  ],
  "name": "ZodError"
}

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

Successfully merging this pull request may close these issues.

1 participant