fetchai / agentverse

Public repository for Agentverse
Apache License 2.0
8 stars 11 forks source link

Improve Error Handling for Unavailable Ratings #5

Closed Autonomousweb3Dev closed 1 month ago

Autonomousweb3Dev commented 3 months ago

Prerequisites

Category

Bug in Agentverse

Expected Behavior

When attempting to access the rating for a specific agent, if the rating is not available, the server should return a 204 No Content status code with a relevant message indicating the absence of a rating.

Observed Behavior

The server currently returns a 404 Not Found status code when the rating is not available. This can be misleading and may imply that the endpoint itself is incorrect or unavailable.

To Reproduce

Screenshot 2024-06-27 at 8 53 13 AM

Environment Details (Optional)

No response

Failure Logs (Optional)

No response

Additional Information (Optional)

Providing a more appropriate status code and message will improve clarity and user experience. Instead of returning a 404 Not Found status code, a 204 No Content status code with a message such as:

{
    "message": "Rating not available for the specified agent."
}

would be more informative.
qati commented 3 months ago

hi @Autonomousweb3Dev

Thank you for the report.

The /v1beta1/engine/analytics endpoint expects a function name, and not agent address. So if your agent agent1q0pzvr9dnl5k3086804839uvynfhqsheheth3273yvy9xq6nnmcncd7clcc has a function with id FUNCTION_ID, then the path will be:

/v1beta1/engine/analytics/FUNCTION_ID/rating/

Autonomousweb3Dev commented 3 months ago
Screenshot 2024-07-05 at 1 50 59 PM

@qati why so much rush to close the ticket? Because now I am seeing no way to re-open it 😢

BTW this is not about how I am using API, I am sharing this when I use Agentverse and error I see on browser console.

qati commented 2 months ago

Thank you for the screenshoot @Autonomousweb3Dev. We will have a look of why is that API called.

dominic22 commented 1 month ago

AV did call and old endpoint here. We are now requesting the .../v1beta1/engine/analytics/agent/{agent_address}/performance/ endpoint to get the ai agent rating.

Still, if there is no rating we will receive a 404 returning the message {"message":"Agent was not found"} which is the expected response. If there is a rating for the agent, the response will look as following:

{
    "time_series": {},
    "total": 29,
    "inception_total": 29,
    "rating": {
        "value": 2.9431342678444583,
        "trend": 0.0
    },
    "success_rate": {
        "value": 0.9655172413793104,
        "trend": 0.0
    }
}