Multi turn chatbot using streamlit open ai and own dataset

Summary

I want to create a chatbot using streamlit, this should accept the user response and depending on user choice or response, it should answer the next question or just answer based on the response, for example, the typical customer service chat bot where customer asks a question, agent advise something, if user says something affirmative, agent will suggest one thing , else if user says no , that is not the case , agent will advise something else. i have been struggling , i know i can use a bot framework like microsoft bot framework etc but wondering , can we do this using streamlit.

Steps to reproduce

Code snippet:

add code here

If applicable, please provide the steps we should take to reproduce the error or specified behavior.

Expected behavior:

Explain what you expect to happen when you run the code above.

Actual behavior:

Explain the undesired behavior or error you see when you run the code above.
If youโ€™re seeing an error message, share the full contents of the error message here.

Debug info

  • Streamlit version: (get it with $ streamlit version)
  • Python version: (get it with $ python --version)
  • Using Conda? PipEnv? PyEnv? Pex?
  • OS version:
  • Browser version:

Requirements file

Using Conda? PipEnv? PyEnv? Pex? Share the contents of your requirements file here.
Not sure what a requirements file is? Check out this doc and add a requirements file to your app.

Links

  • Link to your GitHub repo:
  • Link to your deployed app:

Additional information

If needed, add any other context about the problem here.

Hi @ajeet,

Thanks for posting!

So this is definitely possible with Streamlit. One thing to keep in mind is that Streamlit is just the front-end that your user will interact with. From your explanation, it sounds like youโ€™re looking for a backend solution. You can use a pre-trained model or a fine-tuned model on the customer care dataset which you can then plug into a Streamlit front-end and let customers chat with it. Let me know if this is the direction youโ€™re thinking.

1 Like

@tonykip , First of all, than you for your response. very insightful. Here is what I am struggling with ( and please excuse my ignorance i am very new to streamlit and looking for help).

I am trying to develop a customer support chat bot, where user tells an issue with his/her product and customer support bot will then advise one or more things in a sequential fashion ( basically they can ask question - is the ligh on, do you see a x mark and so on) and this conversation goes on based on the users response , if user says yes, then probably bot will ask something else, if says no - question will change. i hope i am clear, my data and model is in place, I know how to handle that part , i think. I just need to use streamlit the way we use microsoft bot framework or rasa or any other similar thing at much simpler level. any code which you can show to demonstrate this, will be great help.

I see. We have a blog on how to build conversational apps that you can use to get you started. Thereโ€™s code snippets on there as well.

Let me know how the implementation goes and if you still run into any issues, please share you repo code so I can help troubleshoot,

2 Likes

Hello @tonykip this code worked greta, how can I update it to handle the small talk , like if we input Hi , bot should say, Hello how can I help you, if user say bye bot should say bye etc

I think this would depend on your model. Typically your model should intelligently handle this small talk out of the box if it is a chat based model. What responses are you getting back when you say hi and bye?