Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 86 additions & 0 deletions docs/5. Integrations/AI Assistants (how to create and edit).md
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
<h4>
<table>
<tr>
<td><b>3 minutes read</b></td>
<td style={{ paddingLeft: '40px' }}><b>Level: Advanced</b></td>
<td style={{ paddingLeft: '40px' }}><b>Last Updated: Sept 2026</b></td>
</tr>
</table>
</h4>

# Overview
The AI Assistants page (`AI toolkit` → `AI Assistant`) is where you build, test, evaluate, and publish assistants that get used into Glific flows via their assistant ID (asst_…). Everything you need lives inside a single assistant — from editing the prompt to evaluating it against Golden Q&As and taking a version live.


Comment thread
mahajantejas marked this conversation as resolved.
# Creating and editing an assistant
1. To create an assistant, go to `AI toolkit` → `AI Assistant`
2. Click `Create New Assistant` (top right).
3. This opens a blank “Untitled assistant”. Rename it with the pencil icon, then configure it using the tabs below.
<img width="" height="" alt="Screenshot 2026-09-03 at 7 55 03 AM" src="https://github.com/user-attachments/assets/40af2160-a06e-4532-8c0d-0b9c6970f042" />


Comment thread
mahajantejas marked this conversation as resolved.
# The assistant editor

When you edit or create an assistant you’ll see a header (assistant name with a pencil to rename, the copyable assistant ID, and the Go Live button), a version selector showing the current version and its LIVE status, and five tabs: Model & Prompt, Knowledge Base, Guardrails, Golden Q&A Evaluation, and Try It Out.

<img width="" height="" alt="Screenshot 2026-09-03 at 8 07 54 AM" src="https://github.com/user-attachments/assets/17615e3b-7ada-44aa-beae-f4687677f9c1" />



Comment thread
mahajantejas marked this conversation as resolved.
## Model & Prompt tab
Comment thread
mahajantejas marked this conversation as resolved.
This is the core configuration. Enter the assistant’s behaviour in the Instructions (Prompt) box (describe who it is, what it helps with, what it must never do, and what language to reply in). Optionally use Generate with AI (BETA) to draft a prompt.

To learn more about how to build a good prompt go [here](https://glific.github.io/docs/docs/FAQ/AI%20Chatbot%20Implementation%20Guidelines/#2-prompt)

Below that, pick the Model from the dropdown (e.g. gpt-5.6-luna) and set the associated settings for the model.

Examples of settings associated with the model:
1. Reasoning effort: the effort spent by AI models to think and reason before answering the user query. Higher reasoning effort takes up more in time in generating the response.
2. Temperature: Temperature in AI models is a setting that acts as a dial for creativity and randomness. Higher temperature leads to more creative responses, recommended to keep temperature close to 0 for most social impact use cases.


<img width="1223" height="714" alt="Screenshot 2026-09-03 at 8 36 42 AM" src="https://github.com/user-attachments/assets/e51f86ce-4f52-48d4-ac04-197a11a55433" />

Available model settings vary by model. To learn more about the models, settings and which is suitable for your use case, go [here](https://developers.openai.com/api/docs/models/compare)

## Knowledge Base tab
1. Click `+ Add files` to attach documents the assistant can search when answering (supports PDF, DOC, DOCX, TXT, MD, HTML, and CSV, up to 20MB per file). A Knowledge Base ID is also shown here. Changes apply when you save a version.
Comment thread
mahajantejas marked this conversation as resolved.
2. Files can be removed individually or downloaded.

<img width="" height="" alt="Screenshot 2026-09-03 at 8 01 44 AM" src="https://github.com/user-attachments/assets/918f9631-11b9-4834-b8a2-653c9fd821ed" />


To learn more about how to structure the knowledge base go [here](https://glific.github.io/docs/docs/FAQ/AI%20Chatbot%20Implementation%20Guidelines#1-knowledge-base)
## Try It Out tab
A sandbox chat to test the currently selected version before going live with it to quickly test how the assistant answers are changing. It labels which version you’re testing and notes it’s sandbox-only, so real users are unaffected.
<img width="" height="" alt="Screenshot 2026-09-02 at 3 09 25 PM" src="https://github.com/user-attachments/assets/47a4e41b-0c15-42b9-9d45-5db971e5c4a7" />


# Key concept: versions, Save, and Go Live
Two actions drive the whole lifecycle.

1. **Saving** any change creates a new minor version (for example 1.0 → 1.1 → 1.2). These saved versions are drafts you can test and evaluate freely without affecting real users. Any changes made need to be saved, so that the updates can be tried out and evaluated before making live in the flow for the actual users.

<img width="" height="" alt="Screenshot 2026-09-03 at 7 50 10 AM" src="https://github.com/user-attachments/assets/9aede94b-98c0-4e98-bf0c-d79fb1d220e6" />

3. **Go Live (publishing)** promotes the current version to the next major version (for example 1.2 → 2.0) and marks it LIVE. The live version is the one actually used in your Glific flows wherever that assistant ID is referenced. Until you Go Live, real users stay on the previously published version.

<img width="" height="" alt="Screenshot 2026-09-03 at 7 52 16 AM" src="https://github.com/user-attachments/assets/07a0c44f-47f3-47a1-9ce9-9739e1eccc06" />

Comment thread
mahajantejas marked this conversation as resolved.
### Main points to note about assistant id and Go live action
Comment thread
mahajantejas marked this conversation as resolved.

1. Making edits to an assistant and saving a new version does not change its assistant ID.
2. Therefore, the assistant ID does not need to be updated in the flows each time a new version is saved or made live.
3. You can choose which version of the assistant gets used in the flow by using the `Go Live` button on that particular assistant version.
4. By default, new changes are not made live directly in the flow.
5. To use an assistant with the latest modifications, you must explicitly click `Go Live`.

## Recommended workflow
Edit or create new version of an assistant → Save (creates a new draft version of the assistant) → test in `Try It Out` → Run an evaluation → check `History` to compare scores with previous versions → only then Go Live.

### Why are versions created on modifications? and why do you need to "Go Live"
1. To provide flexibility to easily revert to previous versions when making new modifications to assistants.
2. Any new updates can be evaluated before deploying to flows which are in use.

### How to use the assistants in the Glific flow?
The workflow on using the assistants remains the same, can be seen in [Using the OpenAI assistant in the flow editor](https://glific.github.io/docs/docs/Integrations/Filesearch%20Using%20OpenAI%20Assistants/#using-the-openai-assistant-in-floweditor)
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<tr>
<td><b>6 minutes read</b></td>
<td style={{ paddingLeft: 40 }}><b> Level: Advanced</b></td>
<td style={{ paddingLeft: 40 }}><b>Last Updated: July 2026</b></td>
<td style={{ paddingLeft: 40 }}><b>Last Updated: Sept 2026</b></td>
</tr>
</table>
</h3>
Expand Down Expand Up @@ -50,39 +50,39 @@ This section explains how to:

_Screenshot of example flow set up is given below_

<img width="633" height="501" alt="Screenshot 2025-08-09 at 12 51 47 AM" src="https://github.com/user-attachments/assets/6cb60c7a-6b75-4c96-8b78-88fa3318a8c2" />
<img width="" height="" alt="Screenshot 2025-08-09 at 12 51 47 AM" src="https://github.com/user-attachments/assets/6cb60c7a-6b75-4c96-8b78-88fa3318a8c2" />


#### Step 2: Add a Call Webhook node. This is where we integrate the OpenAI Assistant.

- By default, `Function` would be selected. Leave this as it is.

<img width="473" height="394" alt="Screenshot 2025-12-02 at 6 07 25 PM" src="https://github.com/user-attachments/assets/e9f685cb-910d-40ff-93a0-2f4688092ae2" />
<img width="" height="" alt="Screenshot 2025-12-02 at 6 07 25 PM" src="https://github.com/user-attachments/assets/e9f685cb-910d-40ff-93a0-2f4688092ae2" />

- In the `Function` field, select the pre-defined function name `filesearch-gpt`, from the dropdown.

<img width="452" height="377" alt="Screenshot 2025-12-02 at 6 08 30 PM" src="https://github.com/user-attachments/assets/3b03c3bf-ca5c-423b-b231-12849e147909" />
<img width="" height="" alt="Screenshot 2025-12-02 at 6 08 30 PM" src="https://github.com/user-attachments/assets/3b03c3bf-ca5c-423b-b231-12849e147909" />

- Give the webhook `Result Name` - you can use any name. In the screenshot example, it’s named as `gptresponse`.

<img width="478" height="405" alt="Screenshot 2025-12-02 at 6 08 59 PM" src="https://github.com/user-attachments/assets/3aa57481-5aac-4106-980b-089c46e89744" />
<img width="" height="" alt="Screenshot 2025-12-02 at 6 08 59 PM" src="https://github.com/user-attachments/assets/3aa57481-5aac-4106-980b-089c46e89744" />



#### Step 3: Click on Function Body (top right corner). You would see the following.

<img width="628" height="435" alt="Screenshot 2025-12-02 at 6 10 59 PM" src="https://github.com/user-attachments/assets/aff3ba8d-e5d0-4958-b10c-2bfa481d2128" />
<img width="" height="" alt="Screenshot 2025-12-02 at 6 10 59 PM" src="https://github.com/user-attachments/assets/aff3ba8d-e5d0-4958-b10c-2bfa481d2128" />

- In `question` parameter enter the flow variable containing the question asked by the user. In the given example `question` is the `result name`, hence provided `@result.question` in the question parameter.
- In `assistant_id` enter the assistant ID, copied as described in [Creating and modifying AI assistants in Glific](https://glific.github.io/docs/docs/Integrations/Creating%20and%20modifying%20assistants%20in%20Glific/)

<img width="623" height="438" alt="Screenshot 2025-12-02 at 9 18 23 AM" src="https://github.com/user-attachments/assets/880a4181-bd79-4d04-92aa-c0d502456bd5" />
<img width="" height="" alt="Screenshot 2025-12-02 at 9 18 23 AM" src="https://github.com/user-attachments/assets/880a4181-bd79-4d04-92aa-c0d502456bd5" />

#### Step 4: Display the Assistant's response
- Once the Webhook is updated, add a `Send Message` node and enter `@results.gptresponse.message` variable to receive the AI response.
- In the given example `gptresponse` is the `result name` (refer to Step 2). If `ai_response` was the result name, the variable would be `@results.ai_response.message`.

<img width="643" height="498" alt="Screenshot 2025-08-09 at 1 28 11 AM" src="https://github.com/user-attachments/assets/6c4d143e-a1b9-4523-a684-8eae3e0e0e97" />
<img width="" height="" alt="Screenshot 2025-08-09 at 1 28 11 AM" src="https://github.com/user-attachments/assets/6c4d143e-a1b9-4523-a684-8eae3e0e0e97" />

[Sample Flow](https://drive.google.com/file/d/10wGUil1l2SGfOZdWQQOO935OK-6BdZV1/view?usp=sharing) Click on the Sample Flow link to import it and explore how it works.

Expand All @@ -94,11 +94,11 @@ When a user asks a follow-up question, the assistant uses thread ID to remember
- This parameter should be set to the value `@results.previouswebhookname.thread_id`.
- In the example shown, the previous webhook result name is gptresponse. So the thread ID should be referenced as - `@results.gptresponse.thread_id`.

<img width="612" height="433" alt="Screenshot 2025-12-02 at 9 20 12 AM" src="https://github.com/user-attachments/assets/d9c58bdf-e2c3-4a72-b1a3-22b278e9d57e" />
<img width="" height="" alt="Screenshot 2025-12-02 at 9 20 12 AM" src="https://github.com/user-attachments/assets/d9c58bdf-e2c3-4a72-b1a3-22b278e9d57e" />

- In question parameter enter the flow variable containing the follow up question asked by the user. In the given example `result_5` is the result name, hence provided `@results.result_5` in the question parameter.

<img width="624" height="489" alt="Screenshot 2025-08-09 at 1 34 26 AM" src="https://github.com/user-attachments/assets/bd95bbfb-18e1-46d0-915a-fad38782b5d4" />
<img width="" height="" alt="Screenshot 2025-08-09 at 1 34 26 AM" src="https://github.com/user-attachments/assets/bd95bbfb-18e1-46d0-915a-fad38782b5d4" />

---

Expand All @@ -112,31 +112,31 @@ This section explains how to use the `voice-filesearch-gpt` webhook function in
- Create a `Send Message` node directing users to send their responses as audio messages, based on their preference.
- In the `Wait for Response` node, select has audio as the message response type. Also, give a result name. In the screenshot below, `audio_query` is used as the result name.

<img width="606" height="463" alt="Screenshot 2025-08-09 at 1 38 18 AM" src="https://github.com/user-attachments/assets/5805f7fd-f13f-4298-b9e3-bf63f235574c" />
<img width="" height="" alt="Screenshot 2025-08-09 at 1 38 18 AM" src="https://github.com/user-attachments/assets/5805f7fd-f13f-4298-b9e3-bf63f235574c" />


#### Step 2: Create Call a Webhook node
- By default,`Function` would be selected. Leave this as it is.

<img width="472" height="392" alt="Screenshot 2025-12-02 at 6 32 29 PM" src="https://github.com/user-attachments/assets/5203d925-ae4b-4397-8479-f774304e6454" />
<img width="" height="" alt="Screenshot 2025-12-02 at 6 32 29 PM" src="https://github.com/user-attachments/assets/5203d925-ae4b-4397-8479-f774304e6454" />

- In the `Function` field, select the pre-defined function name `voice-filesearch-gpt` , from the dropdown.

<img width="523" height="431" alt="Screenshot 2025-12-02 at 6 33 32 PM" src="https://github.com/user-attachments/assets/fcf90118-6691-43f1-9f85-63a9ed3217c8" />
<img width="" height="" alt="Screenshot 2025-12-02 at 6 33 32 PM" src="https://github.com/user-attachments/assets/fcf90118-6691-43f1-9f85-63a9ed3217c8" />

- Give the webhook result name - you can use any name. In the screenshot example, it’s named `gpt_voice`.

<img width="499" height="420" alt="Screenshot 2025-12-02 at 6 33 52 PM" src="https://github.com/user-attachments/assets/eb62c32e-393b-433b-b971-27eeefcfaec4" />
<img width="" height="" alt="Screenshot 2025-12-02 at 6 33 52 PM" src="https://github.com/user-attachments/assets/eb62c32e-393b-433b-b971-27eeefcfaec4" />

<img width="625" height="528" alt="Screenshot 2025-08-09 at 1 40 28 AM" src="https://github.com/user-attachments/assets/3ccb9af7-1a01-4fbb-9358-7a842c8c7960" />
<img width="" height="" alt="Screenshot 2025-08-09 at 1 40 28 AM" src="https://github.com/user-attachments/assets/3ccb9af7-1a01-4fbb-9358-7a842c8c7960" />

#### Step 3: Click on Function Body (top right corner). You would see the following.

<img width="486" height="344" alt="Screenshot 2025-12-02 at 6 39 47 PM" src="https://github.com/user-attachments/assets/3434febe-4df9-4d5d-9a4e-4fab424610cf" />
<img width="" height="" alt="Screenshot 2025-12-02 at 6 39 47 PM" src="https://github.com/user-attachments/assets/3434febe-4df9-4d5d-9a4e-4fab424610cf" />

Pass the following paramters in the function body.

<img width="536" height="375" alt="Screenshot 2025-12-02 at 7 20 46 PM" src="https://github.com/user-attachments/assets/f107f0e2-3632-4b3c-8c1b-43224ab39c43" />
<img width="" height="" alt="Screenshot 2025-12-02 at 7 20 46 PM" src="https://github.com/user-attachments/assets/f107f0e2-3632-4b3c-8c1b-43224ab39c43" />

- For `contact ` keep this value as `@contact` as mentioned in the screenshot.
- `speech` is the result name which is storing the voice note sent by the user.
Expand All @@ -149,7 +149,7 @@ Pass the following paramters in the function body.
- Use `@results.webhook_result-name.translated_text` to show the text response.
- In the given example `gpt_voice` is the webhook result name.

<img width="622" height="473" alt="Screenshot 2025-08-09 at 1 45 38 AM" src="https://github.com/user-attachments/assets/bd42793c-f4a4-4326-814b-aea9ac7e7924" />
<img width="" height="" alt="Screenshot 2025-08-09 at 1 45 38 AM" src="https://github.com/user-attachments/assets/bd42793c-f4a4-4326-814b-aea9ac7e7924" />


#### Step 5: Send the voice note response
Expand All @@ -158,7 +158,7 @@ Pass the following paramters in the function body.
- Use `@results.gpt_voice.media_url` (gpt_voice is the result name of webhook node)


<img width="617" height="252" alt="Screenshot 2025-08-09 at 1 46 58 AM" src="https://github.com/user-attachments/assets/547eed06-5697-4379-95d2-0221dc6093e6" />
<img width="" height="" alt="Screenshot 2025-08-09 at 1 46 58 AM" src="https://github.com/user-attachments/assets/547eed06-5697-4379-95d2-0221dc6093e6" />


[Sample Flow](https://drive.google.com/file/d/1EOXFnUqUPQz51xf3pYzhikkf_2VqXL4Z/view?usp=sharing) Click on the Sample Flow link to import it and explore how it works.
Expand Down
Loading
Loading