Build a chat assistant application
Create a Chat Assistant Application
A chat assistant (chatbot) is a conversational application that engages in continuous dialogue with users in a Q&A session mode. Conversational applications are typically used in customer service, online education, healthcare, financial services, and other fields. These applications can help organizations improve efficiency, reduce labor costs, and provide a better user experience.
Next, we will create a basic orchestrated chat assistant, including pre-conversation prompts, variables, context, opening statements, and next-step question suggestions. We will also select tools from the toolbox, such as content review and response annotation, to provide more functionality for the orchestration.
Step 1. Create a new ChatBot
First, under the "Studio" tab, click "Create from Blank", select "Chatbot", choose "Basic". In the "App icon & name" section, enter a name for the chatbot, and then click "Create."
Then on the "Orchestrate" page, Click "manage" in the bottom right corner and enable "content moderation settings".
In the content moderation settings dialog, select "Keywords," enter test keywords and preset responses (customized),
Sirius
and enable "Input Content Moderation" and "Output Content Moderation," then click Save.
This is a sensitive word, I cannot answer your question.
Next, we edit the conversation opening and set a personalized greeting.
Now we input our question in the dialog box at the bottom of the debug and preview interface on the right, for example, "I want a Sirius". We can see that the chat assistant didn't access the large model, but directly returned a warning message through content review.
Step 2: Adding Annotated Replies
The annotated reply function is equivalent to providing another set of retrieval enhancement systems, which can skip the LLM generation stage and avoid the generation hallucination problem of RAG.
The annotated reply function provides a customizable high-quality Q&A reply capability for applications through manual editing and annotation. Applicable scenarios:
- Customized answers in specific fields: In enterprise, government, and other customer service or knowledge base Q&A scenarios, for certain specific questions, service providers hope to ensure that the system answers questions with clear results, so they need to customize output results for specific questions. For example, customizing "standard answers" for certain questions or "unanswerable" for certain questions.
- Quick tuning of POC or DEMO products: When quickly building prototype products, customized answers implemented through annotated replies can efficiently improve the generation expectations of Q&A results and improve customer satisfaction.
We input the question "What is Azure AI Services?" in the debug and preview interface. We see that the answer given by the large model is not bad, but we want to optimize the answer further. Here we can use the annotated reply function to annotate the reply. Please click "Edit Annotation" in the red circle in the image below.
Then modify the content of the machine reply in the "Edit Annotated Reply" window, for example:
Azure AI Services is a comprehensive suite including Machine Learning, Cognitive Services, and Applied AI, enabling swift creation of advanced applications via customizable APIs and models. It covers vision, speech, language, decision-making, and Azure OpenAI Services, supporting conversation, search, monitoring, translation, and more, all through NLP. This allows businesses to scale intelligent applications and transform their processes with generative AI.
Then click "Save", and Dify will automatically vectorize and save such a Q&A pair. If the same question is asked again, Dify will directly return the content we annotated.