Skip to content
This repository has been archived by the owner on Nov 18, 2023. It is now read-only.

Atlas MongoDB connector for Semantic Kernel skills and semantic memory

License

Notifications You must be signed in to change notification settings

kbeaugrand/SemanticKernel.Connectors.Memory.MongoDB

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Semantic Kernel - MongoDB Connector

This package has been deprecated as it is legacy and is no longer maintained. This package is now no longer needed as the connector is now part of the Semantic Kernel Core repository. Suggested Alternatives: Microsoft.SemanticKernel.Connectors.Memory.MongoDB

Build & Test Create Release Version License

This is a connector for the Semantic Kernel.

It provides a connection to a MongoDB Atlas database for the Semantic Kernel for the memories.

Note: It leverage on MongoDB Atlas Vector Search to provide vector search, this cannot work while running private instance of OpenSource MongoDB clusters.

About Semantic Kernel

Semantic Kernel (SK) is a lightweight SDK enabling integration of AI Large Language Models (LLMs) with conventional programming languages. The SK extensible programming model combines natural language semantic functions, traditional code native functions, and embeddings-based memory unlocking new potential and adding value to applications with AI.

Please take a look at Semantic Kernel for more information.

Installation

To install this memory store, you need to add the required nuget package to your project:

dotnet add package SemanticKernel.Connectors.Memory.MongoDB --version 1.0.0-beta1

Create the collection and the Search index

Please refer to the documentation to get more details on how to define an MongoDB Atlas Vector Search index. You can name the index default and create the index. Finally, write the following definition in the JSON editor on MongoDB Atlas:

{
  "mappings": {
    "dynamic": true,
    "fields": {
      "Embedding": {
        "dimensions": 1536,
        "similarity": "cosine",
        "type": "knnVector"
      }
    }
  }
}

Usage

To add your MongoDB Server memory connector, add the following statements to your kernel initialization code:

using SemanticKernel.Connectors.Memory.MongoDB;
...
var kernel = Kernel.Builder
            ...
                .WithMemoryStorage(MongoDBMemoryStore.Connect(connectionString: <your_connection_string>, database: <your_database>))
            ...
                .Build();

The memory store will populate all the needed tables during startup and let you focus on the development of your plugin.

License

This project is licensed under the MIT License.