Skip to content

fix: make ChatGPT_API_with_finish_reason return consistent tuple - #63

Merged
BukeLy merged 1 commit into
VectifyAI:mainfrom
luojiyin1987:fix/api-error-return
Mar 16, 2026
Merged

fix: make ChatGPT_API_with_finish_reason return consistent tuple#63
BukeLy merged 1 commit into
VectifyAI:mainfrom
luojiyin1987:fix/api-error-return

Conversation

@luojiyin1987

Copy link
Copy Markdown
Contributor

Summary

Fixes #62 - Make ChatGPT_API_with_finish_reason return consistent tuple type on error.

Problem

The function returned (content, finish_reason) on success but "Error" string when max retries reached, causing unpacking errors.

Change

  • Return ("", "error") tuple instead of "Error" string
  • Maintains consistent return type for all code paths

Test

Manual testing of error scenarios.

Signed-off-by: luojiyin <luojiyin@hotmail.com>
@BukeLy

BukeLy commented Mar 16, 2026

Copy link
Copy Markdown
Member

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

The fix correctly addresses the inconsistent return type: all callers use response, finish_reason = ChatGPT_API_with_finish_reason(...) tuple unpacking, so the previous return "Error" string would cause a ValueError. Returning ("", "error") maintains type consistency across all code paths.

馃 Generated with Claude Code

- If this code review was useful, please react with 馃憤. Otherwise, react with 馃憥.

@BukeLy
BukeLy merged commit b487f9d into VectifyAI:main Mar 16, 2026
@luojiyin1987
luojiyin1987 deleted the fix/api-error-return branch March 16, 2026 05:49
suulkyy pushed a commit to suulkyy/PageIndex that referenced this pull request May 8, 2026
fix: make ChatGPT_API_with_finish_reason return consistent tuple
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.

fix: ChatGPT_API_with_finish_reason returns inconsistent type on error

2 participants