API Reference
gpt_engineer.applications
: Applications
Classes
|
The CliAgent class is responsible for managing the lifecycle of code generation and improvement using an AI model. |
Represents and displays a file system path in a tree-like structure. |
Functions
Collects human feedback on the code and sends it for analysis. |
|
Collect the learning data and send it to RudderStack for analysis. |
|
|
Send the learning data to RudderStack for analysis. |
Asks the user for their consent to store their data for the purpose of improving the GPT Engineer tool. |
|
Checks if the user has previously given consent to store their data for feedback collection. |
|
Constructs a Learning object containing the session's metadata and user feedback. |
|
Retrieves or generates a unique identifier for the current user session. |
|
Interactively prompts the user to review the generated code and returns their feedback encapsulated in a Review object. |
|
|
|
Get the path to the preprompts, using custom ones if specified. |
|
Load environment variables if the OPENAI_API_KEY is not already set. |
|
|
Load or request a prompt from the user based on the mode. |
|
The main entry point for the CLI tool that generates or improves a project. |
gpt_engineer.benchmark
: Benchmark
Functions
Dynamically imports and returns the default configuration agent from the given path. |
|
|
The main function that runs the specified benchmarks with the given agent and outputs the results to the console. |
Loads the APPS benchmark, which consists of a series coding problems. |
|
Loads the GPT-Me benchmark, which consists of a series of tasks for evaluation. |
|
Retrieves a Benchmark object by name. |
|
Loads the MBPP benchmark, which consists of a series coding problems. |
|
|
|
|
Prints the results of the benchmark tasks to the console. |
|
Runs the benchmark tasks using the provided agent and returns a list of TaskResult objects. |
gpt_engineer.core
: Core
Classes
|
Initialize the AI class. |
Abstract base class for an agent that interacts with code. |
|
Abstract base class for an execution environment capable of running code. |
|
An execution environment that runs code on the local file system and captures the output of the execution. |
|
A file-based key-value store where keys correspond to filenames and values to file contents. |
|
|
An agent that uses AI to generate and improve code based on a given prompt. |
|
|
A dictionary-based container for managing code files. |
|
Abstract base class for a version manager. |
Functions
|
|
|
Applies diffs to the provided files. |
Converts a chat string containing file paths and code blocks into a FilesDict object. |
|
|
Parses a block of diff text into a Diff object. |
|
Parses a diff string in the unified git diff format. |
|
Parses the header of a hunk from a diff. |
Constructs the full path to the memory directory based on a given base path. |
|
Constructs the full path to the metadata directory based on a given base path. |
|
Creates an instance of SimpleAgent with default configuration. |
|
Returns the name of the current function. |
|
Executes the entrypoint of the codebase. |
|
|
Generates code from a prompt using AI and returns the generated files. |
|
Generates an entrypoint for the codebase and returns the entrypoint files. |
|
Improves the code based on user input and returns the updated files. |
|
Sets up the system prompt for generating code. |
Sets up the system prompt for improving existing code. |
|
|
Computes the ratio of common characters to the length of the longer string, ignoring spaces and case. |
|
Compares two strings for similarity, ignoring spaces and case. |
|
Converts file content into a dictionary where each line number is a key and the corresponding line content is the value. |
|
|
|
|
|
|
|
|
|
|
|
Read the configuration file |
gpt_engineer.tools
: Tools
Functions
|
Generates code based on clarifications obtained from the user and saves it to a specified workspace. |
Returns a string containing the OS and Python version information. |
|
|
Executes the AI model using the main prompt and saves the generated results to the specified workspace. |
|
Attempts to execute the code from the entrypoint and if it fails, sends the error output back to the AI with instructions to fix. |