๐ Try the demo:
https://github.com/LM-Kit/lm-kit-net-samples/tree/main/console_net/text-generation/structured-content-creation/multi_turn_chat_with_yes_no_assistant
Create Yes or No AI Chatbot in .NET Applications
๐ฏ Purpose of the Demo
The Multi-Turn Chat with Yes/No Assistant Demo showcases how to utilize the LM-Kit.NET SDK to create an interactive chatbot that provides yes or no answers. This sample demonstrates the integration of large language models (LLMs) into a .NET application to facilitate multi-turn conversations where the chatbot responds strictly with yes or no answers, serving as a fact-checking assistant.
๐ฅ Industry Target Audience
This sample is particularly beneficial for developers and organizations in the following sectors:
- ๐ Customer Support: Provide clear and concise responses to customer queries.
- ๐ Education: Aid in quizzes and simple assessments requiring yes or no answers.
- ๐ฅ Healthcare: Assist in preliminary diagnostics by answering basic yes or no questions.
- ๐ Fact-Checking Services: Automate the process of verifying statements with straightforward yes or no responses.
๐ Problem Solved
Creating chatbots that provide concise and unambiguous answers can be challenging, especially when the required response is strictly yes or no. The Multi-Turn Chat with Yes/No Assistant Demo addresses this problem by leveraging LLMs to ensure the chatbot only gives yes or no answers, enhancing clarity and precision in automated responses.
๐ป Sample Application Description
The Multi-Turn Chat with Yes/No Assistant Demo is a console application that allows users to interact with a chatbot designed to answer yes or no questions using various AI models.
โจ Key Features
- ๐ Model Selection: Users can choose from predefined models or provide a custom model URI.
- ๐ Progress Tracking: The application displays download and loading progress for the selected model.
- โ Strict Yes/No Responses: The chatbot is programmed to respond only with yes or no, based on the user's query.
- ๐ Performance Metrics: Displays generated tokens, stop reasons, quality score, and speed of response for each interaction.
- ๐ Special Commands: Users can reset the conversation using the /reset command.
๐ง Supported Models
The sample supports several state-of-the-art models:
- Alibaba Qwen 3.5 9B (~7 GB VRAM)
- Google Gemma 4 E4B (~6 GB VRAM)
- Microsoft Phi-4 14.7B (~11 GB VRAM)
- OpenAI GPT OSS 20B (~16 GB VRAM)
- Z.ai GLM 4.7 Flash 30B (~18 GB VRAM)
- Alibaba Qwen 3.8 27B (~18 GB VRAM)
- Alibaba Qwen 3.6 35B-A3B (~22 GB VRAM)
๐ ๏ธ Getting Started
๐ Prerequisites
- .NET 8.0 or later
๐ฅ Download the Project
โถ๏ธ Running the Application
๐ Clone the repository:
git clone https://github.com/LM-Kit/lm-kit-net-samples๐ Navigate to the project directory:
cd lm-kit-net-samples/console_net/text-generation/structured-content-creation/multi_turn_chat_with_yes_no_assistant๐จ Build and run the application:
dotnet build dotnet run๐ Follow the on-screen prompts to select a model and start the multi-turn chat.
๐ก Example Usage
- Select a Model: Choose from the available models or enter a custom model URI.
- Initiate Conversation: Start by entering a question, such as "Hello chatbot, are you functioning properly?".
- Receive Yes/No Response: The chatbot will respond with yes or no based on the query.
- Continue Interaction: Enter another question or reset the conversation using the /reset command.
- End the Chat: Submit an empty input to end the program.
By following these steps, developers can explore the functionalities of LM-Kit.NET and integrate a yes/no answering chatbot into their applications, enhancing the clarity and precision of automated responses through a multi-turn conversational AI.
๐ Related Content
- How-To: Enforce Structured Output with Grammar: Learn how to constrain LLM output to specific formats like yes/no responses.
- How-To: Build Dynamic Prompts with Templates: Guide to crafting system prompts that enforce strict output patterns.
- Glossary: Structured Output: Core concepts behind constraining LLM responses to specific formats or schemas.
- Glossary: Grammar Sampling: Understanding grammar-based techniques for controlling token generation.