shell_gpt
shell_gpt copied to clipboard
HTTPError: 500 Server Error: Internal Server Error for url: https://api.openai.com/v1/completions
Trying to call the "sgpt" command and getting the error mentioned above, full traceback printed out:
╭───────────────────── Traceback (most recent call last) ──────────────────────╮
│ /home/usr/.local/lib/python3.8/site-packages/sgpt.py:92 in main │
│ │
│ 89 │ │ prompt = f"{prompt}. Provide only shell command as output." │
│ 90 │ elif code: │
│ 91 │ │ prompt = f"{prompt}. Provide only code as output." │
│ ❱ 92 │ response_text = openai_request(prompt, model, max_tokens, api_key, │
│ 93 │ # For some reason OpenAI returns several leading/trailing white sp │
│ 94 │ response_text = response_text.strip() │
│ 95 │ typer_writer(response_text, code, shell, animation) │
│ │
│ ╭────────────────────────────── locals ──────────────────────────────╮ │
│ │ animation = True │ │
│ │ api_key = '###################################################' │ │
│ │ code = False │ │
│ │ execute = False │ │
│ │ max_tokens = 2048 │ │
│ │ model = 'text-davinci-003' │ │
│ │ prompt = 'hi' │ │
│ │ shell = False │ │
│ │ spinner = True │ │
│ ╰────────────────────────────────────────────────────────────────────╯ │
│ │
│ /home/usr/.local/lib/python3.8/site-packages/sgpt.py:46 in wrapper │
│ │
│ 43 │ │ text = TextColumn("[green]Requesting OpenAI...") │
│ 44 │ │ with Progress(SpinnerColumn(), text, transient=True) as progre │
│ 45 │ │ │ progress.add_task("request") │
│ ❱ 46 │ │ │ return func(*args, **kwargs) │
│ 47 │ │
│ 48 │ return wrapper │
│ 49 │
│ │
│ ╭─────────────────────────────── locals ───────────────────────────────╮ │
│ │ args = ( │ │
│ │ │ 'hi', │ │
│ │ │ 'text-davinci-003', │ │
│ │ │ 2048, │ │
│ │ │ '###################################################' │ │
│ │ ) │ │
│ │ func = <function openai_request at 0x7f1c5ba98ca0> │ │
│ │ kwargs = {} │ │
│ │ progress = <rich.progress.Progress object at 0x7f1c5ae88340> │ │
│ │ text = <rich.progress.TextColumn object at 0x7f1c5baac340> │ │
│ ╰──────────────────────────────────────────────────────────────────────╯ │
│ │
│ /home/usr/.local/lib/python3.8/site-packages/sgpt.py:60 in │
│ openai_request │
│ │
│ 57 │ │ "max_tokens": max_tokens, │
│ 58 │ } │
│ 59 │ response = requests.post(API_URL, headers=headers, json=data, time │
│ ❱ 60 │ response.raise_for_status() │
│ 61 │ return response.json()["choices"][0]["text"] │
│ 62 │
│ 63 │
│ │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │ api_key = '###################################################' │ │
│ │ data = { │ │
│ │ │ 'prompt': 'hi', │ │
│ │ │ 'model': 'text-davinci-003', │ │
│ │ │ 'max_tokens': 2048 │ │
│ │ } │ │
│ │ headers = { │ │
│ │ │ 'Content-Type': 'application/json', │ │
│ │ │ 'Authorization': 'Bearer │ │
│ │ ###################################################' │ │
│ │ } │ │
│ │ max_tokens = 2048 │ │
│ │ model = 'text-davinci-003' │ │
│ │ prompt = 'hi' │ │
│ │ response = <Response [500]> │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│ │
│ /home/usr/.local/lib/python3.8/site-packages/requests/models.py:1021 in │
│ raise_for_status │
│ │
│ 1018 │ │ │ ) │
│ 1019 │ │ │
│ 1020 │ │ if http_error_msg: │
│ ❱ 1021 │ │ │ raise HTTPError(http_error_msg, response=self) │
│ 1022 │ │
│ 1023 │ def close(self): │
│ 1024 │ │ """Releases the connection back to the pool. Once this method │
│ │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │ http_error_msg = '500 Server Error: Internal Server Error for url: │ │
│ │ https://api.openai.com/v1/compl'+6 │ │
│ │ reason = 'Internal Server Error' │ │
│ │ self = <Response [500]> │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
╰──────────────────────────────────────────────────────────────────────────────╯
HTTPError: 500 Server Error: Internal Server Error for url:
https://api.openai.com/v1/completions