All request and response bodies in PDF Insight Pro are validated by Pydantic v2 models defined inDocumentation 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.
models/models.py. Every field is typed, and required fields will produce a 422 Unprocessable Entity response if omitted or malformed. This page documents every public model used across the REST API — from the chat and upload endpoints down to the internal document-processing structures.
Request Models
ChatRequest
Sent as the JSON body of POST /chat. Specifies the session to query, the user’s question, and optional controls for web-search augmentation and model selection.
The session identifier returned by
POST /upload-pdf. Every chat turn must reference a valid, active session.The natural-language question to ask about the uploaded document. Must be at least 3 characters after stripping leading/trailing whitespace; blank or very short queries are rejected with
400 Bad Request.When
true, the agent augments its answer with results from a Tavily web-search tool call in addition to the local FAISS vector index. Requires TAVILY_API_KEY to be configured on the server.The Groq model ID to use for response generation. Must be one of the IDs listed by
GET /models. Defaults to Llama 4 Scout 17B if omitted.SessionRequest
Sent as the JSON body of /chat-history, /clear-history, and /remove-pdf. Identifies the session to act on.
The session identifier returned by
POST /upload-pdf.Response Models
UploadResponse
Returned by a successful POST /upload-pdf call.
Always
"success" on a successful upload.A UUID string that uniquely identifies the newly created session. Pass this value as
session_id in all subsequent requests.A human-readable confirmation message, e.g.
"Processed report.pdf".ChatResponse
Returned by a successful POST /chat call.
Always
"success" on a successful response.The LLM-generated answer to the user’s query, grounded in the retrieved document context and (optionally) web-search results.
The document chunks retrieved from the FAISS index and passed to the LLM as context for this turn.
ChatHistoryResponse
Returned by POST /chat-history.
Always
"success" when the session is found.The ordered conversation history for the session. Each item represents one exchange.
StatusResponse
Returned by both /clear-history and /remove-pdf on success.
Always
"success" when the operation completes.A human-readable description of the outcome, for example
"Chat history cleared" or "PDF file and session removed successfully".ModelsResponse
Returned by GET /models.
The list of Groq models available for use as
model_name in ChatRequest.ErrorResponse
Returned whenever the API cannot fulfil a request. The status field distinguishes application-level errors from HTTP transport errors.
A short error category string such as
"error".A human-readable description of what went wrong. Matches the
detail string in FastAPI’s HTTPException format.Optional. A machine-readable error type token for programmatic error handling. May be omitted when not applicable.
Internal Models
The following models are used internally by the application’s processing pipeline. They are not returned directly by any public endpoint but appear as nested structures in responses or are used during PDF ingestion and chunk retrieval.DocumentChunk
Represents a single processed chunk of text extracted from a PDF, as it moves through the ingestion pipeline.
| Field | Type | Description |
|---|---|---|
text | string | The raw text content of this chunk. |
metadata | ChunkMetadata | Structured metadata about the chunk’s origin. |
ChunkMetadata
Metadata attached to each DocumentChunk at ingestion time and stored alongside the FAISS vectors.
| Field | Type | Description |
|---|---|---|
source | string | null | The originating filename or file path. |
page | int | null | The zero- or one-indexed page number within the source PDF. |
ChunkMetadata is configured with Config.extra = "allow", meaning the model accepts and preserves any additional metadata fields that the PDF loader or chunking pipeline may attach beyond source and page.Example Request Payloads
The following examples show valid JSON bodies for every request model.ChatRequest — full payload with web search enabled
ChatRequest — minimal payload (defaults applied for use_search and model_name)
SessionRequest — used for /chat-history, /clear-history, /remove-pdf