GPT-Documenter is a small project that automates the process of documenting Python functions by using GPT-3.5 along with Langchain.
pip install gptdocumenter
GPT-Documenter utilizes Python Typer and provides two main commands:
inspect
document-functions
The inspect
command allows you to preview the documentation setup and receive an estimate of token usage. To use the inspect
command, provide the following parameters:
project_path
: The path of the project you want to documentoutput_path
: The path where the JSON result will be savedexcluded_paths
: A list of paths you want to avoid, with project_path as root.
Here's an example of how to use the inspect
command:
gptdocumenter inspect /path/to/project /path/to/output.json directory/to/avoid, file_to_avoid.py
The document-functions
command generates the actual documentation for the Python functions in your project. You'll need to provide the same arguments as the inspect
command, along with your OpenAI API key:
openai_api_key
: Your OpenAI API keyproject_path
: The path of the project you want to documentoutput_path
: The path where the JSON result will be savedexclude_paths
: A list of paths you want to avoid, with project_path as root.
Here's an example of how to use the document-functions
command:
gptdocumenter document-functions YOUR_API_KEY /path/to/project /path/to/output.json directory/to/avoid, file_to_avoid.py
Once the command is executed, GPT-Documenter will begin generating the documentation for the functions and save the result as a JSON file in the specified output path.