fix(translator): map Claude "refusal" stop_reason to content_filter and surface its explanation
Anthropic's API-level refusal (streaming classifier / ToS) ends the stream with stop_reason "refusal", stop_details carrying the reason, zero output tokens and no content blocks. Map refusal to content_filter in both directions, surface stop_details.explanation as message text, and add CLAUDE_STOP.REFUSAL to schema.
This commit is contained in:
@@ -14,6 +14,9 @@ export const CLAUDE_STOP = {
|
||||
MAX_TOKENS: "max_tokens",
|
||||
TOOL_USE: "tool_use",
|
||||
STOP_SEQUENCE: "stop_sequence",
|
||||
// Anthropic's API-level refusal (streaming classifier / ToS). Arrives in
|
||||
// message_delta with zero output tokens; stop_details carries the reason.
|
||||
REFUSAL: "refusal",
|
||||
};
|
||||
|
||||
// Gemini finishReason values.
|
||||
|
||||
Reference in New Issue
Block a user