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:
To: