Table of Contents

Create an AI Code Assistant in .NET Applications


🎯 Purpose of the Sample

The Multi-Turn Chat with Coding Assistant Demo showcases how to use the LM-Kit.NET SDK to create an interactive chatbot that can assist with coding tasks. This sample demonstrates the integration of large language models (LLMs) into a .NET application to facilitate multi-turn conversations, providing coding support, code analysis, and comment reviews.


👥 Industry Target Audience

This sample is particularly beneficial for developers and organizations in the following sectors:

  • 🖥️ Software Development: Enhance coding productivity by providing quick insights, code analysis, and comment reviews.
  • 🏫 Education: Assist students in learning programming by offering explanations and analyses of code snippets.
  • ✅ Quality Assurance: Improve code quality by automatically reviewing and enhancing code comments and documentation.
  • 🔧 Technical Support: Provide instant coding assistance to developers and technical support teams.

🚀 Problem Solved

Providing accurate and helpful coding assistance requires expertise and time. The Multi-Turn Chat with Coding Assistant Demo addresses this problem by leveraging LLMs to automate coding support, including code analysis and comment reviews, enhancing productivity and code quality.


💻 Sample Application Description

The Multi-Turn Chat with Coding Assistant Demo is a console application that allows users to interact with a coding assistant chatbot designed to provide coding support, analyze code, and review comments.

✨ 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.
  • 🛠️ Coding Assistance: The chatbot assists with coding questions, code analysis, and comment reviews.
  • 🔧 Special Commands: Users can reset the conversation, regenerate responses, analyze code files, or review code comments.
  • 📈 Performance Metrics: Displays generated tokens, stop reasons, quality score, and speed of response for each interaction.

🧠 Supported Models

The sample supports the following state-of-the-art models:

  • DeepSeek V1 Small
  • DeepSeek V2 Medium

🛠️ 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_coding_assistant
    

    or

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

    dotnet build
    dotnet run
    
  4. 📜 Follow the on-screen prompts to select a model and start interacting with the coding assistant.

💡 Example Usage

  1. 📦 Select a Model: Choose from the available models or enter a custom model URI.
  2. 💬 Initiate Conversation: Start by entering a prompt, such as "Hello! 1+1==1, right?".
  3. 🛠️ Receive Coding Assistance: The chatbot will generate responses based on the prompt and assist with coding tasks.
  4. 🔄 Continue Interaction: Enter another prompt or use the special commands to analyze code files or review comments.
  5. 🛑 End the Chat: Submit an empty input to end the program.

🛠️ Special Commands

  • 🔄 /reset: Start a new session.
  • ♻️ /regenerate: Get a new completion from the last input.
  • 📝 /analyse [PATH]: Analyze a code file from the specified path.
  • 📝 /reviewcomments [PATH]: Review and improve code comments from the specified path.

By following these steps, developers can explore the functionalities of LM-Kit.NET and integrate advanced coding assistance into their applications, enhancing coding productivity and quality through a multi-turn conversational AI.