Skip to content

Feature: Unhandled finish reasons #205

Open
@ChrisB-TL

Description

@ChrisB-TL

Post refactor, I think we should add a specific exception for unhandled finish reasons, for folks to hook into.

I'd envisage it being thrown at the bottom of the handle method on provider handlers and taking the provider, the mapped finished reason and the "raw" provider finish reason.

return match ($finishReason) {
    FinishReason::ToolCalls => $this->handleToolCalls($data, $request),
    FinishReason::Stop => $this->handleStop($data, $request),
    default => throw new PrismUnhandledFinishReasonException(Provider::Gemini, $finishReason, $finishReasonRaw),
};

Am happy to pick this up if you agree @sixlive, just leaving this here as a reminder to circle back to it.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions