[Bug] Agno.exceptions.ModelProviderError: {"error":{"message":"Not Found"}}
Bug: agno.exceptions.ModelProviderError: "error"}
When attempting to use the Groq model with the Agno library, a ModelProviderError
is raised with the message {"error":{"message":"Not Found"}}
. This error occurs when the Groq API returns a 404 status code, indicating that the requested resource was not found.
Agent Configuration (if applicable)
The following code snippet demonstrates the agent configuration used to reproduce the issue:
from os import getenv
from agno.agent import Agent, RunResponse
from agno.models.openai.like import OpenAILike
from agno.models.groq import Groq
agent = Agent(
model=Groq(
id="llama-3.1-8b-instant",
base_url='https://api.groq.com/openai/v1/chat/completions',
api_key='***',
)
agent.print_response("Share a 2 sentence horror story.")
)
In this code snippet, we create an instance of the Agent
class, specifying the Groq
model with the id
set to "llama-3.1-8b-instant"
, the base_url
set to https://api.groq.com/openai/v1/chat/completions
, and the api_key
set to a placeholder value (***
).
Expected Behavior
We expect the Agent
to successfully print the response to the prompt "Share a 2 sentence horror story.".
Actual Behavior
However, when we run the code, we encounter the following error:
ERROR Error calling Groq API: Error code: 404 - {'error': {'message': 'Not Found'}}
WARNING Attempt 1/1 failed: {"error":{"message":"Not Found"}}
ERROR Failed after 1 attempts. Last error using Groq(llama-3.1-8b-instant)
▰▱▱▱▱▱▱ Thinking...
┏━ Message ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ ┃
┃ Share a 2 sentence horror story. ┃
┃ ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━���━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
Traceback (most recent call last):
File "/home/sun/miniconda3/envs/agno/lib/python3.12/site-packages/agno/models/groq/groq.py", line 256, in invoke
return self.get_client().chat.completions.create(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/sun/miniconda3/envs/agno/lib/python3.12/site-packages/groq/resources/chat/completions.py", line 355, in create
return self._post(
^^^^^^^^^^^
File "/home/sun/miniconda3/envs/agno/lib/python3.12/site-packages/groq/_base_client.py", line 1222, in post return cast(ResponseT, self.request(cast_to, opts, stream=stream, stream_cls=stream_cls))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/sun/miniconda3/envs/agno/lib/python3.12/site-packages/groq/_base_client.py", line 1031, in request
raise self._make_status_error_from_response(err.response) from None
groq.NotFoundError: Error code: 404 - {'error': {'message': 'Not Found'}}
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/sun/agent/models/groq/test.py", line 34, in <module>
agent.print_response("Share a 2 sentence horror story.")
File "/home/sun/miniconda3/envs/agno/lib/python3.12/site-packages/agno/agent/agent.py", line 4725, in print_response
run_response = self.run(
^^^^^^^^^
File "/home/sun/miniconda3/envs/agno/lib/python3.12/site-packages/agno/agent/agent.py", line 1204, in run
raise last_exception
File "/home/sun/miniconda3/envs/agno/lib/python3.12/site-packages/agno/agent/agent.py", line 1174, in run
return next(resp)
^^^^^^^^^^
File "/home/sun/miniconda3/envs/agno/lib/python3.12/site-packages/agno/agent/agent.py", line 811, in _run
model_response = self.model.response(messages=run_messages.messages)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/sun/miniconda3/envs/agno/lib/python3.12/site-packages/agno/models/base.py", line 187, in response
assistant_message, has_tool_calls = self._process_model_response(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/sun/miniconda3/envs/agno/lib/python3.12/site-packages/agno/models/base.py", line 323, in _process_model_response
response = self.invoke(messages=messages)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/sun/miniconda3/envs/agno/lib/python3.12/site-packages/agno/models/groq/groq.py", line 263, in invoke
raise ModelProviderError(
agno.exceptions.ModelProviderError: {"error":{"message":"Not Found"}}
Screenshots or Logs (if applicable)
No screenshots or logs are provided as this issue is related to a programming error.
Environment
- OS: ubuntu22
- Agno Version: 1.4.5
- Python 3.12.9
Possible Causes
The possible causes of this issue are:
- Incorrect API endpoint: The
base_url
specified in the agent configuration may be incorrect, leading to a 404 status code. - Invalid API key: The
api_key
specified in the agent configuration may be invalid or expired, resulting in a 404 status code. - Model not found: The
id
specified in the agent configuration may not to a valid model, leading to a 404 status code.
Troubleshooting Steps
To troubleshoot this issue, follow these steps:
- Verify API endpoint: Ensure that the
base_url
specified in the agent configuration is correct and up-to-date. - Check API key: Verify that the
api_key
specified in the agent configuration is valid and not expired. - Validate model ID: Ensure that the
id
specified in the agent configuration corresponds to a valid model. - Check Groq API documentation: Refer to the Groq API documentation to ensure that the API endpoint and API key are correctly formatted.
- Contact Groq support: If none of the above steps resolve the issue, contact Groq support for further assistance.
Conclusion
In conclusion, the ModelProviderError
raised by the Agno library with the message {"error":{"message":"Not Found"}}
is likely caused by an incorrect API endpoint, invalid API key, or invalid model ID. To troubleshoot this issue, verify the API endpoint, check the API key, validate the model ID, and refer to the Groq API documentation. If none of these steps resolve the issue, contact Groq support for further assistance.
Q&A: agno.exceptions.ModelProviderError: "error"}
Q: What is the agno.exceptions.ModelProviderError: "error"} error?
A: The agno.exceptions.ModelProviderError: {"error":{"message":"Not Found"}}
error is a programming error that occurs when the Agno library is unable to retrieve a model from the Groq API. This error is typically caused by an incorrect API endpoint, invalid API key, or invalid model ID.
Q: What are the possible causes of this error?
A: The possible causes of this error are:
- Incorrect API endpoint: The
base_url
specified in the agent configuration may be incorrect, leading to a 404 status code. - Invalid API key: The
api_key
specified in the agent configuration may be invalid or expired, resulting in a 404 status code. - Model not found: The
id
specified in the agent configuration may not correspond to a valid model, leading to a 404 status code.
Q: How can I troubleshoot this error?
A: To troubleshoot this error, follow these steps:
- Verify API endpoint: Ensure that the
base_url
specified in the agent configuration is correct and up-to-date. - Check API key: Verify that the
api_key
specified in the agent configuration is valid and not expired. - Validate model ID: Ensure that the
id
specified in the agent configuration corresponds to a valid model. - Check Groq API documentation: Refer to the Groq API documentation to ensure that the API endpoint and API key are correctly formatted.
- Contact Groq support: If none of the above steps resolve the issue, contact Groq support for further assistance.
Q: How can I prevent this error from occurring in the future?
A: To prevent this error from occurring in the future, ensure that:
- API endpoint is correct: Verify that the
base_url
specified in the agent configuration is correct and up-to-date. - API key is valid: Verify that the
api_key
specified in the agent configuration is valid and not expired. - Model ID is valid: Ensure that the
id
specified in the agent configuration corresponds to a valid model. - Groq API documentation is consulted: Refer to the Groq API documentation to ensure that the API endpoint and API key are correctly formatted.
Q: What are the consequences of this error?
A: The consequences of this error are:
- Model not retrieved: The model specified in the agent configuration will not be retrieved from the Groq API.
- Error message displayed: An error message will be displayed indicating that the model was not found.
- Program execution halted: The program execution will be halted due to the error.
Q: How can I recover from this error?
A: To recover from this error, follow these steps:
- Check agent configuration: Verify that the agent configuration is correct and up-to-date.
- Check API endpoint: Verify that the API endpoint correct and up-to-date.
- Check API key: Verify that the API key is valid and not expired.
- Check model ID: Verify that the model ID is valid and corresponds to a valid model.
- Contact Groq support: If none of the above steps resolve the issue, contact Groq support for further assistance.