Skip to content

Conversation

@LuminaX-alt
Copy link
Owner

…n‑UTF8 terminals (openai#2409)

Summary

Fixes openai#2409 by adding UTF‑8 safe printing for SDK objects and responses. Jupyter and some environments use non‑UTF8 stdout, causing UnicodeEncodeError in test code.

Changes

  • Added _safe_print() for printing responses and debug data.
  • Updated SDK object __repr__ methods to handle non‑UTF8 encodings.

Why

Prevents crashes in notebooks and non‑UTF8 terminals when working with Unicode data in API responses.

  • I understand that this repository is auto-generated and my pull request may not be merged

Changes being requested

Additional context & links

…n‑UTF8 terminals (openai#2409)

### Summary
Fixes openai#2409 by adding UTF‑8 safe printing for SDK objects and responses. Jupyter and some environments use non‑UTF8 stdout, causing `UnicodeEncodeError` in test code.

### Changes
- Added `_safe_print()` for printing responses and debug data.
- Updated SDK object `__repr__` methods to handle non‑UTF8 encodings.

### Why
Prevents crashes in notebooks and non‑UTF8 terminals when working with Unicode data in API responses.
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.

UnicodeEncodeError when running OpenAI SDK test code in Jupyter Notebook

2 participants