Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tenacity.RetryError: RetryError[<Future at 0x7f9bb4a6f8e0 state=finished raised InvalidRequestError>] #68

Closed
tyler-dot-earth opened this issue Apr 30, 2023 · 4 comments · Fixed by #69

Comments

@tyler-dot-earth
Copy link

tyler-dot-earth commented Apr 30, 2023

AutoPR Failure

AutoPR encountered an error while trying to fix redacted repository name

Traceback

Traceback (most recent call last):
  File "/venv/lib/python3.9/site-packages/tenacity/__init__.py", line 382, in __call__
    result = fn(*args, **kwargs)
  File "/app/autopr/repos/completions_repo.py", line 115, in _complete
    openai_response = openai.ChatCompletion.create(
  File "/venv/lib/python3.9/site-packages/openai/api_resources/chat_completion.py", line 25, in create
    return super().create(*args, **kwargs)
  File "/venv/lib/python3.9/site-packages/openai/api_resources/abstract/engine_api_resource.py", line 153, in create
    response, _, api_key = requestor.request(
  File "/venv/lib/python3.9/site-packages/openai/api_requestor.py", line 226, in request
    resp, got_stream = self._interpret_response(result, stream)
  File "/venv/lib/python3.9/site-packages/openai/api_requestor.py", line 620, in _interpret_response
    self._interpret_response_line(
  File "/venv/lib/python3.9/site-packages/openai/api_requestor.py", line 683, in _interpret_response_line
    raise self.handle_error_response(
openai.error.InvalidRequestError: The model: `gpt-4` does not exist

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/app/autopr/agents/brain_agent/base.py", line 73, in generate_pr
    self._generate_pr(event)
  File "/app/autopr/agents/brain_agent/simple_v1.py", line 27, in _generate_pr
    pr_desc = self.pull_request_agent.plan_pull_request(self.repo, issue, event)
  File "/app/autopr/agents/pull_request_agent/base.py", line 50, in plan_pull_request
    pull_request = self._plan_pull_request(repo, issue, event)
  File "/app/autopr/agents/pull_request_agent/rail_v1.py", line 388, in _plan_pull_request
    filepaths = self.get_initial_filepaths(files, issue)
  File "/app/autopr/agents/pull_request_agent/rail_v1.py", line 277, in get_initial_filepaths
    response = self.rail_service.run_prompt_rail(
  File "/app/autopr/services/rail_service.py", line 196, in run_prompt_rail
    prompt = self.completions_repo.complete(
  File "/app/autopr/repos/completions_repo.py", line 61, in complete
    result = self._complete(
  File "/venv/lib/python3.9/site-packages/tenacity/__init__.py", line 289, in wrapped_f
    return self(f, *args, **kw)
  File "/venv/lib/python3.9/site-packages/tenacity/__init__.py", line 379, in __call__
    do = self.iter(retry_state=retry_state)
  File "/venv/lib/python3.9/site-packages/tenacity/__init__.py", line 326, in iter
    raise retry_exc from fut.exception()
tenacity.RetryError: RetryError[<Future at 0x7f9bb4a6f8e0 state=finished raised InvalidRequestError>]

Additional information:

  • I created my OPENAI_API_KEY via this page: https://platform.openai.com/account/api-keys
  • I added the secret to github.com/MYREPO/settings/secrets/actions
  • I am using a ChatGPT Plus account that has GPT-4 access.
  • Let me know what other information I can provide 🖖
@tyler-dot-earth
Copy link
Author

Oh, I somehow got these extra lines in my github action:

-        codegen_agent_id: auto-v1
-        pull_request_agent_id: rail-v1
-        base_branch: main
-        model: gpt-4
-        context_limit: 8192
-        min_tokens: 1000
-        max_tokens: 2000
-        num_reasks: 2

I must have referenced a file that wasn't the file mentioned in the usage doc (https://github.com/irgolic/AutoPR/blob/main/USAGE.md).

So now I've made sure that i'm using the AutoPR template from: https://github.com/irgolic/AutoPR-template/blob/main/.github/workflows/autopr.yml

and I also started a new issue after making the change to make sure the action runs fresh (idk if gh actions cache the action somehow?).

... and I get this:

Traceback (most recent call last):
  File "/venv/lib/python3.9/site-packages/tenacity/__init__.py", line 382, in __call__
    result = fn(*args, **kwargs)
  File "/app/autopr/repos/completions_repo.py", line 115, in _complete
    openai_response = openai.ChatCompletion.create(
  File "/venv/lib/python3.9/site-packages/openai/api_resources/chat_completion.py", line 25, in create
    return super().create(*args, **kwargs)
  File "/venv/lib/python3.9/site-packages/openai/api_resources/abstract/engine_api_resource.py", line 153, in create
    response, _, api_key = requestor.request(
  File "/venv/lib/python3.9/site-packages/openai/api_requestor.py", line 226, in request
    resp, got_stream = self._interpret_response(result, stream)
  File "/venv/lib/python3.9/site-packages/openai/api_requestor.py", line 620, in _interpret_response
    self._interpret_response_line(
  File "/venv/lib/python3.9/site-packages/openai/api_requestor.py", line 683, in _interpret_response_line
    raise self.handle_error_response(
openai.error.InvalidRequestError: The model: `gpt-4` does not exist

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/app/autopr/agents/brain_agent/base.py", line 73, in generate_pr
    self._generate_pr(event)
  File "/app/autopr/agents/brain_agent/simple_v1.py", line 27, in _generate_pr
    pr_desc = self.pull_request_agent.plan_pull_request(self.repo, issue, event)
  File "/app/autopr/agents/pull_request_agent/base.py", line 50, in plan_pull_request
    pull_request = self._plan_pull_request(repo, issue, event)
  File "/app/autopr/agents/pull_request_agent/rail_v1.py", line 388, in _plan_pull_request
    filepaths = self.get_initial_filepaths(files, issue)
  File "/app/autopr/agents/pull_request_agent/rail_v1.py", line 277, in get_initial_filepaths
    response = self.rail_service.run_prompt_rail(
  File "/app/autopr/services/rail_service.py", line 196, in run_prompt_rail
    prompt = self.completions_repo.complete(
  File "/app/autopr/repos/completions_repo.py", line 61, in complete
    result = self._complete(
  File "/venv/lib/python3.9/site-packages/tenacity/__init__.py", line 289, in wrapped_f
    return self(f, *args, **kw)
  File "/venv/lib/python3.9/site-packages/tenacity/__init__.py", line 379, in __call__
    do = self.iter(retry_state=retry_state)
  File "/venv/lib/python3.9/site-packages/tenacity/__init__.py", line 326, in iter
    raise retry_exc from fut.exception()
tenacity.RetryError: RetryError[<Future at 0x7f348fc402b0 state=finished raised InvalidRequestError>]

So, same thing it looks like - the extra lines I had didn't seem to change the outcome.

@irgolic
Copy link
Owner

irgolic commented May 1, 2023

Hey, thanks for submitting such a detailed issue!

openai.error.InvalidRequestError: The model: `gpt-4` does not exist – this means you don't have access to the GPT-4 API.

I am using a ChatGPT Plus account that has GPT-4 access.

Sadly, ChatGPT Plus isn't enough to use GPT-4 via API; you have to sign up on the GPT-4 API waitlist. Hopefully GPT-4 API will go public soon! In the mean time, I've documented what's preventing gpt-3.5-turbo from working well in #65.

If we made it possible to run AutoPR on custom models with your own GPU, would that work for you?

Closing this issue as there's nothing tangible to fix, but please get in touch if you have any questions or ideas 🙏

@irgolic irgolic closed this as completed May 1, 2023
@irgolic
Copy link
Owner

irgolic commented May 1, 2023

On second thought, maybe we should explain the GPT-4 API waitlist matter somewhere in USAGE.md.

@mkrupczak3
Copy link
Contributor

gpt-4 is generally available, however I am still getting this error

Requesting this issue be re-opened

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants