-
Notifications
You must be signed in to change notification settings - Fork 924
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
[Good First Issue] Enhance Error Messages in agents-api for Better Readability and Context #568
Comments
Related to #568 Enhanced HTTPException in `create_agent.py` and `delete_agent.py`. As this issue states, we aim to improve error messages throughout the agents-api. I believe this issue can accommodate multiple pull requests. Your suggestions are highly appreciated. <!-- ELLIPSIS_HIDDEN --> ---- > [!IMPORTANT] > Enhanced error messages in `create_agent.py` and `delete_agent.py` for better clarity in `HTTPException` details. > > - **Error Messages**: > - In `create_agent.py`, updated `HTTPException` detail to "Developer not found. Please ensure the provided auth token (which refers to your developer_id) is valid and the developer has the necessary permissions to create an agent." > - In `delete_agent.py`, updated `HTTPException` detail to "The specified developer does not own the requested resource. Please verify the ownership or check if the developer ID is correct." > > <sup>This description was created by </sup>[<img alt="Ellipsis" src="https://img.shields.io/badge/Ellipsis-blue?color=175173">](https://www.ellipsis.dev?ref=julep-ai%2Fjulep&utm_source=github&utm_medium=referral)<sup> for a085d41. It will automatically update as commits are pushed.</sup> <!-- ELLIPSIS_HIDDEN --> Co-authored-by: Diwank Singh Tomer <[email protected]>
We have improved the error messages in the
Example: HTTPException(
detail="Developer not found. Please ensure the provided auth token (which refers to your developer_id) is valid and the developer has the necessary permissions to create an agent.",
status_code=403
# models/agent/create_agent.py
from fastapi import HTTPException
from .utils import rewrap_exceptions
@rewrap_exceptions
async def create_agent(request: CreateAgentRequest):
try:
developer = await get_developer(request.developer_id)
if not developer:
raise HTTPException(
status_code=403,
detail="Developer not found. Please ensure the provided auth token (which refers to your developer_id) is valid and the developer has the necessary permissions to create an agent."
)
# Additional logic for creating an agent
except DatabaseError as e:
raise HTTPException(
status_code=500,
detail=f"Database error occurred while creating the agent: {str(e)}. Please try again later or contact support."
)
except Exception as e:
raise HTTPException(
status_code=500,
detail=f"An unexpected error occurred: {str(e)}. Please contact support if the issue persists."
) |
Related to #568 Enhanced error messages in `agents-api/agents_api/models/user/` <!-- ELLIPSIS_HIDDEN --> ---- > [!IMPORTANT] > Enhanced error messages for exceptions in user-related modules to improve clarity and debugging. > > - **Error Messages**: > - Enhanced error messages for `QueryException`, `ValidationError`, and `TypeError` in `create_or_update_user.py`, `create_user.py`, and `delete_user.py`. > - Improved error messages in `get_user.py`, `list_users.py`, `patch_user.py`, and `update_user.py` to provide more detailed feedback on database query failures, input validation issues, and type mismatches. > > <sup>This description was created by </sup>[<img alt="Ellipsis" src="https://img.shields.io/badge/Ellipsis-blue?color=175173">](https://www.ellipsis.dev?ref=julep-ai%2Fjulep&utm_source=github&utm_medium=referral)<sup> for c2d3e10. It will automatically update as commits are pushed.</sup> <!-- ELLIPSIS_HIDDEN --> --------- Co-authored-by: Diwank Singh Tomer <[email protected]> Co-authored-by: creatorrr <[email protected]>
Hey there, I would like to work on this issue |
The quickest way is improving the standard pydantic ValidationErrors. Catching them and then pretty formatting before re-raising would be a great place to start @RS-labhub |
There are too many files inside the |
We use fastapi under the hood so the requests automatically run validations. Otherwise errors are handled in web.py and models/utils.py |
Need some time to understand the code base. Will be back shortly! |
We're looking to improve the error messages in our agents-api to make them more readable, informative, and context-aware. This is a great opportunity for new contributors to get familiar with our codebase and make a meaningful impact on user experience.
Currently, our error messages are often automated or lack descriptive information, which can make debugging and troubleshooting difficult for users of our API. We want to enhance these messages to provide more context and actionable information.
Objective:
Improve error messages throughout the agents-api, particularly focusing on the error handling in models/utils.py and models/agent/create_agent.py.
Steps to Approach This Issue:
Example Improvement:
Current error in
agents_api/models/agents/create_agent.py
:Improved version:
Guidelines:
Necessary Information:
Additional Notes:
We're excited to see your contributions to making our error handling more user-friendly and informative!
The text was updated successfully, but these errors were encountered: