Skip to content

hyalen-caldeira/docwise

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DocWise

Intelligent Documentation Assistant — A production-ready RAG application that transforms any documentation into an interactive, context-aware knowledge base.

A RAG-powered documentation helper bot with conversational memory. Ingest documentation from any URL and query it using natural language with intelligent, context-aware responses.

Features

flowchart LR
    subgraph Features["DocWise Features"]
        A[Web Ingestion<br/>TavilyExtract / Crawl / Map]
        B[Vector Storage<br/>Chroma / Pinecone]
        C[Memory<br/>Context-aware]
        D[Chat UI<br/>Streamlit]
        E[RAG<br/>LangChain + OpenAIEmbeddings]
    end

    A --> B --> C --> D
    E -.-> A
    E -.-> B
    E -.-> C

    style Features fill:#1a1a1a,stroke:#fff,stroke-width:2px,color:#fff
    style A fill:#2d2d2d,stroke:#fff,stroke-width:2px,color:#fff
    style B fill:#2d2d2d,stroke:#fff,stroke-width:2px,color:#fff
    style C fill:#2d2d2d,stroke:#fff,stroke-width:2px,color:#fff
    style D fill:#2d2d2d,stroke:#fff,stroke-width:2px,color:#fff
    style E fill:#2d2d2d,stroke:#fff,stroke-width:2px,color:#fff
Loading

Technology Stack

flowchart TB
    subgraph Stack["Technology Stack"]
        subgraph AI["AI & ML"]
            LLM[GPT-4o-mini<br/>Response Generation]
            EMB[OpenAIEmbeddings<br/>text-embedding-ada-002]
        end

        subgraph Data["Data Layer"]
            CHR[Chroma<br/>Development]
            PIN[Pinecone<br/>Production]
            TAV[TavilyExtract/Crawl/Map<br/>Web Scraping]
        end

        subgraph Framework["Framework"]
            LC[LangChain<br/>RAG Orchestration]
            LS[LangSmith<br/>Observability]
        end

        subgraph App["Application"]
            ST[Streamlit<br/>Chat Interface]
            UV[UV<br/>Package Management]
        end
    end

    AI --> Framework
    Data --> Framework
    Framework --> App

    style Stack fill:#0d0d0d,stroke:#fff,stroke-width:2px,color:#fff
    style AI fill:#1a1a1a,stroke:#fff,stroke-width:2px,color:#fff
    style Data fill:#1a1a1a,stroke:#fff,stroke-width:2px,color:#fff
    style Framework fill:#1a1a1a,stroke:#fff,stroke-width:2px,color:#fff
    style App fill:#1a1a1a,stroke:#fff,stroke-width:2px,color:#fff
    style LLM fill:#2d2d2d,stroke:#fff,stroke-width:2px,color:#fff
    style EMB fill:#2d2d2d,stroke:#fff,stroke-width:2px,color:#fff
    style CHR fill:#2d2d2d,stroke:#fff,stroke-width:2px,color:#fff
    style PIN fill:#2d2d2d,stroke:#fff,stroke-width:2px,color:#fff
    style TAV fill:#2d2d2d,stroke:#fff,stroke-width:2px,color:#fff
    style LC fill:#2d2d2d,stroke:#fff,stroke-width:2px,color:#fff
    style LS fill:#2d2d2d,stroke:#fff,stroke-width:2px,color:#fff
    style ST fill:#2d2d2d,stroke:#fff,stroke-width:2px,color:#fff
    style UV fill:#2d2d2d,stroke:#fff,stroke-width:2px,color:#fff
Loading
Component Technology Purpose
LLM OpenAI GPT-4o-mini Response generation
Embeddings OpenAI text-embedding-ada-002 Semantic vector representations
Vector Store Chroma (dev) / Pinecone (prod) Embedding storage and retrieval
Web Scraping Tavily (default) + BeautifulSoup (fallback) Documentation ingestion
Framework LangChain RAG pipeline orchestration
Observability LangSmith Tracing, debugging, monitoring
UI Streamlit Interactive chat interface
Package Manager UV Fast, modern dependency management

Technology Descriptions

OpenAI GPT-4o-mini — A cost-effective, high-capability language model optimized for fast responses. Balances performance and cost for production RAG applications.

OpenAI text-embedding-ada-002 — OpenAI's second-generation embedding model producing 1536-dimensional vectors. Excels at semantic similarity and retrieval tasks.

Chroma — An open-source, AI-native embedding database. Runs locally with zero configuration, ideal for development and testing. Supports persistent storage and in-memory operation.

Pinecone — A managed vector database built for production AI applications. Provides low-latency similarity search at scale with automatic scaling and high availability.

Tavily — An AI-powered search API designed for LLM applications. Accessed via langchain-tavily for seamless LangChain integration. Used as the default loader with automatic BeautifulSoup fallback. The free tier provides 1,000 credits/month, sufficient for development. Key capabilities:

  • TavilyExtract — Extracts structured content from specific URLs (currently implemented)
  • TavilyCrawl — Crawls multiple pages from documentation sites (planned)
  • TavilyMap — Maps website structure to discover all relevant pages (planned)

BeautifulSoup — A Python library for parsing HTML/XML documents. Serves as an automatic fallback when Tavily fails or credits are exhausted. Also used for sitemap parsing. Provides free, unlimited web scraping without API dependencies.

LangChain — A framework for building LLM-powered applications. Provides abstractions for chains, retrievers, memory, and integrations with vector stores and LLMs.

LangSmith — An observability platform for LLM applications. Enables tracing, debugging, testing, and monitoring of LangChain pipelines in development and production.

Streamlit — A Python framework for building data applications and interactive dashboards. Creates web UIs with minimal code, ideal for ML/AI demos and tools.

UV — A fast Python package manager written in Rust. Provides 10-100x faster dependency resolution and installation compared to pip.

Retrieval Strategies

flowchart LR
    subgraph Strategies["Retrieval Pipeline"]
        direction LR
        SS[Similarity Search<br/>Dense Vectors]
        CR[Cascading Retrieval<br/>Dense + Sparse + Rerank]
        RQA[RetrievalQA Chain<br/>LangChain]
        MEM[LLM Memory<br/>Conversation Context]

        SS --> CR --> RQA --> MEM
    end

    style Strategies fill:#1a1a1a,stroke:#fff,stroke-width:2px,color:#fff
    style SS fill:#2d2d2d,stroke:#fff,stroke-width:2px,color:#fff
    style CR fill:#2d2d2d,stroke:#fff,stroke-width:2px,color:#fff
    style RQA fill:#2d2d2d,stroke:#fff,stroke-width:2px,color:#fff
    style MEM fill:#2d2d2d,stroke:#fff,stroke-width:2px,color:#fff
Loading
Strategy Description
Similarity Search Dense vector search using OpenAI embeddings for semantic matching
Cascading Retrieval Combines dense + sparse retrieval with reranking (up to 48% better performance)
RetrievalQA Chain LangChain's retrieval chain combining retriever + LLM + prompts
LLM Memory Conversation history for context-aware follow-up questions

Vector Store Strategy

DocWise supports dual vector store backends for optimal development and production workflows:

flowchart LR
    subgraph Strategy["Environment-Based Selection"]
        DEV[Development<br/>Chroma]
        PROD[Production<br/>Pinecone]
    end

    ENV{ENV?} --> |development| DEV
    ENV --> |production| PROD

    style Strategy fill:#1a1a1a,stroke:#fff,stroke-width:2px,color:#fff
    style DEV fill:#2d2d2d,stroke:#fff,stroke-width:2px,color:#fff
    style PROD fill:#2d2d2d,stroke:#fff,stroke-width:2px,color:#fff
    style ENV fill:#2d2d2d,stroke:#fff,stroke-width:2px,color:#fff
Loading
Store Best For Advantages
Chroma Development Local, free, fast iteration, offline capable, no API key needed
Pinecone Production Cloud-hosted, scalable, managed infrastructure, persistent

Web Scraping Strategy

DocWise uses a LangChain TavilyExtract-first approach with automatic fallback to BeautifulSoup for resilient document ingestion:

flowchart LR
    subgraph Strategy["Web Scraping Strategy"]
        TAV[Tavily API<br/>Default]
        BS[BeautifulSoup<br/>Fallback]
        CACHE[Local Cache<br/>Avoid Redundant Calls]
    end

    URL[URL] --> CACHE
    CACHE --> |miss| TAV
    TAV --> |fail| BS
    CACHE --> |hit| DOC[Document]
    TAV --> DOC
    BS --> DOC

    style Strategy fill:#1a1a1a,stroke:#fff,stroke-width:2px,color:#fff
    style TAV fill:#2d2d2d,stroke:#fff,stroke-width:2px,color:#fff
    style BS fill:#2d2d2d,stroke:#fff,stroke-width:2px,color:#fff
    style CACHE fill:#2d2d2d,stroke:#fff,stroke-width:2px,color:#fff
    style URL fill:#2d2d2d,stroke:#fff,stroke-width:2px,color:#fff
    style DOC fill:#2d2d2d,stroke:#fff,stroke-width:2px,color:#fff
Loading
Component Purpose Cost
TavilyExtract High-quality AI-powered extraction via langchain-tavily Free tier: 1,000 credits/month
BeautifulSoup Automatic fallback if Tavily fails or credits exhausted Free, unlimited
Caching Prevents redundant API calls; cached content never re-fetched Free

Observability with LangSmith

LangSmith provides comprehensive observability for the RAG pipeline, enabling debugging, performance monitoring, and prompt optimization.

flowchart LR
    subgraph LangSmith["LangSmith Observability"]
        TRACE[Trace Logging<br/>Chain Execution]
        DEBUG[Debugging<br/>Prompt Inspection]
        MONITOR[Monitoring<br/>Latency & Errors]
        EVAL[Evaluation<br/>Response Quality]
    end

    TRACE --> DEBUG --> MONITOR --> EVAL

    style LangSmith fill:#1a1a1a,stroke:#fff,stroke-width:2px,color:#fff
    style TRACE fill:#2d2d2d,stroke:#fff,stroke-width:2px,color:#fff
    style DEBUG fill:#2d2d2d,stroke:#fff,stroke-width:2px,color:#fff
    style MONITOR fill:#2d2d2d,stroke:#fff,stroke-width:2px,color:#fff
    style EVAL fill:#2d2d2d,stroke:#fff,stroke-width:2px,color:#fff
Loading
Capability Description
Trace Logging Full visibility into chain execution, token usage, and timing
Debugging Inspect prompts, retrieved documents, and LLM responses
Monitoring Track latency, error rates, and cost across all requests
Evaluation Assess response quality and retrieval accuracy

Setup

1. Install Dependencies

uv sync

2. Configure Environment Variables

cp .env.example .env

Edit .env and add your API keys:

Variable Required Description
OPENAI_API_KEY Yes OpenAI API key
TAVILY_API_KEY Yes Tavily API key
PINECONE_API_KEY Production Pinecone API key (not needed for development)
LANGCHAIN_API_KEY Optional LangSmith API key for observability

3. Create Pinecone Index (Production Only)

Create an index named docs-embeddings in your Pinecone console with:

  • Dimensions: 1536 (for OpenAI embeddings)
  • Metric: cosine

4. Run the Application

uv run streamlit run app.py

Project Structure

flowchart TB
    subgraph Root["docwise/"]
        APP[app.py<br/>Streamlit Application]

        subgraph SRC["src/"]
            ING[ingestion/<br/>Load → Split → Embed → Store]
            RET[retrieval/<br/>Query → RAG Chain]
            MEM[memory/<br/>Conversation History]
            UTL[utils/<br/>Configuration & Logging]
        end

        DAT[data/<br/>Local Storage]
        TST[tests/<br/>Unit Tests]
    end

    APP --> SRC
    SRC --> DAT

    style Root fill:#0d0d0d,stroke:#fff,stroke-width:2px,color:#fff
    style SRC fill:#1a1a1a,stroke:#fff,stroke-width:2px,color:#fff
    style APP fill:#2d2d2d,stroke:#fff,stroke-width:2px,color:#fff
    style ING fill:#2d2d2d,stroke:#fff,stroke-width:2px,color:#fff
    style RET fill:#2d2d2d,stroke:#fff,stroke-width:2px,color:#fff
    style MEM fill:#2d2d2d,stroke:#fff,stroke-width:2px,color:#fff
    style UTL fill:#2d2d2d,stroke:#fff,stroke-width:2px,color:#fff
    style DAT fill:#2d2d2d,stroke:#fff,stroke-width:2px,color:#fff
    style TST fill:#2d2d2d,stroke:#fff,stroke-width:2px,color:#fff
Loading

Usage

flowchart LR
    subgraph Usage["Usage Flow"]
        direction LR
        A[Start App] --> B[Enter URL]
        B --> C[Ingest Docs]
        C --> D[Ask Questions]
        D --> E[Get Answers<br/>with Context]
        E --> D
    end

    style Usage fill:#1a1a1a,stroke:#fff,stroke-width:2px,color:#fff
    style A fill:#2d2d2d,stroke:#fff,stroke-width:2px,color:#fff
    style B fill:#2d2d2d,stroke:#fff,stroke-width:2px,color:#fff
    style C fill:#2d2d2d,stroke:#fff,stroke-width:2px,color:#fff
    style D fill:#2d2d2d,stroke:#fff,stroke-width:2px,color:#fff
    style E fill:#2d2d2d,stroke:#fff,stroke-width:2px,color:#fff
Loading

Documentation

License

MIT

Author

Hyalen Caldeira


Built with Cursor + Claude Code

About

RAG-powered documentation assistant with conversational memory. Built with LangChain, Pinecone, and Streamlit.

Topics

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages