This repository contains an asynchronous solution generation pipeline using OpenAI's API. The pipeline is designed to take a problem statement and iteratively generate, refine, and produce a final code solution.
The pipeline follows these steps:
- Problem Input: The user provides a problem statement.
- Solution Sketch Generation: Three initial solution sketches are generated using different temperature settings.
- Sketch Refinement: The sketches are refined into a final solution sketch.
- Pseudocode Generation: Pseudocode is generated from the refined sketch.
- Initial Code Generation: Initial code is generated from the pseudocode.
- Code Refinement: The initial code is refined multiple times to produce the final code.
The user inputs a problem statement that serves as the basis for generating solutions.
- Temperatures: Three sketches are generated using temperatures of 0.6, 0.8, and 1.0.
- Asynchronous Tasks: Each sketch is generated asynchronously to improve efficiency.
- The three sketches are refined into a single, coherent solution sketch.
- Pseudocode is generated from the refined solution sketch to provide a structured plan for coding.
- Python code is generated from the pseudocode, forming the initial version of the solution.
- The initial code undergoes three rounds of refinement to ensure quality and correctness.
To use the pipeline, instantiate the Solver class and call the solve method with a problem statement. The method returns the final refined code.
solver = Solver() final_code = await solver.solve(problem="Your problem statement here")
Ensure you have your OpenAI API key set in the config.py file.
