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
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.
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.
| Setting | Value | Description |
|---|
UPLOAD_DIR | uploads | Directory where uploaded PDFs and serialised session files are stored. Created automatically on startup if it does not exist. |
MAX_FILE_SIZE | 50 MB | Maximum accepted PDF file size (50 × 1024 × 1024 bytes). Requests exceeding this limit are rejected before processing begins. |
DEFAULT_MODEL | llama-3.1-8b-instant | Groq model used when no model_name is supplied in the /upload-pdf form body. |
EMBEDDING_MODEL | BAAI/bge-large-en-v1.5 | Sentence-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.
| Setting | Value | Description |
|---|
DEFAULT_CHUNK_SIZE | 1000 | Target number of tokens per chunk. Longer passages are split at this boundary. |
MIN_CHUNK_LENGTH | 20 | Minimum character length for a chunk to be retained. Shorter chunks are discarded as noise. |
MIN_PARAGRAPH_LENGTH | 10 | Minimum 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.
| Setting | Value | Description |
|---|
DEFAULT_K_CHUNKS | 10 | Number of nearest-neighbour chunks retrieved from the FAISS index per query. |
INITIAL_CONTEXT_CHUNKS | 5 | Number of top-ranked chunks included in the initial context window before agent reasoning begins. |
MAX_CONTEXT_TOKENS | 7000 | Hard token ceiling on the assembled context passed to the LLM. Chunks are dropped from the tail if this limit is exceeded. |
SIMILARITY_THRESHOLD | 1.5 | Maximum L2 distance (FAISS metric) for a chunk to be considered relevant. Chunks with a score above this threshold are filtered out. |
LLM_TEMPERATURE | 0.1 | Sampling temperature for LLM generation. Lower values produce more deterministic, factual responses. |
MAX_TOKENS | 4500 | Maximum 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.
| Setting | Value | Description |
|---|
FAISS_NEIGHBORS | 32 | Number of bi-directional links per node in the HNSW graph (M parameter). Higher values improve recall at the cost of memory. |
FAISS_EF_CONSTRUCTION | 200 | Size of the dynamic candidate list during index construction. Higher values yield a more accurate index but slower builds. |
FAISS_EF_SEARCH | 50 | Size 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.
| Setting | Value | Description |
|---|
AGENT_MAX_ITERATIONS | 2 | Maximum number of reasoning-and-action cycles the agent may execute before returning a final answer. |
AGENT_VERBOSE | false | When true, LangChain prints every agent thought, action, and observation to stdout — useful for debugging but noisy in production. |
Tavily Search
Parameters passed to the Tavily Search API whenever use_search: true is set on a chat request.
| Setting | Value | Description |
|---|
TAVILY_MAX_RESULTS | 5 | Maximum number of web search results to retrieve per query. |
TAVILY_SEARCH_DEPTH | advanced | Search depth mode. advanced instructs Tavily to perform a deeper, more thorough crawl compared to basic. |
TAVILY_INCLUDE_ANSWER | true | When true, Tavily returns its own AI-generated answer summary alongside raw results. |
TAVILY_INCLUDE_RAW_CONTENT | false | When 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 ID | Display Name |
|---|
meta-llama/llama-4-scout-17b-16e-instruct | Llama 4 Scout 17B |
llama-3.1-8b-instant | Llama 3.1 8B Instant |
llama-3.3-70b-versatile | Llama 3.3 70B Versatile |
openai/gpt-oss-120b | GPT-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