For the complete documentation index, see llms.txt. Markdown variants are available by appending .md to any URL or sending an Accept: text/markdown header. An agent skill is available at /.well-known/agent-skills/site-skill.md.
99
Sponsor

Chat with PDF

Indexes a PDF into a vector store and answers questions over it with page-cited retrieval.

Live preview

Flue

Output will stream here when you run the agent.

Summary

The Chat with PDF Agent lets you ask questions about a PDF and get answers grounded in the document, with a page citation for every claim. It indexes the PDF into a vector store, retrieves only the relevant chunks per question, and can also generate comprehension quizzes from real passages. Reach for it to turn manuals, papers, and reports into something you can query.

Install

$ pnpm dlx shadcn@latest add @agentcn/flue/chat-with-pdf

Composition

agents/
└── chat-with-pdf.ts      # Conversational Q&A agent
workflows/
└── chat-with-pdf.ts      # Index-then-answer, typed cited output
tools/
├── index-pdf.ts          # Chunk, embed, and store a PDF
└── search-docs.ts        # Retrieve relevant chunks for a query
lib/
└── vector-store.ts       # libSQL vector store + embeddings helpers

Customization

  • Swap the vector store. lib/vector-store.ts wraps libSQL — replace it with Pinecone, Qdrant, Chroma, or pgvector behind the same functions.
  • Tune chunking. Adjust chunkText's size and overlap for your documents.
  • Reshape the answer. Edit the Answer valibot schema in the workflow.
  • Swap the embedding model. Change the model in lib/vector-store.ts.