Table of Contents

Create Yes or No AI Chatbot in .NET Applications


🎯 Purpose of the Sample

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:

  • Mistral Nemo 2407 12.2B
  • Meta Llama 3.1 8B
  • Google Gemma2 9B Medium
  • Microsoft Phi-3 3.82B Mini
  • Alibaba Qwen-2 7.6B

🛠️ Getting Started

📋 Prerequisites

  • .NET Framework 4.6.2 or .NET 6.0

📥 Download the Project

▶️ Running the Application

  1. 📂 Clone the repository:

    git clone https://github.com/LM-Kit/lm-kit-net-samples.git
    
  2. 📁 Navigate to the project directory:

    cd lm-kit-net-samples/console_framework_4.62/multi_turn_chat_with_yes_no_assistant
    

    or

    cd lm-kit-net-samples/console_net6/multi_turn_chat_with_yes_no_assistant
    
  3. 🔨 Build and run the application:

    dotnet build
    dotnet run
    
  4. 📝 Follow the on-screen prompts to select a model and start the multi-turn chat.

💡 Example Usage

  1. Select a Model: Choose from the available models or enter a custom model URI.
  2. Initiate Conversation: Start by entering a question, such as "Hello chatbot, are you functioning properly?".
  3. Receive Yes/No Response: The chatbot will respond with yes or no based on the query.
  4. Continue Interaction: Enter another question or reset the conversation using the /reset command.
  5. 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.