Skip to content

nashtech-garage/ntg-agent

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NTG Agent

This project aims to practice building a chatbot in C#

Build Quality Gate Status SonarCloud Coverage Security Rating Vulnerabilities

High level architecture

NTG Agent - High level architecture

Technologies and frameworks

  • .NET 10
  • .NET Aspire
  • Blazor
  • Microsoft Agent Framework
  • Kernel Memory
  • Support multiple LLMs: GitHub Models, Open AI, Azure Open AI etc.
  • SQL Server

Documentation

Details about the project can be referenced at DeepWiki: https://deepwiki.com/nashtech-garage/ntg-agent

Getting started

  • Setup GitHub models (free): Create your Fine-grained personal access tokens in GitHub https://github.com/settings/personal-access-tokens. The token needs to have models:read permissions.
  • Update file secrets.json for the NTG.Agent.Knowledge with content below Or run the cli command dotnet user-secrets set "KernelMemory:Services:OpenAI:APIKey" "<your_token_here>". Read this link if you don't know how to set the secrets
{
  "KernelMemory": {
    "Services": {
      "OpenAI": {
        "APIKey": "your GitHub token"
      }
    }
  }
}
{
    "Google": {
      "ApiKey": "<your google cse Api Key>",
      "SearchEngineId": "<your google cse Search EngineID>"
    }
}
  • The default database connection string is Server=.;Database=NTGAgent;Trusted_Connection=True;TrustServerCertificate=true;MultipleActiveResultSets=true which connects to the local SQL server instance using Windows Authentication. If your environment is different, update the connection string in appsettings.Development.json files of three projects: NTG.Agent.Admin, NTG.Agent.Orchestrator, NTG.Agent.Knowledge

  • In the NTG.Agent.Admin project, open the terminal and run dotnet ef database update. Repeat the same for the NTG.Agent.Orchestrator project.

  • Run the NTG.Agent.AppHost, in the Aspire Dashboard you will see resource as below:

    • NTG.Agent.WebClient is the website for end users
    • NTG.Agent.Admin is the website for administrators. The default admin account is admin@ntgagent.com / Ntg@123
    • NTG.Agent.Orchestrator is the backend API
    • NTG.Agent.Knowledge is the service responsible for ingesting documents. It extracts the content of uploaded files, generates embeddings, and stores them in a vector database. It also provides an API to search for relevant documents
  • Open the NTG.Agent.Admin --> Agent Management --> Agent Default and update the Agent Provider with GitHub Model information that you created earlier.

    • Provider Name: GitHub Model
    • Provider Endpoint: https://models.github.ai/inference
    • Provider API Key: Your GitHub token
    • Model Name: openai/gpt-4.1 or other model that GitHub model supports

Using other LLM models

NTG Agent supports multiple LLM model providers: GitHub Model, Azure Open AI, Google Gemini

Google Gemini

Setup Gemini API: Create your API key in Google AI Studio https://aistudio.google.com/api-keys The Provider Endpoint: https://generativelanguage.googleapis.com/v1beta/

How authentication work

To get started easily, we use the shared cookies approach. In NTG.Agent.Admin, we add YARP as a BFF (Backend for Frontend), which forwards API requests to NTG.Agent.Orchestrator. Currently, it only works for Blazor WebAssembly. Cookies are not included when the request is made from the server (Blazor).

Contributing

By contributing, you agree that your contributions will be licensed under Apache-2.0 license.

About

A sample Chatbot in C# using Microsoft Agent Framework

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Contributors 9