Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin'
Browse files Browse the repository at this point in the history
  • Loading branch information
mdshamoon committed Feb 19, 2024
2 parents 8ec1e55 + ec7fbd9 commit dfb2f0f
Show file tree
Hide file tree
Showing 7 changed files with 177 additions and 11 deletions.
2 changes: 1 addition & 1 deletion docs/2. Onboarding/01. Glific Onboarding Toolkit.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ ___
```
https://staging.tides.coloredcow.com/
Phone number: +917834811114
Password: secret1234
Password: Secret1234!
```

Please don't use this to build extensive flows and testing on live numbers. We update the account every week so any work you do is likely to be removed. Please only use it to view the platform and check out the features.
Expand Down
6 changes: 4 additions & 2 deletions docs/2. Onboarding/03. Setup an organisation on GupShup.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,13 @@ a) Disable Automated opt-in message.

23. After verification, you will be live on Gupshup.

24. To set up Glific, you’ll need to send us the following details at [https://cc.tides.coloredcow.com/organization-registration](https://cc.tides.coloredcow.com/organization-registration)
24. To set up Glific, you’ll need to send us the following details at https://prod.glific.com/organization-registration

25. App Name
26. GupShup account phone number
27. API key
27. API key - Go to Gupshup, Click on the right corner top click on it and copy the API key and paste it in the Glific form

<img width="213" alt="Screenshot 2024-02-15 at 9 29 44 AM" src="https://github.com/glific/docs/assets/143380171/71d4c140-ed0a-48c2-9167-815196e394c5"/>

Click on `continue` button.

Expand Down
39 changes: 39 additions & 0 deletions docs/3. Pilot Essentials.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
> ### **3 minute read &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; `Beginner`**
Designing chatbots is an iterative process, and with every launch or pilot, you learn new things and make changes. But if you are launching your chatbot for the first time with your users, here are 15 quick things you need to check. It shouldn't take you more than 15 minutes to ensure everything is in order.

Disable the automated opt-in message on Gupshup. This will prevent your users from receiving additional default messages from Gupshup, which might confuse them. To do this, click on your app on Gupshup, go to the Opt-ins tab, click on the Onboarding mechanisms dropdown arrow, and scroll down to disable the toggle.



The first message that a user receives upon joining the bot should be a consent message. Here are a few guidelines for designing your consent message:
Clearly mention the name of the organization and the purpose of the bot.
Clearly ask the user if they would like to receive messages from the bot (You can provide an interactive message with a "Yes" or 👍🏼 button).
Users should have an option to opt out. Therefore, add the keyword in the footer through which users can opt out from the bot.



Other pointers to remember-
It is recommended to have the first message sent by the user to the chatbot, instead of you broadcasting the message to users, even if you have user details. Broadcasting messages might lead to user reporting or blocking the bot, which can affect the overall health of the bot. Unless you have obtained user consent outside the bot (on your app or manually), the first message should always be user-initiated.
Create a separate flow for users who type "STOP" and add them to a collection for future reference.

3) Update the Opt-in settings post-user consent. It is mandatory to update a contact's settings with Opt-in after their consent.


4) Important user information collected during registration, such as Name, Language, Training group, City, etc., should be updated in the contact profile. This will be helpful for you to refer in any flow in future

5) Confirm important information (like Name, Language, etc.) before updating the contact. Sometimes, users might enter incorrect information, which can impact the user experience throughout.

For example, sharing a name as "My name is Krishna Priya" instead of just "Krishna Priya" can lead to the bot referring to the user with the incorrect name every time. Additionally, a user choosing the wrong language preference by mistake might discourage them from using the bot.

6) Set default and new contact flows through Settings → Flows to ensure that new users receive the intended flow.
7) Add content in all nodes for all languages, if multiple languages are used for the bot.
8) Add users to relevant collections based on how you want to communicate with them in the future.
9) Use interactive messages wherever you want the user to choose from given options or when answers are predictable (e.g., grade, Yes/No, Gender, etc.).
10) If a flow is triggered from your end to the user, the first message of the flow should be an HSM message (because we don't know if the users are in the active session window or not).
11) Add labels for both outgoing and incoming messages for all the data you want to capture and check in the future.
12) Use appropriate names for Flows, Keywords, and Result names to make it easy to track them in the future.
13) Use emoticons, bold, italics, and media as needed.
14) Ensure the user does not encounter any dead ends in the bot, especially in the case of interactive messages. Make sure there is also an option for the user to send free text apart from the button options you provide, and clarify what the user is expected to do. Connect the user's response back to the main question and wait for their response so the flow can proceed.

15) Testing, Testing, Testing: Test the chatbot internally with at least 3 to 5 people on mobile phones before sharing it with actual users.
49 changes: 48 additions & 1 deletion docs/3. Product Features/01. Chats.md
Original file line number Diff line number Diff line change
@@ -1 +1,48 @@
To be filled
###**3 minute read &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; `Beginner`**


**Chats**: This section on the left side is highlighted, indicating that the user is currently viewing the chat interface.

**Chat Window**: The central part of the interface shows an ongoing conversation with a particular contact.

**Contacts**: On the right side, there is a section titled 'Contacts' listing different contacts who have been interacted.



<img width="1256" alt="Screenshot 2024-02-13 at 12 06 06 PM" src="https://github.com/glific/docs/assets/143380171/2687e161-3579-4451-8fb4-a50698f24610"/>

**Collection**: Collections in Glific are like folders where you can gather a bunch of users together. Once you have them in a collection, you can send messages to everyone in that collection all at once. It is a handy way to keep things organized and communicate efficiently with different groups of users.You can find more details
[here](https://glific.github.io/docs/docs/Product%20Features/Others/Collections/)


**Saved Searches** : The saved searches are visible.

<img width="328" alt="Screenshot 2024-02-13 at 12 22 06 PM" src="https://github.com/glific/docs/assets/143380171/4af7a44a-4c21-4661-911a-3f5182addb89"/>


All - Shows all contacts.
Not Replied - Shows contacts list whose messages were read but not replied to yet.
Not Responded - Shows contacts who have not responded yet to the messages.

You can read more about this [here](https://glific.github.io/docs/docs/Product%20Features/Searches/#search-contacts)


**Session Timer** : You can also come to know the session timer for a particular contact in top right corner of the screen

<img width="208" alt="Screenshot 2024-02-13 at 12 22 50 PM" src="https://github.com/glific/docs/assets/143380171/c7cbcb70-06bd-45a6-842b-424c5e75a146"/>

**Shortcuts**:

The handy shortcuts like Speed Send, Templates, and Interactive Messages are present in the bottom part of the chat screen. These shortcuts make messaging quicker and easier.
Speed Send helps you send messages faster, Templates let you use pre-made message formats, and Interactive Messages allow you to engage users more dynamically. They are like quick buttons that save you time and effort while communicating with users.


**Preview Button**:

<img width="887" alt="Screenshot 2024-02-13 at 12 22 32 PM" src="https://github.com/glific/docs/assets/143380171/d525e5df-34f7-43a6-80d4-56d3f39ac102"/>


A green phone-like icon towards the right bottom end is present which acts as a preview button. When you click on it, you can see how your chats will actually look on a phone screen. It is like a sneak peek feature that lets you visualize how your messages will appear to users, helping you fine-tune your communication for a better user experience.


<img width="267" alt="Screenshot 2024-02-13 at 12 23 13 PM" src="https://github.com/glific/docs/assets/143380171/2656775e-4b02-480c-999c-598f37c663c1"/>
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,9 @@ ___

## Note

To handle blank cells in between the Google Sheet use [Split by Expression](https://glific.github.io/docs/docs/Product%20Features/Flows/Flow%20Actions/Split%20By/Custom%20Expression/)
- This functionality can be used to write upto 30 columns in google sheets
- To handle blank cells in between the Google Sheet use [Split by Expression](https://glific.github.io/docs/docs/Product%20Features/Flows/Flow%20Actions/Split%20By/Custom%20Expression/)

___
## Advanced Feature Webinar

Expand Down
24 changes: 18 additions & 6 deletions docs/4. Integrations/ChatGPT Integration via Jugalbandi.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
> ### **3 minute read &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; `Advanced`**
> ### **3 minute read &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; `Advanced`**
**Leverage the capabilities of GPT models developed by OpenAI by using Jugalbandi APIs. Jugalbandi APIs is enhancing Glific by providing Retreival Augemented Generation or in simple words, enabling NGOs to use custom knowledge base for GPT models to answer from.**

Expand Down Expand Up @@ -39,17 +39,29 @@ The function is then called with three key-value pairs as the function body

![image](https://github.com/glific/docs/assets/40158831/7f509016-f7fd-43c8-83c1-b133dd95a7dc)

`url:` URL depends on which model we use to process the response as Jugalbandi offers
`url:` URL is referencing a given end point from the [Jugalbandi APIs](https://api.jugalbandi.ai/docs) some examples are given below

1. GPT3.5: `https://api.jugalbandi.ai/query-with-langchain-gpt3-5`
1. GPT4: `https://api.jugalbandi.ai/query-with-langchain-gpt4`
1. Langchain: `https://api.jugalbandi.ai/query-with-langchain`
1. GPTindex: `https://api.jugalbandi.ai/query-with-gptindex`
_below is picture showing the list of end points_

<img width="1453" alt="Screenshot 2024-02-13 at 8 05 22 PM" src="https://github.com/glific/docs/assets/141305477/972af81e-647b-429f-90ab-8ce2f5f8e635"/>

following shows how to use these end points in the webhook call parameter:

1. to use GPT3.5: `https://api.jugalbandi.ai/query-with-langchain-gpt3-5`
1. to use GPT4: `https://api.jugalbandi.ai/query-with-langchain-gpt4`
2. to use GPT4 using custom prompt: `https://api.jugalbandi.ai/query-with-langchain-gpt4-custom-prompt`

`uuid_number:` The "uuid_number" is a special code assigned to a file when it is uploaded through the [jugalbandi API](https://api.jugalbandi.ai/docs#/Document%20Store/upload_files_upload_files_post) then this `UUID` is used to find the relevant information from the knowledge base and gives it back to you.

`query_string:` user query asked in flow

additionally, an extra parameter can be passed called `prompt:` in the API end points which end with `custom-prompt`. This is a system prompt that can be passed to the model. This enables NGOs to experiment with prompt engineering. Generally it can be used to provide guidelines or steps or explicit instructions for the LLM to process the 'query_string' being passed, like
- to limit the length of response generated,
- decline to answer if the question asked is outside the scope of the documents uploaded (this prevents what is termed as hallucination by the LLMs)
- generate in a specific tone, ex catering to a student below the age of 15 etc.
- anything else under the ambit of prompt engineering which allows one to get creative in eliciting responses from LLMs


Additionally, you can use [Google sheet](https://glific.github.io/docs/docs/Product%20Features/Flows/Flow%20Actions/Link%20Google%20Sheets/) feature to store response into google sheet as this data can later be analyzed to evaluate each model's accuracy and effectiveness and help you make a decision.

Using the [webhook logs](https://glific.github.io/docs/docs/Product%20Features/Flows/Flow%20Actions/Call%20a%20webhook/#checking-webhook-logs), you can view the logs of questions asked and responses received by ChatGPT.
Expand Down
64 changes: 64 additions & 0 deletions docs/4. Integrations/ChatGPT using OpenAI APIs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
> ###**3 minute read &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; `Advanced`**
## Using ChatGPT within Glific using the OpenAI APIs

_**Leverage the capabilities of GPT models developed by OpenAI by using OpenAI APIs.**_

## Pre-requisites
1. Create an account in OpenAI platform [platform](https://openai.com/product)
2. Create new API keys
3. Make sure there is enough credit in OpenAI account to allow usage.
4. Pricing for API calls is as per OpenAI platform [pricing](https://openai.com/pricing)

<img width="1060" alt="Screenshot 2024-02-07 at 10 50 58 AM" src="https://github.com/glific/docs/assets/141305477/d3c22780-a4ae-4aaa-b196-1d079fce7eb5" />

_Above is a representative image from the OpenAI platform account_

## How it will work

1. Question is asked by the user after the flow is initiated
2. OpenAI API call is made using webhooks within the flow
3. Model being called to generate responses is `gpt-3.5-turbo-16k`
4. The response to the question is then sent to the user

## Steps to follow to set up OpenAI API in Glific platform
1. Go to `Settings`, find `OpenAI (ChatGPT) (Beta)`
2. Click on `is active` and paste the OpenAI API key from your OpenAI platform account

<img width="591" alt="Screenshot 2024-02-07 at 10 48 51 AM" src="https://github.com/glific/docs/assets/141305477/87adef8e-1858-4aa6-8b46-7f976cfbb9fb" />

## Using the webhook for OpenAI API call in a Glific flow

<img width="1069" alt="Screenshot 2024-02-07 at 9 59 24 AM" src="https://github.com/glific/docs/assets/141305477/babb9e27-fce5-4b2b-81d9-58017fd1a079" />

_Representative image to explain the steps in OpenAI API calls in a simple flow_

[Sample flow](https://drive.google.com/file/d/1jl0NWn73YlK1qMRedaPnGCQwDKHfG_7j/view?usp=drive_link)


1. Get the user question
2. In `call a webhook` node, select `function` and paste function name as `parse_via_chat_gpt`

<img width="684" alt="Screenshot 2024-02-07 at 10 52 49 AM" src="https://github.com/glific/docs/assets/141305477/f1165b6b-483c-43b4-9e8d-7bb6044d6e24" />

3. Share the following function body
` {
"contact": "@contact",
"results": "@results",
"question_text": "@results.question"
}`

here `question_text` is the parameter name corresponding to user question.

<img width="711" alt="Screenshot 2024-02-07 at 10 53 21 AM" src="https://github.com/glific/docs/assets/141305477/65622c0e-2dfb-41fb-8f6d-a836e8a0f81d" />

4. The response from GPT is shown as `@results.webhookresultname.parsed_msg`, in the given example `gpt_response` is the webhook result name.


## Limitations
1. At present, this is simple question answer with the GPT model `gpt-3.5-turbo-16k`
2. Selection of GPT model is not yet customizable from org Glific instances
3. Additional system prompt is not yet customizable from org Glific instances
4. Parameters like temperature, top P etc are not yet customizable from org Glific instances

_Reach out to the Glific team to flag any further customizations within this functionality_

0 comments on commit dfb2f0f

Please sign in to comment.