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

Improved error handling and added docs strings #133

Open
wants to merge 19 commits into
base: main
Choose a base branch
from

Conversation

Azeem-2
Copy link

@Azeem-2 Azeem-2 commented Mar 13, 2025

No description provided.

rm-openai and others added 19 commits March 12, 2025 17:34
…ling

Add error handling, type hints, and docstrings to various functions and methods.

* **Error Handling**
  - Add try-except blocks to handle potential exceptions in functions across multiple files.
  - Log errors and re-raise exceptions where necessary.

* **Type Hints**
  - Add type hints to function and method signatures to improve code readability and type checking.

* **Docstrings**
  - Add docstrings to functions and classes to provide descriptions and improve code documentation.

* **Specific Changes**
  - `src/agents/__init__.py`: Add error handling for setting default OpenAI key, client, and API. Add type hints and error handling for enabling verbose stdout logging.
  - `src/agents/_run_impl.py`: Add docstrings to various functions and classes. Add error handling for running input and output guardrails, invoking handoffs, and executing computer actions. Add type hints to function signatures.
  - `src/agents/agent_output.py`: Add error handling for JSON validation. Add docstrings to functions.
  - `src/agents/agent.py`: Add error handling for running agent as tool and getting system prompt. Add type hints to function signatures.
  - `src/agents/exceptions.py`: Add type hints to exception classes. Add docstrings to classes.
  - `src/agents/function_schema.py`: Add error handling for generating function schema. Add docstrings to functions.

---

For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/Azeem-2/openai-agents-python?shareId=XXXX-XXXX-XXXX-XXXX).
Improve code quality by adding docstrings, type hints, and error handling
These are common issues faced by devs, so adding docs to help.
Results in double logging if we dont. Closes openai#141.
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 this pull request may close these issues.

2 participants