GithubHelp home page GithubHelp logo

melih-unsal / demogpt Goto Github PK

View Code? Open in Web Editor NEW
1.6K 15.0 186.0 25.43 MB

Create 🦜️🔗 LangChain apps by just using prompts🌟 Star to support our work! | 只需使用句子即可创建 LangChain 应用程序。 给个star支持我们的工作吧!

Home Page: https://demogpt.io/

License: MIT License

Python 99.98% Shell 0.02%
chatgpt demo langchain llms streamlit streamlit-application chatgpt-api gpt3-turbo langchain-python langchain-app

demogpt's Introduction

favicon DemoGPT: Autonomous AI Agent for Effortless App Creation 🚀

DemoGPT logo: Generate automatic LangChain pipelines

⚡ With just a prompt, you can create interactive Streamlit apps via 🦜️🔗 LangChain's transformative capabilities.⚡

Downloads Releases Official Website DemoGPT Documentation

CN doc EN doc roadmap roadmap License: MIT

Open an issue Closed issues DemoGPT  Stars

Twitter Follow DemoGPT Medium DemoGPT - Auto generative AI app generator with the power of Llama 2 | Product Hunt

Streamlit application

⭐ Star History

Star History Chart

⭐ Consider starring us if you're using DemoGPT so more people hear about us!

🔥 Demo

For quick demo, you can visit our website

Tweet Generator

📚 Documentation

See our documentation site here for full how-to docs and guidelines

⚡ With DemoGPT v1.3, API usage will be possible with the power of Gorilla within 2 weeks. After this release, you will be able use external APIs autonomously. ⚡

📦 Using DemoGPT Package

The DemoGPT package is now available and can be installed using pip. Run the following command to install the package:

pip install demogpt

To use the DemoGPT application, simply type "demogpt" into your terminal:

demogpt

📑 Table of Contents

📌 Introduction

Welcome to DemoGPT, a revolutionary open-source initiative that is reshaping the landscape of Large Language Model (LLM) based application development.

At the heart of DemoGPT, the capabilities of GPT-3.5-turbo come to life, driving the automatic generation of LangChain code. This process is enriched with a sophisticated architecture that translates user instructions into interactive Streamlit applications.

How DemoGPT Works

  1. Planning: DemoGPT starts by generating a plan from the user's instruction.
  2. Task Creation: It then creates specific tasks from the plan and instruction.
  3. Code Snippet Generation: These tasks are transferred into code snippets.
  4. Final Code Assembly: The code snippets are combined into a final code, resulting in an interactive Streamlit app.

The LangChain code, once generated, is not a mere endpoint but a transformative stage. It evolves into a user-friendly Streamlit application, adding an interactive dimension to the logic crafted. This metamorphosis embodies DemoGPT's commitment to user engagement and experience.

Future Enhancements

We are planning to add a publicly available database that will accelerate the generation process by retrieving similar examples during the refining process. This innovation will further streamline the development workflow, making it more efficient and responsive.

Model Flexibility

DemoGPT is designed to be adaptable, capable of using any LLM model that meets specific performance criteria in terms of code generation. This flexibility ensures that DemoGPT remains at the forefront of technology, embracing new advancements in LLM.

DemoGPT's iterative development process remains a cornerstone of its innovation. Each code segment undergoes individual testing, and the self-refining strategy ensures an efficient and error-minimized workflow. This fusion of meticulous testing and refinement is a testament to DemoGPT's pursuit of excellence.

By transcending traditional coding paradigms, DemoGPT is pioneering a new era in LLM-based applications. It's not just about code generation; it's about crafting intelligent, interactive, and inclusive solutions.

In summary, DemoGPT is more than a project; it's a visionary approach, pushing the boundaries of what's possible in LLM-based application development.

In the next release, we are gonna integrate Gorilla to DemoGPT to enable DemoGPT to use external APIs autonomously. The future is bright, and the journey has just begun. Join us in this exciting adventure!

⚙️ Architecture

DemoGPT Architecture

DemoGPT Architecture

🔧 Installation

For the Package Version

You can install the DemoGPT package by running the following command:

pip install demogpt

For the Source Code Version

  1. Clone the repository:
    git clone https://github.com/melih-unsal/DemoGPT.git
  2. Navigate into the project directory:
    cd DemoGPT
  3. Install DemoGPT:
    pip install .

🎮 Usage

📦 For the Package Version

Once the DemoGPT package is installed, you can use it by running the following command in your terminal:

demogpt

🐍 For the Python Interface

You can now use DemoGPT as a library in your Python applications:

from demogpt import DemoGPT
agent = DemoGPT(model_name="gpt-3.5-turbo") # if OPENAI_API_KEY is not set in env variables, put it with openai_api_key argument
instruction = "Your instruction here"
title = "Your title here"
code = ""
for phase in agent(instruction=instruction, title=title):
    print(phase) # this will display the resulting json for each generation stage
    if phase["done"]:
        code = phase["code"] # final code
print(code)

Example Output (truncated):

# phases
{'stage': 'draft', 'completed': False, 'percentage': 60, ...}
{'stage': 'draft', 'completed': False, 'percentage': 64, 'code': '#Get the source language ...'}
...
{'stage': 'final', 'completed': True, 'percentage': 100, ... , 'code': 'import streamlit as st\n...'}
# Code
import streamlit as st
from langchain.chains import LLMChain
from langchain.chat_models import ChatOpenAI
from langchain.prompts.chat import (ChatPromptTemplate,
                                    HumanMessagePromptTemplate,
                                    SystemMessagePromptTemplate)
...

🌐 For the Source Code Version

If you have cloned the repository and wish to run the source code version, you can use DemoGPT by running the following command:

streamlit run demogpt/app.py

To-Do 📝

  • Implement new DemoGPT pipeline including plan generation, task creation, code snippet generation, and final code assembly.
  • Add feature to allow users to select models.
  • Define useful LangChain tasks
  • Publish release with the new pipeline without refinement
  • Implement remaining LangChain tasks
  • Implement self-refining strategy for model response refinement.
  • Integrate 🦍 Gorilla model for API calls.
  • Add Rapid API for expanding available API calls.
  • Add 🦙 Llama2 integration
  • Implement publicly available database to accelerate the generation process by retrieving similar examples during the refining process.
  • Add all successfully generated steps to a DB to eliminate redundant refinement.

🤝 Contribute

Contributions to the DemoGPT project are welcomed! Whether you're fixing bugs, improving the documentation, or proposing new features, your efforts are highly appreciated. Please check the open issues before starting any work.

Please read CONTRIBUTING for details on our CODE OF CONDUCT, and the process for submitting pull requests to us.

📄 Citations

DemoGPT has been referenced in various research papers for its innovative approach to app creation using autonomous AI agents. Below is a list of papers that have cited DemoGPT:

  • Lei Wang, Chen Ma , Xueyang Feng , Zeyu Zhang, Hao Yang, Jingsen Zhang, Zhiyuan Chen, Jiakai Tang, Xu Chen, Yankai Lin, Wayne Xin , Zhao, Zhewei Wei, Ji-Rong Wen, "A Survey on Large Language Model based Autonomous Agents", 2023. Link to paper
  • Yuan Li, Yixuan Zhang, Lichao Sun, "METAAGENTS: SIMULATING INTERACTIONS OF HUMAN BEHAVIORS FOR LLM-BASED TASK-ORIENTED COORDINATION VIA COLLABORATIVE GENERATIVE AGENTS" Journal/Conference, 2023. Link to paper
  • Yuheng Cheng, Ceyao Zhang, Zhengwen Zhang, Xiangrui Meng, Sirui Hong, Wenhao Li, Zihao Wang, Zekai Wang, Feng Yin, Junhua Zhao, Xiuqiang He, "EXPLORING LARGE LANGUAGE MODEL BASED INTELLIGENT AGENTS: DEFINITIONS, METHODS, AND PROSPECTS", 2024. Link to paper

This acknowledgment from the academic community highlights the potential and utility of DemoGPT in advancing the field of AI-driven development tools.

📜 License

DemoGPT is an open-source project licensed under MIT License.


For any issues, questions, or comments, please feel free to contact us or open an issue. We appreciate your feedback to make DemoGPT better.

demogpt's People

Contributors

abdrrman avatar bharathmuthineni avatar melih-unsal avatar zhihuij avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

demogpt's Issues

UnicodeEncodeError when writing to temporary file on Windows with Python 3.10 or 3.11

Describe the bug
When running DemoGPT on a Windows machine with a Python version 3.11, a UnicodeEncodeError is thrown. The error occurs when the application attempts to write to a temporary file using the tmp.write(code) function in run_code and run_python methods. The problem seems to stem from the code containing Unicode characters which are not supported by the default encoding of the temporary file.

To Reproduce
Steps to reproduce the behavior:
Install Python 3.10 or 3.11 (tried with both) on a Windows 10 machine.
Clone the DemoGPT repository.
Create a virtual environment and install the required libraries as indicated in the project README.
Execute the DemoGPT application with streamlit run src/prompt_based/app.py.
See error.

Expected behavior
The DemoGPT application should be able to handle Unicode characters in the code without throwing a UnicodeEncodeError.

Screenshots
The trace appeared on the app after failing, but could not make it appear again.

Support for custom open-ai base url

Is your feature request related to a problem? Please describe.
Whenever, I would like to use a custom openAI base url such as Azure openAI or my openAI proxy, there is no option for that. DemoGPT should be able to support custom base url for openAI

Describe the solution you'd like
Similar to the openai API key, there should be an option to provide the open AI base url.

export the code

Amazing project and Idea!! would love to know how can I export the code
that was generated into an app, and continue developing it....

Running the App produces the error 'which python' returned non-zero exit status 1.

Describe the bug
Running the App produces the error 'which python' returned non-zero exit status 1. Using windows 10, all dependencies are installed

To Reproduce
Steps to reproduce the behavior:

  1. Launch the streamlit app
  2. Under Examples click 'Language Translator

Expected behavior
The app should generate a streamlit application as shown in the demo

Issue
Running the App produces the error 'which python' returned non-zero exit status 1.

Desktop (please complete the following information):

  • OS: Windows 10
  • Browser: Chrome

Additional context
Do I need to create a new environment, also please add other required packages in the requiremets.txt file

Dependencies need upgrading

Describe the bug
When cloning and running streamlit run src/prompt_based/app.py Streamlit complains about `ModuleNotFoundError: No module named 'altair.vegalite.v4'

To Reproduce
Steps to reproduce the behavior:

  1. Clone
  2. Install requirements.txt
  3. run streamlit run src/prompt_based/app.py

Expected behavior
N/A

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context
Issue seems to be to add altair>=4.0
https://discuss.streamlit.io/t/modulenotfounderror-no-module-named-altair-vegalite-v4/42921/2

TypeError for path

Describe the bug
I am using DemoGPT on MAC, and ran into TypeError once I submitted.

To Reproduce
Steps to reproduce the behavior:

  1. On terminal, run app with command streamlit run app.py
  2. Click on the example Language Translator
  3. Click submit button
  4. See error

Error Message
Language Translator 📝 2023-07-03 17:26:34.783 Uncaught app exception Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 552, in _run_script exec(code, module.__dict__) File "/Users/mchuang/Desktop/Testing tools/DemoGPT/src/prompt_based/app.py", line 67, in <module> for data in generate_response(demo_idea): File "/Users/mchuang/Desktop/Testing tools/DemoGPT/src/prompt_based/app.py", line 16, in generate_response for data in agent(txt,num_of_iterations): File "/Users/mchuang/Desktop/Testing tools/DemoGPT/src/prompt_based/model.py", line 69, in __call__ response, error = self.run_python(total_code) File "/Users/mchuang/Desktop/Testing tools/DemoGPT/src/prompt_based/model.py", line 35, in run_python process = subprocess.Popen([python_path,tmp.name], env=environmental_variables,stdout=PIPE, stderr=PIPE) File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/subprocess.py", line 966, in __init__ self._execute_child(args, executable, preexec_fn, close_fds, File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/subprocess.py", line 1717, in _execute_child and os.path.dirname(executable) File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/posixpath.py", line 152, in dirname p = os.fspath(p) TypeError: expected str, bytes or os.PathLike object, not NoneType

Screenshots
image

Desktop (please complete the following information):

  • OS: macOS Monterey ver.12.3.1
  • Browser: Chrome
  • Version: 114.0.5735.106

make model name configurable

the home page is reading model list from hardcoded list ,maybe add a configurable way for user to suit for the newest model

Compatibility with LangFlow & Flowise

I've yet to experiment fully with DemoGPT, but I would love to see this tool integrated into LangFlow or Flowise one day. Would be great to see the visualization of the steps, complementing the code generated.

Invalid OpenAI API Key

Hi,

I keep getting this error message: Invalid OpenAI API Key, even after i've created a brand new key,
when I try to get it to run locally, or in the browser (chrome, edge), using windows 10, python 3.12.
do I need a Plus or Enterprise account with OPENAI to get this to work?

Thanks,

Hope to get in touch

Dear DemoGPT developer,
Greetings! I am Jimmy, a community developer and volunteer at InternLM. Your work has been immensely beneficial to me, and I believe it can be effectively utilized in InternLM as well. Welcome to add Discord https://discord.gg/gF9ezcmtM3 . I hope to get in touch with you.

Best regards,
Jimmy

Local LLM as backend for DemoGPT agent

Is your feature request related to a problem? Please describe.
Using local LLMs instead than OpenAI API as backend

Describe the solution you'd like
Create a DemoGPT agent from a locally available model (ideally, a quantized Llama2 model via llama-cpp-python

Describe alternatives you've considered
If that' s already possible, a guide or some instruction about how to do it would be greatly appreciated!

Additional context
NA

Hardcoded paths

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Run the streamlit app with an idea submitted.

Expected behavior
A demo app is produced

Desktop (please complete the following information):

  • Windows 11
  • Streamlit
  • Edge

Additional context
It appears there are some hardcoded paths unique to the original development environment. For example:
FileNotFoundError: [Errno 2] No such file or directory: '/home/melih/anaconda3/envs/synthdata/bin/streamlit'

Delete the incorrect contact information in the project

Describe the bug
There is a wechat QR code in the folder “docs/resources/”.
I added him on wechat. He's a developer of the project “MetaGPT”.
Whether forget to delete this file when copying the code from MetaGPT.
It is recommended to delete this file and note if the MetaGPT project is referenced

[Windows] Missing dotenv module

Describe the bug
Following a fresh installation in new virtual environment with Python 3.10.11, I'm getting ModuleNotFoundError for termcolor. After installing termcolor with pip, I then get ModuleNotFoundError for dotenv. Unfortunately, I've been unable to install dotenv with pip or with 'pip install dotenv' or 'pip install --use-pep517 dotenv'

To Reproduce
Steps to reproduce the behavior:

  1. Create a new virtual env with python 3.10
  2. git clone https://github.com/melih-unsal/DemoGPT.git
  3. cd DemoGPT
  4. pip install -r requirements.txt
  5. cd src/prompt_based
  6. streamlit run app.py

Expected behavior
Streamlit inititates successfully

Screenshots
image

Desktop (please complete the following information):

  • OS: Windows 11
  • Browser: Firefox
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

The .env file seems not working

Describe the bug

To Reproduce
Steps to reproduce the behavior:

  1. put .env file into the current folder
  2. run demogpt
  3. goto the webpage and type name and description for the app and submit.
  4. "please enter the openai api key"

Expected behavior
in the .env file I changed the "OPENAI_API_BASE" and specified the 'OPENAI_API_KEY', so when clicked on submit, it should directly call the llm

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.