Skip to content

Commit

Permalink
Force utf-8 output
Browse files Browse the repository at this point in the history
  • Loading branch information
martin-martin authored Oct 22, 2024
1 parent 1b448e6 commit 966c7f0
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions prompt-engineering/app.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
import argparse
import io
import os
import sys
import tomllib
from pathlib import Path

from openai import OpenAI

__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"))

Expand Down

0 comments on commit 966c7f0

Please sign in to comment.