This workspace contains the following files and directories:
.gitignore: This file specifies patterns of files and directories that should be ignored by Git version control.LICENSE: This file contains the MIT License, which is the license under which the software in this workspace is distributed.README.md: This file is the README for the workspace itself, providing information and instructions.main.py: This file contains the main Python script of the project.
The main purpose of this project is to generate code and test cases based on a given task and programming language. It utilizes the langchain library, which provides a set of classes and templates for generating code and tests using OpenAI's language models.
To get started with this project, follow these steps:
- Clone the repository to your local machine.
- Install the required dependencies by running
pip install -r requirements.txt. - Set up your environment by creating a
.envfile and adding any necessary environment variables. - Run the
main.pyscript with the desired command-line arguments.
The main.py script accepts the following command-line arguments:
--task: Specifies the task for which code and tests should be generated. Defaults to "return a list of numbers".--language: Specifies the programming language for which code and tests should be generated. Defaults to "python".
Example usage:
python main.py --task "calculate the factorial of a number" --language "java"The code generation process involves the following steps:
- Loading environment variables from the
.envfile. - Creating an instance of the
OpenAIclass from thelangchain.llmsmodule. - Defining prompt templates for generating code and tests using the
PromptTemplateclass from thelangchain.promptsmodule. - Creating instances of the
LLMChainclass from thelangchain.chainsmodule for generating code and tests. - Creating a
SequentialChaininstance that chains the code and test generation steps together. - Running the chain with the specified task and language to generate the code and tests.
- Printing the generated code and tests to the console.
Contributions to this project are welcome! If you find any issues or have any suggestions, please open an issue or submit a pull request.
This project is licensed under the terms of the MIT License. See the LICENSE file for more information.