Functions | |
def | generate_ipynb (str file_path, openai_client) |
def | is_url_valid (url) |
def | save_ipynb (str text, str file_path) |
Variables | |
string | _asst_id = "asst_na7wYBtXyGU0x5t2RdcnpxzP" |
string | _gtsam_gh_base = "https://raw.githubusercontent.com/borglab/gtsam/refs/heads/develop/" |
string | _output_folder = "output" |
string | _request_text = "Document the file found at {}." |
args = parser.parse_args() | |
client = OpenAI() | |
help | |
nargs | |
parser | |
GTSAM Copyright 2010-2025, Georgia Tech Research Corporation, Atlanta, Georgia 30332-0415 All Rights Reserved See LICENSE for the license information Author: Porter Zach This script generates interactive Python notebooks (.ipynb) that document GTSAM header files. Since inserting the text of the file directly into the prompt might be too many tokens, it retrieves the header file content from the GTSAM GitHub repository. It then sends it to OpenAI's API for processing, and saves the generated documentation as a Jupyter notebook. Functions: is_url_valid(url: str) -> bool: Verifies that the supplied URL does not return a 404. save_ipynb(text: str, file_path: str) -> str: Saves the provided text to a single Markdown cell in a new .ipynb file. generate_ipynb(file_path: str, openai_client): Generates an interactive Python notebook for the given GTSAM header file by sending a request to OpenAI's API and saving the response. Usage: Run the script with paths to GTSAM header files as arguments. For example: python gpt_generate.py gtsam/geometry/Pose3.h
def gpt_generate.generate_ipynb | ( | str | file_path, |
openai_client | |||
) |
Generate an interactive Python notebook for the given GTSAM header file. Args: file_path (str): The fully-qualified path from the root of the gtsam repository to the header file that will be documented. openai_client (openai.OpenAI): The OpenAI client to use.
Definition at line 72 of file gpt_generate.py.
def gpt_generate.is_url_valid | ( | url | ) |
Verify that the supplied URL does not return a 404.
Definition at line 45 of file gpt_generate.py.
Save text to a single Markdown cell in a new .ipynb file.
Definition at line 54 of file gpt_generate.py.
|
private |
Definition at line 41 of file gpt_generate.py.
|
private |
Definition at line 40 of file gpt_generate.py.
|
private |
Definition at line 39 of file gpt_generate.py.
|
private |
Definition at line 42 of file gpt_generate.py.
gpt_generate.args = parser.parse_args() |
Definition at line 132 of file gpt_generate.py.
gpt_generate.client = OpenAI() |
Definition at line 135 of file gpt_generate.py.
gpt_generate.help |
Definition at line 129 of file gpt_generate.py.
gpt_generate.nargs |
Definition at line 128 of file gpt_generate.py.
gpt_generate.parser |
Definition at line 121 of file gpt_generate.py.