diff options
Diffstat (limited to 'py')
| -rw-r--r-- | py/chat.py | 7 | ||||
| -rw-r--r-- | py/complete.py | 1 | ||||
| -rw-r--r-- | py/utils.py | 2 |
3 files changed, 7 insertions, 3 deletions
@@ -38,9 +38,10 @@ try: vim.command("redraw") response = openai.ChatCompletion.create( - model="gpt-3.5-turbo", - messages=messages, - stream=True, + model="gpt-3.5-turbo", + messages=messages, + stream=True, + request_timeout=request_timeout_seconds, ) generating_text = False diff --git a/py/complete.py b/py/complete.py index 9e46d63..d47eb2a 100644 --- a/py/complete.py +++ b/py/complete.py @@ -20,6 +20,7 @@ try: max_tokens=1000, temperature=0.1, stream=True, + request_timeout=request_timeout_seconds, ) generating_text = False diff --git a/py/utils.py b/py/utils.py index c9e88f2..05da3b9 100644 --- a/py/utils.py +++ b/py/utils.py @@ -1,6 +1,8 @@ import sys import os +request_timeout_seconds = 15 + def load_api_key(): config_file_path = os.path.join(os.path.expanduser("~"), ".config/openai.token") api_key = os.getenv("OPENAI_API_KEY") |