c
hi
t
Thanks for reaching out, Arun. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Hi — how can I help today? What are you trying to do with LiveKit (e.g., SDK setup, rooms, permissions, troubleshooting, billing)? Please share any error messages, SDK/platform (web, iOS, Android, server), and relevant IDs if available.
c
I want to feed a PDF or TXT file into my livkit agent like knolwdge base
t
You're asking how to feed a PDF or TXT into your LiveKit agent as a knowledge base — here’s what you can do and recommended steps. Summary • TXT: read text and add to the agent’s chat context. • PDF: extract text first (e.g., PyPDF2, pdfplumber, or a Node PDF parser), then add extracted text to the agent’s chat context. • For large documents: split, summarize, or index chunks to avoid context-window limits. Quick steps (general) 1. Extract text from the file (TXT: read; PDF: use a PDF parser). 2. Optionally split into smaller chunks and/or create summaries. 3. Add chunks to the agent’s
ChatContext
as messages (e.g.,
role="system"
or
role="user"
), or send them as part of the initial prompt. 4. Use the agent; it will reference the injected context when answering. Frontend file upload option • You can upload files from the client using byte streams and then extract text server-side before adding to the agent context. Do you want: • a Python example for extracting PDF text and adding to
ChatContext
, or • a Node.js example that uses client byte streams plus extraction? Tell me which language and whether your files are large (so I can include chunking examples). Sources: Vision | LiveKit Docs