-
Notifications
You must be signed in to change notification settings - Fork 0
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
Address Feedback + Autogen Docstring #44
Conversation
- Implemented explicit type checking for function input - Reformatted code to align with PEP8 standards - Updated docstrings for clarity and consistency Example Usage: >>> def example_func(a, b): ... return a + b ... >>> sigDTO = read_user_function(example_func)
- Updated example Jupyter notebook to demonstrate the usage of generate_docstring_template wih auto_generate - Added step-by-step instructions for setting up OpenAI API key - Included example function calls and expected outputs - Added dotenv and open ai dependency to toml file
- Updated example notebook to demonstrate the usage of auto_generate - Added step-by-step instructions for setting up OpenAI API key - Included example function calls and expected outputs - Added dotenv and openai dependencies to toml
Added `fill_docstring_with_ai` function to automatically generate detailed docstrings using OpenAI's GPT-4. This function takes a docstring template and function source as inputs and returns a completed docstring. - Loads API key using `dotenv` - Uses OpenAI's API for docstring completion - Implements error handling for missing inputs and API failures
…) with error handling - Added `auto_generate` option to `generate_docstring_template` to automatically generate docstrings using OpenAI's API. - Implemented error handling for missing function input (`ValueError`). - Ensured PEP 8 compliance with proper indentation, spacing, and docstring format.
- Added comprehensive unit tests for `read_user_function`, covering: - Functions with and without parameters - Functions with type hints, default values, and return types - Functions using `Optional` and `None` type annotations - Complex return types such as `list[int]` - Functions executing return statements - Error handling for invalid input - Future improvement: Add checks for `src` attribute inside the returned object.
…_with_ai) - Added missing test cases to cover all code paths in `fill_docstring_with_ai` - Mocked API calls to verify correct request formation and error handling - Ensured exceptions are raised for invalid inputs and API failures - Included credit for auto-generated test cases
Added a section to the README detailing how to run tests using pytest and measure code coverage with poetry.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #44 +/- ##
==========================================
- Coverage 94.20% 93.61% -0.59%
==========================================
Files 6 7 +1
Lines 69 94 +25
==========================================
+ Hits 65 88 +23
- Misses 4 6 +2 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
@@ -38,12 +38,16 @@ def square(base: int, pow: int) -> int: | |||
print(generate_docstring_template(square, output_file=None)) | |||
``` | |||
|
|||
## OpenAI Dependency: | |||
|
|||
`fml_doc_gen` requires an OpenAI API key to generate docstrings. You can set your API key using the `OPENAI_API_KEY` environment variable. Check our our documentation [here](https://readthedocs.org/projects/fml-doc-gen/badge/?version=latest) for more information. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo: check *out our
Peer Feedback 1 <htang085>.
- We added documentation for this. Integrating OpenAI itself was challenging, given the course load. We would make the tests for this more rigorous in future iterations.
Peer Feedback 2 <nhantien>:
- Implemented
Peer Feedback 3 <Farhan-Faisal>
PEP8 Guidelines:
Refactoring:
Documentation:
Tests:
Autogen: