Skip to content

fix: handle None refusal in extract_last_content#3465

Closed
nileshpatil6 wants to merge 1 commit into
openai:mainfrom
nileshpatil6:fix/extract-last-content-refusal-none
Closed

fix: handle None refusal in extract_last_content#3465
nileshpatil6 wants to merge 1 commit into
openai:mainfrom
nileshpatil6:fix/extract-last-content-refusal-none

Conversation

@nileshpatil6
Copy link
Copy Markdown
Contributor

ItemHelpers.extract_last_content returns last_content.refusal directly when the last content block is a refusal. Provider gateways (e.g. LiteLLM) can surface None for typed str fields, causing a TypeError downstream.

PR #3394 already added or "" to the .text branch for this exact reason. The .refusal branch was missed.

This is the same fix attempted in PR #3428, which was incorrectly closed as a duplicate -- the PR it was supposedly a duplicate of (#3394) only covered .text, not .refusal.

@seratch
Copy link
Copy Markdown
Member

seratch commented May 19, 2026

Closing this for this reason: #3427 (comment)

@seratch seratch closed this May 19, 2026
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.

2 participants