Back to .md Directory

CmdSmith Project Log

**Goal:** Build a "Fill-in-the-Blank" CLI generator for researchers using RAG (Documentation) and LLMs (Structured Outputs).

May 2, 2026
0 downloads
0 views
ai llm rag prompt openai workflow
View source

CmdSmith Project Log

Goal: Build a "Fill-in-the-Blank" CLI generator for researchers using RAG (Documentation) and LLMs (Structured Outputs). Stack: Python (FastAPI), LangChain (RAG), ChromaDB (Vector Store), OpenAI GPT-5.1/Local LLM, HTML/JS (Frontend).


1. Initial Setup

A. Project Folder & Virtual Environment

Never install libraries globally. We use a contained venv.

# 1. Create virtual environment
python3 -m venv venv

# 2. Activate the environment
source venv/bin/activate

B. Dependencies

Install them:

pip install -r requirements.txt

C. API Keys

Create a file named .env in the project root:

OPENAI_API_KEY=sk-api-key

2. Code Implementation

A. The Ingestion Script (ingest.py)

Purpose: Reads PDF/TXT manuals and saves them to ./vector_db.

B. The Backend (main.py)

Purpose: API that takes user input, retrieves docs, and returns structured JSON. Key Feature: Uses specialized system prompt and Strict JSON Schema.

C. The Frontend (index.html)

  • Use the "Dark Mode" theme.

3. Workflow: How to Update Documentation

  1. Find Manual: Save the tool's manual as a PDF (e.g., samtools.pdf).
  2. Place: Put it in the docs/ folder.
  3. Alternatively, scrape command descriptions using scrape.py.
  4. Run Ingest:
    source venv/bin/activate
    python ingest.py
    
    This updates the vector_db folder.

4. Usage: Running the Tool

  1. Open Terminal and go to project folder.
  2. Activate Environment:
    source venv/bin/activate
    
  3. Start Backend:
    python main.py
    
    (Wait for "Application startup complete")
  4. Start Frontend:
    • Open index.html in web browser (Chrome/Safari).
  5. Use:
    • Start chatting

Related Documents