Skip to content

Tony427/Semantic-Kernel-POC

Repository files navigation

Semantic Kernel POC

A proof-of-concept chat bot API powered by Microsoft Semantic Kernel with persistent chat history and document memory capabilities.

Features

  • Semantic Kernel Integration: Utilizes Microsoft Semantic Kernel for AI-powered conversations
  • Persistent Chat History: SQLite database storage for chat sessions and messages
  • Document Memory: Kernel Memory integration for document context and retrieval
  • RESTful API: Clean API endpoints for chat operations
  • Swagger Documentation: Built-in API documentation and testing interface

Technology Stack

  • .NET 9.0: Latest .NET framework
  • ASP.NET Core: Web API framework
  • Entity Framework Core: Database ORM with SQLite
  • Microsoft Semantic Kernel: AI orchestration framework
  • Kernel Memory: Document processing and retrieval
  • Swagger/OpenAPI: API documentation

API Endpoints

Chat History

  • GET /api/chathistory - Retrieve chat history
  • POST /api/chathistory - Create new chat messages

Documents

  • GET /api/documents - List available documents
  • POST /api/documents - Upload and process documents

Memory

  • GET /api/memory - Query memory store
  • POST /api/memory - Add content to memory

Configuration

  • GET /api/config - Get system configuration

Getting Started

Prerequisites

  • .NET 9.0 SDK
  • OpenAI API key (for Semantic Kernel)

Setup

  1. Clone the repository

    git clone <repository-url>
    cd Semantic-Kernel-POC
  2. Configure settings Create appsettings.Development.json:

    {
      "OpenAI": {
        "ApiKey": "your-openai-api-key",
        "ModelId": "gpt-4"
      },
      "SemanticKernel": {
        "ServiceType": "OpenAI"
      },
      "Database": {
        "ConnectionString": "Data Source=chatbot.db"
      }
    }
  3. Run the application

    dotnet run
  4. Access Swagger UI Navigate to https://localhost:5001/swagger to explore the API

Project Structure

├── Controllers/           # API controllers
│   ├── ChatHistoryController.cs
│   ├── ConfigController.cs
│   ├── DocumentsController.cs
│   └── MemoryController.cs
├── Data/                  # Database context
├── Models/                # Data models and configurations
├── Services/              # Business logic services
├── Documents/             # Sample documents
└── Program.cs             # Application entry point

Configuration Options

OpenAI Configuration

  • ApiKey: Your OpenAI API key
  • ModelId: AI model to use (e.g., "gpt-4", "gpt-3.5-turbo")

Database Configuration

  • ConnectionString: SQLite database connection string

Semantic Kernel Configuration

  • ServiceType: AI service provider ("OpenAI")

Development Workflow

This project follows strict development workflows defined in CLAUDE.md:

  • Design-first approach avoiding over-engineering
  • Task-driven development with TODO tracking
  • One task at a time execution
  • Comprehensive testing and cleanup procedures

Sample Documents

The Documents/ folder contains sample text files that can be used to test document processing and memory features.

Contributing

  1. Follow the workflow rules in CLAUDE.md
  2. Create feature branches using format: feature/task{number}-{description}
  3. Make meaningful commits for each step
  4. Ensure all tests pass before submitting PRs

License

This is a proof-of-concept project for educational and demonstration purposes.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages