aider icon indicating copy to clipboard operation
aider copied to clipboard

Getting error "The model `gpt-3.5-turbo` does not exist or you do not have access to it." when using model `groq/llama3-70b-8192`

Open azazar opened this issue 2 years ago • 8 comments

$ aider --openai-api-base=https://api.groq.com/openai/v1 --model=groq/llama3-70b-8192 
Aider v0.29.0
VSCode terminal detected, pretty output has been disabled.
Unable to check environment variables for model groq/llama3-70b-8192
Models: groq/llama3-70b-8192 with whole edit format, weak model gpt-3.5-turbo
Git repo: .git with 30 files
Repo-map: using 1024 tokens
Use /help to see in-chat commands, run with --help to see cmd line args
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
> /add src/main/java/com/onemovmedia/Video.java src/test/java/com/onemovmedia/VideoTest.java                                                                                                

Added /home/m/Private/Projects/Freelance/if/selfcms/src/main/java/com/onemovmedia/Video.java to the chat
Added /home/m/Private/Projects/Freelance/if/selfcms/src/test/java/com/onemovmedia/VideoTest.java to the chat
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
src/main/java/com/onemovmedia/Video.java src/test/java/com/onemovmedia/VideoTest.java                                                                                                       
> Display all lines of code that conatin issues.                                                                                                                                            

After reviewing the provided code, I didn't find any syntax errors or issues that would prevent the code from compiling. The code appears to be well-structured and follows Java coding conventions.

However, I do have some suggestions for improvement:

1. In the `Video` class, the `writeFacets` and `readFacets` methods are not following the Java naming conventions. They should be renamed to `writeFacetsToStream` and `readFacetsFromStream` to better reflect their purpose.

2. The `Video` class has a lot of fields, which can make it difficult to maintain and extend. Consider breaking it down into smaller classes or using a builder pattern to simplify object creation.

3. The `VideoTest` class has a lot of repeated code in the test methods. Consider extracting a separate method for creating an `ExternalGallery` object to reduce code duplication.

4. The `Video` class uses a lot of magic numbers (e.g., `0xFF`) that are not self-explanatory. Consider defining named constants for these values to improve code readability.

5. The `Video` class does not have any validation for the input data. Consider adding input validation to ensure that the object is in a valid state.

Here is an example of how the `writeFacets` method could be renamed and refactored:

src/main/java/com/onemovmedia/Video.java
```
private static void writeFacetsToStream(ObjectOutput out, Map<String, String[]> facets) throws IOException {
    // ...
}
```

Please let me know if you would like me to suggest any changes to the code.
Applied edit to src/main/java/com/onemovmedia/Video.java
Traceback (most recent call last):
  File "/home/m/Private/.local/pipx/venvs/aider-chat/lib/python3.11/site-packages/litellm/llms/openai.py", line 414, in completion
    raise e
  File "/home/m/Private/.local/pipx/venvs/aider-chat/lib/python3.11/site-packages/litellm/llms/openai.py", line 373, in completion
    response = openai_client.chat.completions.create(**data, timeout=timeout)  # type: ignore
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/m/Private/.local/pipx/venvs/aider-chat/lib/python3.11/site-packages/openai/_utils/_utils.py", line 277, in wrapper
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/home/m/Private/.local/pipx/venvs/aider-chat/lib/python3.11/site-packages/openai/resources/chat/completions.py", line 581, in create
    return self._post(
           ^^^^^^^^^^^
  File "/home/m/Private/.local/pipx/venvs/aider-chat/lib/python3.11/site-packages/openai/_base_client.py", line 1232, in post
    return cast(ResponseT, self.request(cast_to, opts, stream=stream, stream_cls=stream_cls))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/m/Private/.local/pipx/venvs/aider-chat/lib/python3.11/site-packages/openai/_base_client.py", line 921, in request
    return self._request(
           ^^^^^^^^^^^^^^
  File "/home/m/Private/.local/pipx/venvs/aider-chat/lib/python3.11/site-packages/openai/_base_client.py", line 1012, in _request
    raise self._make_status_error_from_response(err.response) from None
openai.NotFoundError: Error code: 404 - {'error': {'message': 'The model `gpt-3.5-turbo` does not exist or you do not have access to it.', 'type': 'invalid_request_error', 'code': 'model_not_found'}}

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/m/Private/.local/pipx/venvs/aider-chat/lib/python3.11/site-packages/litellm/main.py", line 1009, in completion
    raise e
  File "/home/m/Private/.local/pipx/venvs/aider-chat/lib/python3.11/site-packages/litellm/main.py", line 982, in completion
    response = openai_chat_completions.completion(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/m/Private/.local/pipx/venvs/aider-chat/lib/python3.11/site-packages/litellm/llms/openai.py", line 420, in completion
    raise OpenAIError(status_code=e.status_code, message=str(e))
litellm.llms.openai.OpenAIError: Error code: 404 - {'error': {'message': 'The model `gpt-3.5-turbo` does not exist or you do not have access to it.', 'type': 'invalid_request_error', 'code': 'model_not_found'}}

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/m/.local/bin/aider", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/m/Private/.local/pipx/venvs/aider-chat/lib/python3.11/site-packages/aider/main.py", line 685, in main
    coder.run()
  File "/home/m/Private/.local/pipx/venvs/aider-chat/lib/python3.11/site-packages/aider/coders/base_coder.py", line 392, in run
    new_user_message = self.run_loop()
                       ^^^^^^^^^^^^^^^
  File "/home/m/Private/.local/pipx/venvs/aider-chat/lib/python3.11/site-packages/aider/coders/base_coder.py", line 476, in run_loop
    return self.send_new_user_message(inp)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/m/Private/.local/pipx/venvs/aider-chat/lib/python3.11/site-packages/aider/coders/base_coder.py", line 577, in send_new_user_message
    saved_message = self.auto_commit(edited)
                    ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/m/Private/.local/pipx/venvs/aider-chat/lib/python3.11/site-packages/aider/coders/base_coder.py", line 1019, in auto_commit
    res = self.repo.commit(fnames=edited, context=context, prefix="aider: ")
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/m/Private/.local/pipx/venvs/aider-chat/lib/python3.11/site-packages/aider/repo.py", line 73, in commit
    commit_message = self.get_commit_message(diffs, context)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/m/Private/.local/pipx/venvs/aider-chat/lib/python3.11/site-packages/aider/repo.py", line 124, in get_commit_message
    commit_message = simple_send_with_retries(model.name, messages)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/m/Private/.local/pipx/venvs/aider-chat/lib/python3.11/site-packages/aider/sendchat.py", line 60, in simple_send_with_retries
    _hash, response = send_with_retries(
                      ^^^^^^^^^^^^^^^^^^
  File "/home/m/Private/.local/pipx/venvs/aider-chat/lib/python3.11/site-packages/backoff/_sync.py", line 105, in retry
    ret = target(*args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/m/Private/.local/pipx/venvs/aider-chat/lib/python3.11/site-packages/aider/sendchat.py", line 50, in send_with_retries
    res = litellm.completion(**kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/m/Private/.local/pipx/venvs/aider-chat/lib/python3.11/site-packages/litellm/utils.py", line 2965, in wrapper
    raise e
  File "/home/m/Private/.local/pipx/venvs/aider-chat/lib/python3.11/site-packages/litellm/utils.py", line 2863, in wrapper
    result = original_function(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/m/Private/.local/pipx/venvs/aider-chat/lib/python3.11/site-packages/litellm/main.py", line 2136, in completion
    raise exception_type(
          ^^^^^^^^^^^^^^^
  File "/home/m/Private/.local/pipx/venvs/aider-chat/lib/python3.11/site-packages/litellm/utils.py", line 8628, in exception_type
    raise e
  File "/home/m/Private/.local/pipx/venvs/aider-chat/lib/python3.11/site-packages/litellm/utils.py", line 7377, in exception_type
    raise NotFoundError(
litellm.exceptions.NotFoundError: OpenAIException - Error code: 404 - {'error': {'message': 'The model `gpt-3.5-turbo` does not exist or you do not have access to it.', 'type': 'invalid_request_error', 'code': 'model_not_found'}}

azazar avatar Apr 22 '24 08:04 azazar

Have you tried --model=llama3-70b-8192 instead of --model=groq/llama3-70b-8192?

rossaaiofficial avatar Apr 22 '24 13:04 rossaaiofficial

I've tried that.

$ aider --openai-api-base=https://api.groq.com/openai/v1 --model=llama3-70b-8192
Aider v0.29.0
VSCode terminal detected, pretty output has been disabled.
Unable to check environment variables for model llama3-70b-8192
Unknown model llama3-70b-8192, did you mean one of these?
- groq/llama3-70b-8192

azazar avatar Apr 22 '24 13:04 azazar

Found out that it works with argument --weak-model=groq/llama3-70b-8192: aider --openai-api-base=https://api.groq.com/openai/v1 --model=groq/llama3-70b-8192 --weak-model=groq/llama3-70b-8192

azazar avatar Apr 22 '24 13:04 azazar

Cool! Let me try it too... OMG! It's so fast

rossaaiofficial avatar Apr 22 '24 13:04 rossaaiofficial

Ya, aider defaults to gpt-3.5-turbo as the "weak" model. The error message isn't very helpful when that fails. I will look into making this smoother when working with non-OpenAI models.

paul-gauthier avatar Apr 22 '24 13:04 paul-gauthier

All these model and api related arguments aren't very clear. They often don't work as the user may expect. Is there any documentation page dedicated to LLM arguments? One thing I don't understand is where does the prefix groq/ come from.

azazar avatar Apr 22 '24 14:04 azazar

There are some docs here:

https://aider.chat/docs/llms.html

If you pull the latest version from github, you should be able to just run this:

aider --model=groq/llama3-70b-8192

The change is available in the main branch. You can get it by installing the latest version from github:

python -m pip install --upgrade git+https://github.com/paul-gauthier/aider.git

If you have a chance to try it, let me know if it works better for you.

paul-gauthier avatar Apr 22 '24 19:04 paul-gauthier

I'm going to close this issue for now, but feel free to add a comment here and I will re-open or file a new issue any time.

paul-gauthier avatar Apr 29 '24 18:04 paul-gauthier