Functional Chat Bot Best Practices

Hey All,

I’m looking for some advice on the best way to approach a specific chat bot problem. Heres the use case:

I’m building a chat bot to help people manage their clothing inventory and learn more about the clothing they own. I would like the user to be able to not only query the chat bot for specific answers to questions such as “What is the best clothing for xyz…” but also “What do I have in my closet” or “Remove this shirt from my closet”.

My chat bot uses multiple assistants + 1 thread shared between these assistants and at the top most layer, i classify the incoming question based on the previous 6 messages and then feed the query into the appropriate completion OR assistant.

My question is really about this kind of architecture. I’m struggling with the use case where you add or remove clothing. I want to use completions API for this because its a one shot question like “I would like to add xyz shirt, put it in this shelf etc” and I want the API to return formatted JSON back to me which i can then use, but if the user hasn’t filled out certain portions of the JSON object, we cant move forward, so should I be using the assistants API for this?

Here is my architecture in stepwise format:

  1. Classify incoming question based on previous 6 messages (Completions API)
  2. Feed query into appropriate assistant OR completion API
  3. If recommendation → use an assistant and same thread
  4. If action such as removal or adding, use completions API
  5. If user is missing info from their removal or add query, I force the next incoming question classification to basically handle the response for this message.

Does this make sense or am I over complicating? The issue is that the assistants API isn’t great with returning structure JSON data to my API.

I’m also attempting to construct a chatbot, but I keep sending the api all of my prior messages with user input, which causes a token limit issue. I’m utilising the chat completion api at the moment; How can this be resolved? Will the assistant api help, or is there a token limit in place as well?

Not sure about best practices yet, but here is one example on how to implement chat bot using AI (here chat completion API is used but could be Assistants API as well).
azureai-assistant-tool/samples/PetTravelPlanChatAssistant at v0.2.10-alpha · Azure-Samples/azureai-assistant-tool (github.com)

It is probably more traditional way of building chat bot experience using single Assistant/Agent and could fit well to certain chat bot scenarios where we want to follow a script + enable intelligent interaction between user and assistant

This thing caught my attention. Curious to know if anyone has tried a alternate approach?

Assuming that you have listable and nameable threads and messages with additional attributes, why couldn’t you just store your add/delete clothes into one thread with customized messages?

InventoryMessage :
Clothing_label…(“blue shirt”)
Storage_location (“closet”)
Action (“add/remove”)

Have a function call to trigger this?

Some of other questions : “what clothes will work for my graduation party thrown by my friends?” need all of the current clothes in a location for actual interpretation.