Skip to content

Commit

Permalink
add openai proxy option
Browse files Browse the repository at this point in the history
  • Loading branch information
tu95 committed May 30, 2023
1 parent d8e9e1e commit ecd8ca3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
8 changes: 6 additions & 2 deletions gepetto/config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@
MODEL = gpt-3.5-turbo

# Specify the program language. It can be "fr_FR", "zh_CN", or any folder in locales. Defaults to English.
LANGUAGE =
LANGUAGE =

[OpenAI]
# Set your API key here, or put it in the OPENAI_API_KEY environment variable.
API_KEY =
API_KEY =

# Set your OpenAI Proxy here, or put it in the HTTPS_PROXY environment variable.
# Such as: OPENAI_PROXY = http://127.0.0.1:7890
OPENAI_PROXY =
7 changes: 7 additions & 0 deletions gepetto/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,13 @@ def load_config():
openai.api_key = config.get('OpenAI', 'API_KEY')
print(f"Key set to {openai.api_key}")

# Get OPENAPI PROXY
if not config.get('OpenAI', 'OPENAI_PROXY'):
openai.proxy = None
else:
openai.proxy = config.get('OpenAI', 'OPENAI_PROXY')
print(f"OpenAI Proxy set to {openai.proxy}")

# Select model
requested_model = config.get('Gepetto', 'MODEL')
model = get_model(requested_model)
Expand Down

0 comments on commit ecd8ca3

Please sign in to comment.