This ASP.Net web application exposes the Semantic Kernel through a REST-like interface.
Before you get started, make sure you have the following requirements in place:
-
.NET 6.0 for building and deploying .NET 6 projects.
-
Update the properties in
./appsettings.jsonto configure your Azure OpenAI resource or OpenAI account. -
Generate and trust a localhost developer certificate.
- For Windows and Mac run
dotnet dev-certs https --trust`Select
Yeswhen asked if you want to install this certificate. - For Linux run
dotnet dev-certs https
To verify the certificate has been installed and trusted, run
dotnet run dev-certs https --checkTo clean your system of the developer certificate, run
dotnet run dev-certs https --clean - For Windows and Mac run
-
(Optional) Visual Studio Code or Visual Studio.
You can start the WebApi service using the command-line, Visual Studio Code, or Visual Studio.
- Open a terminal
- Change directory to the Copilot Chat webapi project directory.
cd semantic-kernel/samples/apps/copilot-chat-app/webapi - (Optional) Build the service and verify there are no errors.
dotnet build - Run the service
dotnet run - Early in the startup, the service will provide a probe endpoint you can use in a web browser to verify
the service is running.
info: Microsoft.SemanticKernel.Kernel[0] Health probe: https://localhost:40443/probe
- build (CopilotChatApi)
- run (CopilotChatApi)
- [optional] watch (CopilotChatApi)
- Open the solution file in Visual Studio 2022 or newer (
semantic-kernel/dotnet/SK-dotnet.sln). - In the solution explorer expand the
samplesfolder. - Right-click on the
CopilotChatApiand selectSet as Startup Project. - Start debugging by pressing
F5or selecting the menu itemDebug->Start Debugging.
By default, the service uses an in-memory volatile memory store that, when the service stops or restarts, forgets all memories. Qdrant is a persistent scalable vector search engine that can be deployed locally in a container or at-scale in the cloud.
To enable the Qdrant memory store, you must first deploy Qdrant locally and then configure the Copilot Chat API service to use it.
Before you get started, make sure you have the following additional requirements in place:
- Docker Desktop for hosting the Qdrant vector search engine.
-
Open a terminal and use Docker to pull down the container image.
docker pull qdrant/qdrant
-
Change directory to this repo and create a
./data/qdrantdirectory to use as persistent storage. Then start the Qdrant container on port6333using the./data/qdrantfolder as the persistent storage location.cd /src/semantic-kernel mkdir ./data/qdrant docker run --name copilotchat -p 6333:6333 -v "$(pwd)/data/qdrant:/qdrant/storage" qdrant/qdrant
To stop the container, in another terminal window run
docker container stop copilotchat; docker container rm copilotchat;.