Skip to content

urvashivankar/prompt-refinement-system

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Prompt Refinement System

A modular Python system designed to convert unstructured multi-modal inputs (text, documents, images) into a standardized, structured prompt suitable for downstream AI processing.

Frontend Preview

🚀 Features

  • Structured Output: Converts messy inputs into a strict JSON schema.
  • Multi-Modal Logic: Handles Text, Document (PDF/DOCX), and Image (Stub) inputs via specialized extractors.
  • Validation & Refinement: Rejects bad inputs and cleans up accepted ones.
  • Confidence Scoring: Assigns a score (0.0-1.0) based on input completeness.
  • Extensible API: Built with FastAPI.
  • Ruthless Mode: Aggressively filters conversational noise for clean engineering data.

📂 Project Structure

prompt-refinement-system/
├── src/                        # Core Application Source
│   ├── api.py                  # FastAPI Entry Point
│   ├── extraction/             # Modular Extractors (Text, Doc, Image)
│   ├── refinement_engine/      # Business Logic (Normalization & Scoring)
│   └── validation/             # Input Gatekeepers
├── frontend/                   # React + Vite UI
│   ├── src/
│   ├── public/
│   └── package.json
├── samples/                    # Demo Data
│   ├── input_examples/         # Raw Inputs (Upload these!)
│   │   ├── enterprise_spec_v2.docx
│   │   ├── email_dump.txt
│   │   └── sample_mockup.png
│   └── output_examples/        # Refined JSON results (Added!)
│       ├── enterprise_spec_v2_refined.json
│       ├── email_dump_refined.json
│       └── ... (and more)
├── scripts/                    # Utility Scripts
│   └── generate_samples.py     
├── tests/                      # Pytest Suite
│   └── test_backend.py
├── docs/                       # Architectural Documentation
├── requirements.txt            # Python Dependencies
└── README.md                   # You are here

🛠️ Usage

1. Installation

pip install -r requirements.txt

2. Running Tests

Run the end-to-end verification script:

python test_system.py

3. Running the API Server

Start the FastAPI server:

uvicorn src.api:app --reload

The API will be available at http://127.0.0.1:8000. You can access the interactive Swagger UI at http://127.0.0.1:8000/docs.

4. Sample Request

POST /refine

{
  "inputs": [
    {
      "type": "text",
      "content": "I need a website for my bakery. It must have a contact form and a gallery."
    }
  ]
}

5. Running the Frontend Demo

The project includes a React-based demo interface.

  1. Navigate to the frontend directory:
    cd frontend
  2. Install dependencies:
    npm install
  3. Run the dev server:
    npm run dev
  4. Open http://localhost:5173 in your browser.

🧠 Design Philosophy

For a deep dive into the architectural decisions and schema design, check out:

About

AI-powered Prompt Refinement System that enhances user inputs using NLP and LLM-based techniques, enabling structured, optimized, and context-aware prompts for better AI responses.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors