$ show melih-unsal/DemoGPT
DemoGPT is an open-source Python framework that provides two core capabilities: (1) an automatic Streamlit application generator that converts natural language descriptions into complete, runnable Streamlit apps through a multi-stage LLM pipeline (planning, task decomposition, code generation, assembly), and (2) the DemoGPT AgentHub, a modular library for building AI agents with built-in tools (web search, code execution, Wikipedia, weather, etc.), two agent types (ToolCallingAgent for single-step tasks, ReactAgent for multi-step reasoning), and a RAG (Retrieval Augmented Generation) system supporting Chroma, FAISS, and Pinecone vector stores. The codebase is primarily a library/application hybrid, with the Streamlit app acting as both a user interface and a demonstration of the generation pipeline. The architecture separates concerns into chains, prompts, task definitions, and controllers, but many components are tightly coupled to the specific generation pipeline. The AgentHub portion is more modular and reusable. Technical drift is medium: the code uses deprecated LangChain APIs (LLMChain, Chain.run), hardcodes older models like gpt-3.5-turbo-16k in some generated code, and has a broad dependency range. Maintenance appears active with recent commits and responsive issue triage, but the codebase would benefit from modernizing to LangChain's new LCEL syntax and updating default models.
The LLM identified 5 files worth highlighting for reuse:
Provides a clean, reusable RAG (Retrieval Augmented Generation) implementation. Supports multiple vector stores (Chroma, FAISS, Pinecone), multiple embedding models (local HuggingFace or OpenAI), and multiple document loaders (PDF, TXT, CSV, JSON, URLs). The class can be instantiated with a few parameters and used directly or as a tool within agents. The design separates embedding model loading, vector store initialization, document ingestion, and retrieval-augmented generation into clear methods, making it easy to extract and reuse in other projects with minimal adaptation.
Defines the abstract BaseAgent class that implements a generic tool-deciding and answer-synthesis loop. It uses LangChain's LCEL (LangChain Expression Language) to compose prompts and output parsers, separating concerns into tool decider, success decider, and final answer prompts. This base class is inherited by both ToolCallingAgent and ReactAgent, demonstrating a clean template method pattern. The class handles tool explanations, history management, and pretty-printing, making it a solid foundation for building custom agent types.
An example of a well-structured custom tool that wraps the Ultralytics YOLO model for object detection. It demonstrates the standard pattern: extend BaseTool, set name and description, implement run() method with parameterized input. The implementation includes error handling (missing ultralytics package), uses defaultdict for counting objects, and returns a structured textual description of detected objects with bounding box coordinates. This tool can be extracted and used in any agent framework that expects a run() interface.
Implements validation logic for task plans and task lists generated by the LLM pipeline. It checks for redundant tasks, input/output compatibility, data type consistency, and app-type constraints (chat, search, summarization). The functions are modular (checkTaskNames, checkRedundantTasks, checkInputOutputCompatibility, etc.) and can be reused in other code generation systems that need to validate a directed graph of tasks with typed inputs and outputs. The planToTaskFormat parser converts a structured plan string into a list of task dictionaries, which is a generic parsing utility.
Contains utility functions for generating Streamlit code from task definitions, including prompt template validation (checkPromptTemplates) that ensures all input variables appear in templates and no extra variables are present. The functions getCodeSnippet and getCodeSnippetSeperate route tasks to the appropriate code generator. The separateCode function splits code into imports, functions, and remaining code using regex, which is useful for modular code assembly. The reorderTasksForChatApp function reorders tasks for chat applications, demonstrating a graph traversal pattern.