Skip to content

muratsuzen/dotnet-ai-lab

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

44 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

.NET AI Architect Laboratory ๐Ÿš€

The .NET AI Architect Laboratory is a strategic blueprint for designing, orchestrating, and scaling model-agnostic AI ecosystems. This repository focuses on building robust architectural substrates where LLMs are treated as pluggable engines rather than hardcoded dependencies.

๐ŸŽฏ Core Philosophy

  • Provider Agnosticism: Building a "Master Gateway" that can switch between Gemini, OpenAI, Anthropic, and Groq (Llama/Qwen) LLMs with zero breaking changes in the application core.
  • Type Safety & Schema Enforcement: Enforcing strict data contracts (C# Classes) regardless of which model or provider executes the response.
  • Abstraction-First: Mastering Microsoft.Extensions.AI to decouple core systems from specific AI vendor APIs.

๐Ÿ—๏ธ Technical Stack

  • Framework: .NET 10 (Minimal APIs Architecture)
  • Frontend SPA: Angular 19 (Reactive Signals, Client-Side Rendering)
  • UI Styling: Tailwind CSS v3 (Cyber-Dashboard Theme)
  • AI Abstraction: Microsoft.Extensions.AI (v10.5.0+ Standard Implementation)
  • Active SDKs: - Google.GenAI (v1.6.2 Reference Substrate)
    • Microsoft.Extensions.AI.OpenAI (v10.5.0 Enterprise Bridge)
  • Orchestration: Microsoft Semantic Kernel (v1.76.0+)
  • Active Engines (Dual-Engine Topology): - Gemini 2.5 Flash (Vertex AI Integration Reference)
    • Llama 3.3 70B & Llama 3.1 8B (Powered by Groq LPU Infrastructure for low-latency execution)
  • Upcoming Engines: Claude 3.5 Sonnet, GPT-4o, Local LLMs (Ollama)

๐Ÿ—บ๏ธ The Roadmap

๐Ÿงฑ Phase 1: Foundations & Multi-Model Abstraction (Completed) ๐Ÿ†

Focusing on the backend "Brain" and ensuring provider-independence.

  • Enterprise Setup (Gemini): Connectivity via Google Vertex AI & IAM infrastructure.
  • Secure Configuration: Decoupled environment management via structured appsettings.json.
  • Structured Output: Universal JSON mapping to C# classes via native SDK schema enforcement (The "Type-Safe" core).
  • Model Agnosticism: Full integration of IChatClient abstraction to support external providers seamlessly.
  • API Gateway: A clean Minimal API acting as the central intelligence hub.

๐Ÿ—๏ธ Phase 2: Action & UI Integration (Completed) ๐Ÿ†

Making AI "do things", integrating low-latency providers, and visualizing the results.

  • Orchestration: Native C# Plugin development via Semantic Kernel using type-safe execution.
  • Prompt Templating: Decoupling architectural instructions from core code using Semantic Kernel template syntax ({{$code}}).
  • Secure Sandbox: Hardening the ProjectInspectorPlugin against Path Traversal vulnerabilities using absolute workspace validation.
  • Architecture Dashboard: Integrated Angular 19 with Tailwind CSS v3 to visualize real-time model analysis in a siber-panel interface.
  • Dynamic Localization: Multi-language review orchestration (e.g., Turkish, English) powered by query routing and Semantic Kernel prompt variables ({{$language}}).
  • Cross-Origin Security: Configured explicit .NET CORS policies to securely bridge the Angular SPA and the Minimal API Gateway.
  • Autonomous Function Calling: Transitioned from manual tool orchestration to fully autonomous, model-driven multi-tool execution using Semantic Kernel auto-invocation behaviors.
  • Dynamic Provider Routing (Groq Integration): Developed a dynamic endpoint pipeline that detects ModelId data at runtime and seamlessly routes traffic between Vertex AI and Groq without mutating the runtime IoC container.
  • Deterministic JSON Enforcement: Mitigated small-model hallucination patterns (such as Llama 3.1 8B thought chains) by hardcoding native ChatResponseFormat.Json parameters at the API level.
  • Request-Scoped Service Resolution: Resolved runtime IServiceProvider locking bugs by migrating keyed service resolution to HttpContext.RequestServices, insulating scoped kernel state.
  • UI Sanity Filter (Token Bleeding Fix): Implemented an explicit client-side whitelist regex filter within Angular signals to scrub out accidental Cyrillic/Asian character leakages while fully maintaining native Turkish character parsing support.

๐Ÿ’พ Phase 3: Enterprise Memory & Substrate RAG (Completed) ๐Ÿ†

Providing AI with secure access to corporate data using local cost-effective vector abstractions.

  • External Dependency Rejection: Eliminated heavy and costly cloud-dependent vector databases. Built a high-performance, cost-effective local memory layer using raw SQLite.
  • Provider-Agnostic Embedding Bridge: Developed a custom GoogleEmbeddingGenerator sarmallayฤฑcฤฑsฤฑ using text-embedding-004 to convert text segments into 768-dimensional vectors seamlessly matching standard Microsoft.Extensions.AI interfaces.
  • Native Vector Math: Implemented a lightweight, zero-dependency Cosine Similarity mathematical formula directly in C# for lightning-fast semantic retrieval.
  • Deterministic Deduplication Policy: Engineered an intelligent Base64 path-hashing system on the Angular side to enforce SQLite's ON CONFLICT(Id) DO UPDATE constraint, eliminating memory inflation.
  • Knowledge-Augmented Orchestration: Deeply integrated the vector retrieval pipeline into the Autonomous Agent gateway (/api/architect/inspect-autonomous), allowing the agent to evaluate local context substrates before executing tools.
  • RAG Cyber Management Board: Visualized real-time vector ingestion and semantic searching directly on the frontend spa using Tailwind and reactive Angular Signals.

๐Ÿค– Phase 4: Autonomous Agents & MCP ๐Ÿ†

The transition from orchestrated workflows to autonomous agency.

  • Custom MCP Servers: Building .NET-based Model Context Protocol servers to bridge LLMs with local tools (ListProjectFiles, ReadCodeFile).
  • Agentic Workflows & Live Streaming: Architecting a multi-loop reasoning engine utilizing HTTP/SSE Text Streams connected to an Angular Signals UI.
  • Stochastic Bracket Counter & UI Defenses: Integrated custom .NET bracket-balancing algorithms and language enforcement layers to tame small models (Llama 3.1 8B).
  • Reactive Terminal Viewport: Developed a dark-cyber monochrome Live Execution Ledger in Angular with auto-scroll telemetry mapping.

๐Ÿ–ฅ๏ธ UI Dashboard Preview

Here is the production-ready cyber-dashboard interface visualizing an autonomous enterprise code inspection via the dual-engine substrate in Phase 2:

.NET AI Architect Laboratory Cyber Dashboard

๐Ÿง  Vector Memory & Retrieval (Phase 3 RAG UI Addon)

The dedicated multi-tab standalone workspace orchestrating high-dimensional knowledge sealing and keyword-less semantic matching:

Phase 3 Vector Search Dashboard


๐ŸŽฎ How to Test the Autonomous Agent Mode

Once both layers are running, toggle the Agent Mode on the cyber-dashboard to unlock multi-tool reasoning:

  1. Active AI Engine: Select your preferred engine from the dropdown (Gemini 2.5 Flash, Llama 3.1 8B, or Llama 3.3 70B). The system will dynamically route the request to the correct provider substrate.
  2. Target Folder Path: Provide the absolute path to your repository root (e.g., C:\Project\msuzen\dotnet-ai-lab).
  3. Agent Objective: Input a high-level goal such as "Review our configuration and check for frontend access boundaries."
  4. Execution: Click Launch Autonomous Agent. The underlying engine will autonomously evaluate the local SQLite vector database to query matching code substrates, embed them as context, and chain file tools to generate a comprehensive enterprise report.

๐Ÿš€ How to Start (Single-Port Enterprise Mode)

The system is configured for zero-friction distribution. The Angular UI is natively embedded inside the .NET Minimal API, running entirely on a single port.

1. Clone the Repo

git clone https://github.com/muratsuzen/dotnet-ai-lab.git
cd dotnet-ai-lab

2. Configure Credentials

Configure your appsettings.json based on your requirements. The system supports independent provider initialization.

{
  "AI": {
    "Gemini": {
      "ProjectId": "", //YOUR_GCP_PROJECT_ID
      "Location": "us-central1",
      "ModelId": "gemini-2.5-flash"
    },
    "Groq": {
      "ApiKey": "", //gsk_YOUR_GROQ_API_KEY
      "ModelId": "llama-3.3-70b-versatile"
    }
  }
}

Important: If you only intend to use Groq, simply leave the Gemini:ProjectId field empty. The system will automatically enable "Null Mode" for embeddings to ensure stability. If using Gemini, ensure vertex-key.json is present in the backend root.

3. Build & Fire Up the Integrated Substrate

Compile the Angular frontend and inject it directly into the .NET wwwroot, then run the API Gateway:

# Step A: Compile Angular UI into backend wwwroot
cd src/frontend/ai-architect-ui
npm install
npm run build -- --configuration production

# Step B: Fire up the single-port orchestration pipeline
cd ../../backend/AI.Architect.Gateway
dotnet run --configuration Release

Open your browser and navigate to http://localhost:5000.

4. Running the Release

Once you have configured your appsettings.json, you can launch the application directly from the release folder:

# Execute the application binary
dotnet AI.Architect.Gateway.dll

The system will initialize the integrated Angular UI and API Gateway. Open http://localhost:5000 to start your architectural inspection.

About

Production-grade AI agents, RAG systems, and autonomous model-agnostic workflows using .NET 10, Microsoft.Extensions.AI, and Semantic Kernel. Features dynamic dual-engine routing (Gemini & Groq/Llama), structured JSON enforcement, and an Angular 19 cyber-dashboard UI.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors