Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/Jatin-Mehra119/PDF-Insight-Beta/llms.txt

Use this file to discover all available pages before exploring further.

PDF Insight Pro’s runtime behaviour is governed by two complementary layers: environment variables loaded at startup via python-dotenv, and the Config class defined in configs/config.py. Environment variables supply secrets and external-service credentials, while the Config class centralises every tuneable constant — from chunk sizes and FAISS index parameters to agent iteration limits and Tavily search depth. You can override Config values by editing configs/config.py directly, or you can supply the API-key variables exclusively through a .env file placed in the project root.

Environment Variables

GROQ_API_KEY
string
required
Your Groq API key, used to authenticate all LLM inference requests. Obtain one at console.groq.com. The server will raise a GROQ_API_KEY is not set for Groq Llama models error on any chat request if this variable is absent or empty.
TAVILY_API_KEY
string
Your Tavily API key, required only when use_search: true is passed in a /chat request. If the variable is not set, web-search augmentation is silently disabled and the agent falls back to document-only retrieval. Obtain a key at app.tavily.com.

Application Settings

Core file-handling and model defaults read directly from the Config class.
SettingValueDescription
UPLOAD_DIRuploadsDirectory where uploaded PDFs and serialised session files are stored. Created automatically on startup if it does not exist.
MAX_FILE_SIZE50 MBMaximum accepted PDF file size (50 × 1024 × 1024 bytes). Requests exceeding this limit are rejected before processing begins.
DEFAULT_MODELllama-3.1-8b-instantGroq model used when no model_name is supplied in the /upload-pdf form body.
EMBEDDING_MODELBAAI/bge-large-en-v1.5Sentence-Transformers model used to generate dense embeddings for every document chunk and every incoming query.

Text Processing

Controls how extracted PDF text is split into chunks before embedding.
SettingValueDescription
DEFAULT_CHUNK_SIZE1000Target number of tokens per chunk. Longer passages are split at this boundary.
MIN_CHUNK_LENGTH20Minimum character length for a chunk to be retained. Shorter chunks are discarded as noise.
MIN_PARAGRAPH_LENGTH10Minimum character length for an individual paragraph to be kept during the paragraph-split stage.

RAG Parameters

These settings govern how the retrieval-augmented generation pipeline selects and assembles context for the LLM.
SettingValueDescription
DEFAULT_K_CHUNKS10Number of nearest-neighbour chunks retrieved from the FAISS index per query.
INITIAL_CONTEXT_CHUNKS5Number of top-ranked chunks included in the initial context window before agent reasoning begins.
MAX_CONTEXT_TOKENS7000Hard token ceiling on the assembled context passed to the LLM. Chunks are dropped from the tail if this limit is exceeded.
SIMILARITY_THRESHOLD1.5Maximum L2 distance (FAISS metric) for a chunk to be considered relevant. Chunks with a score above this threshold are filtered out.
LLM_TEMPERATURE0.1Sampling temperature for LLM generation. Lower values produce more deterministic, factual responses.
MAX_TOKENS4500Maximum number of tokens the LLM is allowed to generate in a single response.

FAISS Index

Hyperparameters for the HNSW (Hierarchical Navigable Small World) index built over document chunk embeddings.
SettingValueDescription
FAISS_NEIGHBORS32Number of bi-directional links per node in the HNSW graph (M parameter). Higher values improve recall at the cost of memory.
FAISS_EF_CONSTRUCTION200Size of the dynamic candidate list during index construction. Higher values yield a more accurate index but slower builds.
FAISS_EF_SEARCH50Size of the dynamic candidate list at query time. Increase for higher recall; decrease for lower latency.

Agent

Configuration for the LangChain tool-calling agent that orchestrates retrieval and optional web search.
SettingValueDescription
AGENT_MAX_ITERATIONS2Maximum number of reasoning-and-action cycles the agent may execute before returning a final answer.
AGENT_VERBOSEfalseWhen true, LangChain prints every agent thought, action, and observation to stdout — useful for debugging but noisy in production.
Parameters passed to the Tavily Search API whenever use_search: true is set on a chat request.
SettingValueDescription
TAVILY_MAX_RESULTS5Maximum number of web search results to retrieve per query.
TAVILY_SEARCH_DEPTHadvancedSearch depth mode. advanced instructs Tavily to perform a deeper, more thorough crawl compared to basic.
TAVILY_INCLUDE_ANSWERtrueWhen true, Tavily returns its own AI-generated answer summary alongside raw results.
TAVILY_INCLUDE_RAW_CONTENTfalseWhen true, the full raw HTML content of each result page is included in the response. Disabled by default to reduce payload size.

Available Models

The following models are registered in ModelConfig.AVAILABLE_MODELS and can be specified via the model_name field in both /upload-pdf and /chat requests.
Model IDDisplay Name
meta-llama/llama-4-scout-17b-16e-instructLlama 4 Scout 17B
llama-3.1-8b-instantLlama 3.1 8B Instant
llama-3.3-70b-versatileLlama 3.3 70B Versatile
openai/gpt-oss-120bGPT-OSS 120B
For fast, low-latency responses on straightforward factual queries, prefer Llama 3.1 8B Instant (llama-3.1-8b-instant) — it is the default and the quickest to respond. For complex multi-step reasoning, detailed summarisation, or nuanced analytical questions, upgrade to Llama 3.3 70B Versatile (llama-3.3-70b-versatile) for noticeably deeper answers.

Sample .env File

# .env — place this file in the project root (never commit to source control)

# Required: Groq API key for LLM inference
GROQ_API_KEY=gsk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

# Optional: Tavily API key for web-search augmentation
# Remove or leave blank to disable the use_search feature
TAVILY_API_KEY=tvly-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Build docs developers (and LLMs) love