Skip to content

rkbharti/PromptFlow_AI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PromptFlow AI 🧠🚀

PromptFlow AI is a high-performance, memory-optimized LLM orchestrator built with FastAPI and Gemini 2.5 Flash. It features a custom "Wisdom Layer" to handle long-term context retention while staying within the limits of free-tier infrastructure.

🌟 Key Features

  • Hierarchical Context Compression: Instead of passing massive chat histories, the system distills conversations into a "Wisdom Layer" (What, Why, and How), significantly reducing token usage.
  • Context Guardrails: Integrated intent-checking to prevent "context drift," ensuring the AI stays focused on the project mission (e.g., ShopEasy E-commerce).
  • Session Handoff: Generates a "Memory Anchor" at the end of every session, allowing the user to resume work the next day with 100% context alignment.
  • Concurrency-First Design: Uses Python's asyncio to handle Guardrails and Gemini processing in parallel for near-instant responses.
  • M0-Tier Optimized: Specifically tuned for MongoDB Atlas Free Tier with connection pooling and $slice operators to ensure zero lag.

🛠️ Tech Stack

  • Backend: FastAPI (Python 3.12+)
  • AI Engine: Gemini 2.5 Flash (via google-genai SDK)
  • Database: MongoDB Atlas (Motor Async Driver)
  • Safety: Custom NVIDIA-inspired Guardrail logic

🚀 Quick Start

Clone the repo:

git clone https://github.com/rkbharti/promptflow-ai.git
cd promptflow-ai

1️⃣ Create Virtual Environment

python -m venv venv

2️⃣ Activate Virtual Environment

  • ▶️ On Windows:
    venv\Scripts\activate
    
  • ▶️ On macOS / Linux:
    source venv/bin/activate
    

3️⃣ Verify Activation

After activation, you should see (venv) in your terminal:

(venv) your-project-folder>

4️⃣ Upgrade pip (Recommended)

pip install --upgrade pip

Setup Environment:

Create a .env file:

GOOGLE_API_KEY=your_gemini_api_key
MONGO_URI=your_mongodb_connection_string
PROJECT_NAME=PromptFlow_AI

Install Dependencies:

pip install -r requirements.txt

Run the Server:

uvicorn app.main:app --reload

📂 Architecture Note

The system employs a "Save Game" logic. When a session reaches a certain message threshold, the AI automatically summarizes the technical state into a compressed_context field in MongoDB. This ensures that the next request only needs the summary and the last few messages, keeping the system lightning-fast.

About

A memory-optimized AI orchestrator with Hierarchical Context Compression, Guardrails, and Session Handoff logic. Built with FastAPI & Gemini 2.5.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages