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

Added Anthropic's end_turn as a valid finish reason #343

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

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