Skip to main content

6 minutes read Level: AdvancedLast Updated: December 2025

File Search Using OpenAI Assistants

Glific’s File Search using OpenAI Assistant enables users to upload documents and get AI-generated answers to user questions. The system uses a method called Retrieval Augmented Generation (RAG), where the assistant searches through your files to give accurate, helpful responses, including answers to follow-up questions.


Use this when:

  • Users want to ask questions based on your PDFs, reports, or manuals.
  • There is a need to build an automated knowledge assistant for your organisation.
  • Help users get instant responses.

This document guides you through three main parts:

  • Creating an OpenAI Assistant
  • Using the Assistant in your Flows (including handling follow-up questions)
  • Handling Voice Inputs and Responses

How to Create an OpenAI Assistant in Glific

Step 1: Create a new AI Assistant

Click on AI Assistant from the left sidebar, then select Create Assistant to generate a blank assistant.

Screenshot 2025-08-09 at 12 35 30 AM

Step 2: Fill in the Assistant Details

Define the following parameters:

  • Choose the most relevant model from the first drop down.
  • Provide a name to the assistant.
  • Provide a system prompt in the Instructions field.
    Click Here to read more on prompt engineering.
  • Files (PDF, DOCX, etc.) can be uploaded by clicking on Manage Files. These files will be utilized by the assistant to generate responses.
    Click Here to know the supported file formats by the OpenAI APIs.
  • Set the Temperature (between 0 to 2). A higher value increases creativity/randomness.
    Recommended: keep temperature at 0.

Note: The quality of the bot’s response depends on the prompt. Give appropriate prompts based on your use case.

Step 3: Save Your Assistant

Once the files are added, click on Add. This completes the Assistant setup.
Click on the Save button after making any changes.

Screenshot 2025-08-09 at 12 43 48 AM

Step 4: Copy the Assistant ID

Once created, copy the Assistant ID shown below the assistant name.
This ID will be used in the webhook nodes in the flow editor.

Screenshot 2025-08-09 at 12 46 25 AM

Using the OpenAI Assistant in Floweditor

The following sections explain how to use an assistant to answer questions or create conversations.

Handling text inputs and outputs

This section explains how to:

  • Use the filesearch-gpt webhook function to pass a user’s question to the OpenAI Assistant.
  • Receive the assistant’s response.
  • Handle follow-up questions using conversational memory.

Step 1: Get User Question

  • Create a flow where the user sends a question as text input.
  • Add Send Message node and receive user question as text.
  • This question will be passed to the assistant for a response.
  • Provide a Result Name for the `Wait for Response node.
  • In the example below, the result name is set as question.

Screenshot of example flow set up is given below

Screenshot 2025-08-09 at 12 51 47 AM

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.
Screenshot 2025-12-02 at 6 07 25 PM
  • In the Function field, select the pre-defined function name filesearch-gpt, from the dropdown.
Screenshot 2025-12-02 at 6 08 30 PM
  • Give the webhook Result Name - you can use any name. In the screenshot example, it’s named as gptresponse.
Screenshot 2025-12-02 at 6 08 59 PM

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

Screenshot 2025-12-02 at 6 10 59 PM
  • 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 obtained in step 4 of "How to Create an OpenAI Assistant in Glific"

    Screenshot 2025-12-02 at 9 18 23 AM

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.

    Screenshot 2025-08-09 at 1 28 11 AM

    Sample Flow Click on the Sample Flow link to import it and explore how it works.

Conversational Memory

When a user asks a follow-up question, the assistant uses thread ID to remember the earlier conversation. This helps it give better answers by understanding the context of what was already asked.

Step 5: Add thread_id in the next Webhook call

  • To answer the subsequent questions based on the context of a question already asked, in the next webhook call, an additional parameter called thread_id needs to be passed.
  • 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.
Screenshot 2025-12-02 at 9 20 12 AM
  • 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.
Screenshot 2025-08-09 at 1 34 26 AM

Handling Voice Inputs and Responses

Some beneficiaries may find it easier to talk instead of typing. This is helpful for people who are not comfortable reading or writing. With voice input, beneficiaries can send voice notes to ask questions and get answers as both text and voice. This section explains how to use the voice-filesearch-gpt webhook function in Glific flows to take a user’s voice note as input and return both text and voice note responses in the desired language.

Step 1: Capture end user’s voice input

  • 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.
Screenshot 2025-08-09 at 1 38 18 AM

Step 2: Create Call a Webhook node

  • By default,Function would be selected. Leave this as it is.
Screenshot 2025-12-02 at 6 32 29 PM
  • In the Function field, select the pre-defined function name voice-filesearch-gpt , from the dropdown.
Screenshot 2025-12-02 at 6 33 32 PM
  • Give the webhook result name - you can use any name. In the screenshot example, it’s named gpt_voice.
Screenshot 2025-12-02 at 6 33 52 PM Screenshot 2025-08-09 at 1 40 28 AM

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

Screenshot 2025-12-02 at 6 39 47 PM

Pass the following paramters in the function body.

Screenshot 2025-12-02 at 7 20 46 PM
  • 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.
  • assistant_id is the assistant id obtained in step 4 of "How to Create an OpenAI Assistant in Glific.
  • source_langauge is the expected language of the user.
  • target_language is the language that the response voice note needs to be in.

Step 4: Display the text response

  • Create a Send Message node.
  • Use @results.webhook_result-name.translated_text to show the text response.
  • In the given example gpt_voice is the webhook result name.
Screenshot 2025-08-09 at 1 45 38 AM

Step 5: Send the voice note response

  • In a new Send Message node, go to Attachments.
  • Choose Expression from the dropdown.
  • Use @results.gpt_voice.media_url (gpt_voice is the result name of webhook node)
Screenshot 2025-08-09 at 1 46 58 AM

Sample Flow Click on the Sample Flow link to import it and explore how it works.


Pricing

NGOs can use AI features in Glific without any additional cost for inferencing. Glific is supported by OpenAI to help more NGOs experiment, pilot, and run programs using large language models (LLMs), enabling them to scale their impact without being limited by cost. Additionally NGOs can use up to $100 worth of credits until August 2026.


Video of Showcase

Video Link