diff --git a/prompt-engineering/app.py b/prompt-engineering/app.py index 1405739ac9..afea1d635a 100644 --- a/prompt-engineering/app.py +++ b/prompt-engineering/app.py @@ -1,5 +1,7 @@ import argparse +import io import os +import sys import tomllib from pathlib import Path @@ -7,6 +9,9 @@ __all__ = ["get_chat_completion"] +# Force UTF-8 output to avoid encoding issues +sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding="utf-8") + # Authenticate client = OpenAI(api_key=os.getenv("OPENAI_API_KEY"))