From 84fe08db99d115648ff85404e39f04efc94ff9ff Mon Sep 17 00:00:00 2001 From: sangeeta1911 Date: Tue, 28 Jul 2026 17:59:32 +0530 Subject: [PATCH] docs: add prompt-writing guidance for AI assistants Adds a "Writing effective instructions" section with a reusable prompt template, a filled-in example, and tips for iterating (using AI Evaluations, keeping a consistent fallback phrase). Cross-linked from the Filesearch doc's existing prompt-engineering pointer, which previously only linked out to an external blog post. Co-Authored-By: Claude Sonnet 5 --- ...ting and modifying assistants in Glific.md | 43 ++++++++++++++++++- .../Filesearch Using OpenAI Assistants.md | 4 +- 2 files changed, 44 insertions(+), 3 deletions(-) diff --git a/docs/5. Integrations/Creating and modifying assistants in Glific.md b/docs/5. Integrations/Creating and modifying assistants in Glific.md index 586a9221c..ed46fd4fb 100644 --- a/docs/5. Integrations/Creating and modifying assistants in Glific.md +++ b/docs/5. Integrations/Creating and modifying assistants in Glific.md @@ -3,7 +3,7 @@ 3 minutes read Level: Advanced - Last Updated: April 2026 + Last Updated: July 2026 @@ -29,6 +29,47 @@ This doc details how to create new assistants, modify the created assistants and 5. From here, copy the assistant id and use it in the flow. +## Writing effective instructions + +The `Instructions` field you fill in when creating or editing an assistant is its system prompt - it tells the assistant how to behave, what it knows, and what to do when it doesn't know something. A clear, specific prompt makes a real difference in the quality of your assistant's answers. + +A good prompt usually covers: + +- Role and audience - who the assistant is for and what it should help with. +- Source of truth - tell it to answer only using the uploaded knowledge base, rather than general knowledge, if that's what you want. +- Tone and format - how formal or casual, how long the answers should be, and any language requirements. +- What to do when it doesn't know - a clear fallback instruction (for example, ask it to say so honestly instead of guessing). This also makes it possible to detect and route unanswered questions to a human agent - see [Open a ticket with a human agent](https://glific.github.io/docs/docs/Product%20Features/Flows/Flow%20Actions/Open%20a%20ticket%20with%20a%20human%20agent/). + +### Example template + +``` +You are a helpful assistant for [organization name]. You help [describe your users, e.g. "farmers enrolled in our program"] with questions about [topic]. + +Answer only using the information in your knowledge base. Do not guess or make up information. + +If you don't know the answer, reply exactly with: "[fallback phrase]" + +Keep answers under [N] sentences unless the user asks for more detail. Respond in [language(s)]. +``` + +### Example filled in + +``` +You are a helpful assistant for Kaivalya Education. You help Panchayati Raj Institution (PRI) members with questions about local governance and Viksit Panchayat guidelines. + +Answer only using the information in your knowledge base. Do not guess or make up information. + +If you don't know the answer, reply exactly with: "I'm not able to help with that yet." + +Keep answers under 3 sentences unless the user asks for more detail. Respond in Hindi. +``` + +### Tips for improving your prompt over time + +- Add a couple of example question-and-answer pairs directly in the prompt if the assistant's responses don't match the format you want. +- Use [AI Evaluations](https://glific.github.io/docs/docs/Integrations/AI%20Evaluations%20in%20Glific/) to test your prompt against a Golden Set of questions, and refine it based on where it scores poorly. +- Keep the fallback phrase consistent - it's easier to track and route unanswered questions if the assistant always says the same thing when it doesn't know. + ## Modifying an assistant 1. From the assistant list page, click on “edit” the assistant action. Screenshot 2026-04-14 at 2 46 55 PM diff --git a/docs/5. Integrations/Filesearch Using OpenAI Assistants.md b/docs/5. Integrations/Filesearch Using OpenAI Assistants.md index e0e2a5c1e..33c68fd3f 100644 --- a/docs/5. Integrations/Filesearch Using OpenAI Assistants.md +++ b/docs/5. Integrations/Filesearch Using OpenAI Assistants.md @@ -4,7 +4,7 @@ 6 minutes read Level: Advanced - Last Updated: April 2026 + Last Updated: July 2026 @@ -47,7 +47,7 @@ Define the following parameters: - Provide a system prompt in the `Instructions` field. - *[Click Here](https://glific.org/a-simple-guide-to-using-large-language-models/#prompt) to read more on prompt engineering.* + *[Click Here](https://glific.org/a-simple-guide-to-using-large-language-models/#prompt) to read more on prompt engineering, or see [Writing effective instructions](https://glific.github.io/docs/docs/Integrations/Creating%20and%20modifying%20assistants%20in%20Glific/#writing-effective-instructions) for a prompt template and examples.* - Files (.csv, .doc, .docx, .html, .java, .md, .pdf, .pptx, .txt) can be uploaded by clicking on `Manage Files`. These files will be utilized by the assistant to generate responses and each file will take approx 15 secs to upload.