Skip to content

fix: ChatGPT_API_with_finish_reason returns inconsistent type on error #62

Description

@luojiyin1987

Problem

The ChatGPT_API_with_finish_reason function returns different types depending on success/failure:

  • Success: returns (content: str, finish_reason: str) tuple
  • Error (max retries): returns "Error" string

This causes unpacking errors at call sites expecting a tuple.

Location

pageindex/utils.py:57 - error return in retry loop

Expected Behavior

Return ("", "error") tuple to maintain consistent return type.

Fix

Change error return from:

return "Error"

To:

return "", "error"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions