A Knowledge Base lets your AI agent answer questions using your own documents. Upload FAQs, product docs, policies, or any text content, and the agent will search for relevant information when responding to customers.
const document = await zavu.senders.agent.knowledgeBases.documents.create( "sender_abc123", "kb_xyz789", { title: "Return Policy", content: `# Return Policy## 30-Day ReturnsAll products can be returned within 30 days of purchase for a full refund.## Conditions- Items must be unused and in original packaging- Original receipt required- Shipping costs are non-refundable## How to Return1. Contact support@example.com2. Receive return shipping label3. Ship item within 7 days4. Refund processed within 5 business days## Exceptions- Final sale items cannot be returned- Custom orders are non-refundable`, });console.log("Document added:", document.id);
Customer: "What's your return policy?" | v +------------------+ | Embed Question | | Create vector | +------------------+ | v +------------------+ | Vector Search | | Find similar | | chunks | +------------------+ | v +------------------+ | Retrieve Top | | Chunks (e.g., 3) | +------------------+ | v +------------------+ | Inject Context | | into LLM Prompt | +------------------+ | v +------------------+ | Generate Answer | | with Context | +------------------+ | vCustomer: "You can return any item within 30 days for a full refund. Items must be unused and in original packaging. Contact support@..."
# Product Returns## How long do I have to return an item?You have 30 days from the delivery date to return any item for a full refund.## What condition must items be in?Items must be unused, unworn, and in original packaging with all tags attached.## How do I start a return?1. Email support@example.com with your order number2. We'll send a prepaid return label within 24 hours3. Ship the item within 7 days4. Refund processes within 5 business days of receipt
Poor document structure:
Copy
Returns are processed within the timeframe specified in our terms. Contact support for assistance with any issues you may have regarding your order.
Write documents as if you’re answering specific customer questions. This makes retrieval more accurate.
# Shipping FAQs## How long does shipping take?- Standard shipping: 5-7 business days- Express shipping: 2-3 business days- Same-day delivery: Available in select cities## How much does shipping cost?- Free shipping on orders over $50- Standard shipping: $5.99- Express shipping: $12.99## Do you ship internationally?Yes! We ship to over 50 countries. International shipping takes 7-14 business days.## Can I track my order?Yes, you'll receive a tracking number via email once your order ships.
# Pro Widget X100## OverviewThe Pro Widget X100 is our flagship widget designed for professional use.## Specifications- Weight: 2.5 lbs- Dimensions: 10" x 6" x 4"- Battery life: 12 hours- Warranty: 2 years## Features- Wireless connectivity (Bluetooth 5.0 and WiFi)- Water-resistant (IP67 rating)- Voice control compatible## Price- Standard edition: $299- Pro edition: $449 (includes accessories)## Common Questions### Is it compatible with Mac?Yes, works with macOS 10.15 and later.### Can I use it outdoors?Yes, the IP67 rating means it's water and dust resistant.