Skip to content

heybash2/langchain-coder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cover_logo

This is LangChain Coder, a Streamlit app that utilizes LangChain and OpenAI's GPT-3 to generate code. It supports 12 different programming languages: Python, C, C++,C#,Go, Javascript and more.
With this app, you can Generate code and Run it locally, providing an alternative to the OpenAI Code Interpreter Plugin. And this can also Save Code localy to a file for later use.

  • Support this Project

LangChain Coder

WebUI - Application showcase.

This is the main screen of the application. It has a text input for the prompt, a dropdown menu for selecting the programming language, and three buttons: Generate Code, Run Code, and Save Code.
main_screen_ui

This is the screen after code generation. It displays the generated code.
generated_code_ui

Requirements

This app requires the following libraries:

  • streamlit
  • langchain
  • openai
  • dotenv

This app requres compiler for following languages:

Getting Started

To use this tool, follow these steps:

  1. Clone this repository to your local machine.
  2. Navigate to the project directory.
  3. Install the required packages using the following command:

pip install -r requirements.txt

  1. To generate code you need OpenAI API key
    You can set the API key as an environment variable using the following command:

export OPENAI_API_KEY=<your API key>

For Windows, use the following command instead:

set OPENAI_API_KEY=<your API key> 5. To run the program, execute the following command:

streamlit run LangChain-Coder.py

Features:

  • Code Generation: LangChain Coder generates code by utilizing LangChain and OpenAI's GPT-3. It prompts the user for a description of the code they want to generate and the programming language they want to use. The app then generates the code based on the prompt and returns it to the user.

  • Code Execution: LangChain Coder can execute the code locally. Once the code has been generated, the user can click on the Run Code button to execute it. The app will display the output of the code execution.

  • Code Saving: LangChain Coder also provides the option to save the generated code to a file. To save the code, enter a filename in the text input and click on the Save Code button.

  • Multiple Programming Languages: LangChain Coder supports four different programming languages: Python, C, C++, and Javascript.

  • Offline and Online Compiler : LangChain Coder supports both offline and online compiler for all the languages. for Online compiler it uses JDoodle Web Widget which provides a web widget that can be embedded in a web page or used in an iframe. It allows users to compile and run code online in more than 70 programming languages.

Usage

To use LangChain Coder, follow these steps:

  1. Enter a prompt to Generate the code.
  2. Select the programming language you want to use.
  3. Click on the Generate Code button to generate the code.
  4. If you want to run the code, click on the Run Code button.
  5. If you want to save the code to a file, enter a filename and click on the Save Code button.

Demo Usage.

Demo

Author

This app was created by HeavenHM.

About

Web Application that can generate code and fix bugs and run using various LLM's (GPT,Gemini,PALM)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 99.3%
  • Other 0.7%