Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/marcominerva/openaiembeddingsample
An example that shows how to use Semantic Kernel and Kernel Memory to work with embeddings in a .NET application using SQL Server as Vector Database.
https://github.com/marcominerva/openaiembeddingsample
azure-openai c-sharp chatgpt dotnet embeddings kernel-memory openai semantic-kernel sql-server vector-database visual-studio
Last synced: 17 days ago
JSON representation
An example that shows how to use Semantic Kernel and Kernel Memory to work with embeddings in a .NET application using SQL Server as Vector Database.
- Host: GitHub
- URL: https://github.com/marcominerva/openaiembeddingsample
- Owner: marcominerva
- License: mit
- Created: 2023-10-27T15:55:10.000Z (about 1 year ago)
- Default Branch: master
- Last Pushed: 2024-10-22T08:24:49.000Z (22 days ago)
- Last Synced: 2024-10-23T12:14:12.192Z (21 days ago)
- Topics: azure-openai, c-sharp, chatgpt, dotnet, embeddings, kernel-memory, openai, semantic-kernel, sql-server, vector-database, visual-studio
- Language: C#
- Homepage:
- Size: 9.53 MB
- Stars: 26
- Watchers: 4
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# OpenAI Embeddings Sample
An example that shows how to use [Semantic Kernel](https://github.com/microsoft/semantic-kernel) and [Kernel Memory](https://github.com/microsoft/kernel-memory) to work with embeddings in a .NET application using [SQL Server as Vector Database](https://github.com/kbeaugrand/SemanticKernel.Connectors.Memory.SqlServer).
The embeddings are stored in a SQL Server database and the Vector Search is efficiently performed thanks to COLUMNSTORE indexes.
To execute the application:
- Create a database in SQL Server
- Open the [AppCostants.cs](https://github.com/marcominerva/OpenAIEmbeddingSample/blob/master/EmbeddingSample/AppConstants.cs) file and set the connection string to the database and the other required parameters. This example assumes you're using Azure OpenAI, but you can easily update it to use OpenAI or whatever LLM you want. Take a look to **Kernel** and **KernelMemoryBuilder** configurations in the [Program.cs](https://github.com/marcominerva/OpenAIEmbeddingSample/blob/master/EmbeddingSample/Program.cs) file
- Import some documents into the memory (search for `await kernelMemory.ImportDocumentAsync` in the [Program.cs](https://github.com/marcominerva/OpenAIEmbeddingSample/blob/master/EmbeddingSample/Program.cs) fileRefer to [Program.cs](https://github.com/marcominerva/OpenAIEmbeddingSample/blob/master/EmbeddingSample/Program.cs) to see how document chunking is performed and how embeddings are calculated, stored and retrieved from the database using Kernel Memory.
If you want to see a manual (explicit) approach to embedding and Vector Search using SQL Server, refer to the [manual-approach branch](https://github.com/marcominerva/OpenAIEmbeddingSample/tree/manual-approach).