https://github.com/nashtech-garage/ntg-agent
A sample Chatbot in C# using Semantic Kernel
https://github.com/nashtech-garage/ntg-agent
chatbot csharp generative-ai kernel-memory rag semantic-kernel
Last synced: about 2 months ago
JSON representation
A sample Chatbot in C# using Semantic Kernel
- Host: GitHub
- URL: https://github.com/nashtech-garage/ntg-agent
- Owner: nashtech-garage
- License: apache-2.0
- Created: 2025-06-24T09:02:27.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2025-08-02T05:12:01.000Z (9 months ago)
- Last Synced: 2025-08-02T08:12:56.476Z (9 months ago)
- Topics: chatbot, csharp, generative-ai, kernel-memory, rag, semantic-kernel
- Language: HTML
- Homepage:
- Size: 1.2 MB
- Stars: 41
- Watchers: 1
- Forks: 21
- Open Issues: 14
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# NTG Agent
This project aims to practice building a chatbot in C#
[](https://github.com/nashtech-garage/ntg-agent/actions/workflows/ntg-agent-ci.yml)
[](https://sonarcloud.io/summary/new_code?id=nashtech-garage_ntg-agent)
[](https://sonarcloud.io/summary/new_code?id=nashtech-garage_ntg-agent)
[](https://sonarcloud.io/summary/new_code?id=nashtech-garage_ntg-agent)
[](https://sonarcloud.io/summary/new_code?id=nashtech-garage_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](https://docs.github.com/en/github-models/use-github-models/prototyping-with-ai-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" ""`. Read [this link](https://learn.microsoft.com/en-us/aspnet/core/security/app-secrets) if you don't know how to set the secrets
```json
{
"KernelMemory": {
"Services": {
"OpenAI": {
"APIKey": "your GitHub token"
}
}
}
}
```
- In the NTG.Agent.MCP.Server project, add your Google SearchEngineId and ApiKey
following https://developers.google.com/custom-search/docs/tutorial/creatingcse in the secrets.json as below
```json
{
"Google": {
"ApiKey": "",
"SearchEngineId": ""
}
}
```
- 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](https://aistudio.google.com/): 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).
## Long Term Memory Configuration
The Long Term Memory (LTM) feature allows the chatbot to remember user-specific information across conversations. This feature can be controlled via configuration to manage token consumption:
```json
{
"LongTermMemory": {
"Enabled": true,
"MinimumConfidenceThreshold": 0.3,
"MaxMemoriesToRetrieve": 20
}
}
```
- Set `Enabled: false` to disable memory extraction and retrieval, saving tokens
- Adjust `MinimumConfidenceThreshold` to control quality of stored memories
- Modify `MaxMemoriesToRetrieve` to balance context vs. token usage
## Contributing
- Give us a star
- Reporting a bug
- Participate discussions
- Propose new features
- Submit pull requests. If you are new to GitHub, consider to [learn how to contribute to a project through forking](https://docs.github.com/en/get-started/quickstart/contributing-to-projects)
By contributing, you agree that your contributions will be licensed under Apache-2.0 license.