Include or exclude knowledge folders

Patterns pick knowledge by folder. Include a folder and the agent reads the documents in it; exclude a folder inside it to leave those out.

Before you start

You need an agent and knowledge in folders. See Limit what an agent reads.

Include a folder, exclude another

  1. Set your agent's knowledge to patterns. true includes a folder and false leaves one out:
    agents/support.ts
    import { agent } from "veryfront/agent"; export default agent({  id: "support",  name: "Support assistant",  system: "Answer customer questions about orders and refunds from the project's knowledge. Keep replies to two sentences.",  knowledge: {    "knowledge/policies/**": true,    "knowledge/policies/drafts/**": false,  },});
  2. Start the project with npm run dev.
  3. Open Chat in Studio.
  4. Pick Support assistant.
  5. Ask "How many days do I have to return an item?". You should now see it reply 45 days, not the draft's 60.

Try it in a sandbox

  1. Create a project

  2. Before you start: knowledge in folders

  3. Set the patterns

  4. Start it

  5. Ask it

Try it out

Next steps