Skip to content

Commit

Permalink
Fix Postgres records ordering + Docs update (#224)
Browse files Browse the repository at this point in the history
* Fix Postgres search by similarity SQL to sort records by similarity
(descending)
* Update docs, add links to nuget packages
  • Loading branch information
dluc authored Dec 29, 2023
1 parent 164f1f6 commit eed4b78
Show file tree
Hide file tree
Showing 16 changed files with 167 additions and 47 deletions.
3 changes: 1 addition & 2 deletions COMMUNITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,4 @@ We have a growing and active channel on Discord where you can get help, engage
in lively discussion, and share what you've built with Kernel Memory and
Semantic Kernel!

Join our Discord:
[https://aka.ms/SKDiscord](https://aka.ms/SKDiscord)
[Join our Discord](https://aka.ms/KMdiscord)
102 changes: 77 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
# Kernel Memory

[![License: MIT](https://img.shields.io/github/license/microsoft/kernel-memory)](https://github.com/microsoft/kernel-memory/blob/main/LICENSE)
[![Discord](https://img.shields.io/discord/1063152441819942922?label=Discord&logo=discord&logoColor=white&color=d82679)](https://aka.ms/SKDiscord)
[![Discord](https://img.shields.io/discord/1063152441819942922?label=Discord&logo=discord&logoColor=white&color=d82679)](https://aka.ms/KMdiscord)

**Kernel Memory** (KM) is an open-source [service](service/Service/README.md) and
[plugin](https://www.microsoft.com/en-us/microsoft-365/blog/2023/05/23/empowering-every-developer-with-plugins-for-microsoft-365-copilot/)
**Kernel Memory** (KM) is a **multi-modal [AI Service](service/Service/README.md)**
specialized in the efficient indexing of datasets through custom continuous data
hybrid pipelines. For some scenarios KM is also available as a library, and soon
as a Docker container.
hybrid pipelines, with support for
**[Retrieval Augmented Generation](https://en.wikipedia.org/wiki/Prompt_engineering#Retrieval-augmented_generation)** (RAG),
synthetic memory, prompt engineering, and custom semantic memory processing.

KM includes a GPT **[Plugin](https://www.microsoft.com/en-us/microsoft-365/blog/2023/05/23/empowering-every-developer-with-plugins-for-microsoft-365-copilot/)**,
**web clients**, a .NET library for embedded applications, and soon as a Docker container.

![image](https://github.com/microsoft/kernel-memory/assets/371009/31894afa-d19e-4e9b-8d0f-cb889bf5c77f)

Expand All @@ -22,23 +25,6 @@ Designed for seamless integration as a Plugin with
Copilot and ChatGPT, Kernel Memory enhances data-driven features in applications
built for most popular AI platforms.

## Repository Guidance

This repository is a public resource designed to showcase best practices and efficient architecture
for specific programming scenarios. Although bug fixes and secure, scalable enhancements are part
of our focus, rigorous reviews and strategic considerations of the code are recommended before
production use. Similar to the nature of AI development, the project will rapidly evolve. We warmly
welcome you to participate in the development of Kernel Memory. Feel free to contribute opening
GitHub Issues, sending us PRs, and joining our Discord community. Thank you and happy coding!

### Packages for Python, Java and other languages

A python package with a Web Client and Semantic Kernel plugin will soon be available.
We also welcome PR contributions to support more languages.

In the meantime you can easily connect to Kernel Memory web service following the
existing **OpenAPI** swagger at http://127.0.0.1:9001/swagger/index.html.

### .NET packages

* **Microsoft.KernelMemory.WebClient:** The web client library, can be used to call
Expand All @@ -53,17 +39,74 @@ existing **OpenAPI** swagger at http://127.0.0.1:9001/swagger/index.html.
[![Nuget package](https://img.shields.io/nuget/vpre/Microsoft.KernelMemory.SemanticKernelPlugin)](https://www.nuget.org/packages/Microsoft.KernelMemory.SemanticKernelPlugin/)
[![Example code](https://img.shields.io/badge/example-code-blue)](examples/011-dotnet-using-MemoryPlugin)

* **Microsoft.KernelMemory.Abstractions:** The internal interfaces and models
shared by all packages, used to extend KM to support third party services.
.NET Standard 2.0 compatible.

[![Nuget package](https://img.shields.io/nuget/v/Microsoft.KernelMemory.Abstractions)](https://www.nuget.org/packages/Microsoft.KernelMemory.Abstractions/)

* **Microsoft.KernelMemory.MemoryDb.AzureAISearch:** Memory storage using
**[Azure AI Search](extensions/AzureAISearch)**.

[![Nuget package](https://img.shields.io/nuget/v/Microsoft.KernelMemory.MemoryDb.AzureAISearch)](https://www.nuget.org/packages/Microsoft.KernelMemory.MemoryDb.AzureAISearch/)

* **Microsoft.KernelMemory.MemoryDb.Postgres:** Memory storage using
**[PostgreSQL](extensions/Postgres)**.

[![Nuget package](https://img.shields.io/nuget/v/Microsoft.KernelMemory.MemoryDb.Postgres)](https://www.nuget.org/packages/Microsoft.KernelMemory.MemoryDb.Postgres/)

* **Microsoft.KernelMemory.MemoryDb.Qdrant:** Memory storage using
**[Qdrant](extensions/Qdrant)**.

[![Nuget package](https://img.shields.io/nuget/v/Microsoft.KernelMemory.MemoryDb.Qdrant)](https://www.nuget.org/packages/Microsoft.KernelMemory.MemoryDb.Qdrant/)

* **Microsoft.KernelMemory.AI.AzureOpenAI:** Integration with **[Azure OpenAI](extensions/OpenAI)** LLMs.

[![Nuget package](https://img.shields.io/nuget/v/Microsoft.KernelMemory.AI.AzureOpenAI)](https://www.nuget.org/packages/Microsoft.KernelMemory.AI.AzureOpenAI/)

* **Microsoft.KernelMemory.AI.LlamaSharp:** Integration with **[LLama](extensions/LlamaSharp)** LLMs.

[![Nuget package](https://img.shields.io/nuget/v/Microsoft.KernelMemory.AI.LlamaSharp)](https://www.nuget.org/packages/Microsoft.KernelMemory.AI.LlamaSharp/)

* **Microsoft.KernelMemory.AI.OpenAI:** Integration with **[OpenAI](extensions/OpenAI)** LLMs.

[![Nuget package](https://img.shields.io/nuget/v/Microsoft.KernelMemory.AI.OpenAI)](https://www.nuget.org/packages/Microsoft.KernelMemory.AI.OpenAI/)

* **Microsoft.KernelMemory.DataFormats.AzureAIDocIntel:** Integration with
[Azure AI Document Intelligence](extensions/AzureAIDocIntel).

[![Nuget package](https://img.shields.io/nuget/v/Microsoft.KernelMemory.DataFormats.AzureAIDocIntel)](https://www.nuget.org/packages/Microsoft.KernelMemory.DataFormats.AzureAIDocIntel/)

* **Microsoft.KernelMemory.Orchestration.AzureQueues:** Ingestion and synthetic memory
pipelines via [Azure Queue Storage](extensions/AzureQueues).

[![Nuget package](https://img.shields.io/nuget/v/Microsoft.KernelMemory.Orchestration.AzureQueues)](https://www.nuget.org/packages/Microsoft.KernelMemory.Orchestration.AzureQueues/)

* **Microsoft.KernelMemory.Orchestration.RabbitMQ:** Ingestion and synthetic memory
pipelines via [RabbitMQ](extensions/RabbitMQ).

[![Nuget package](https://img.shields.io/nuget/v/Microsoft.KernelMemory.Orchestration.RabbitMQ)](https://www.nuget.org/packages/Microsoft.KernelMemory.Orchestration.RabbitMQ/)

* **Microsoft.KernelMemory.ContentStorage.AzureBlobs:** Used to store content on
[Azure Storage Blobs](extensions/AzureBlobs).

[![Nuget package](https://img.shields.io/nuget/v/Microsoft.KernelMemory.ContentStorage.AzureBlobs)](https://www.nuget.org/packages/Microsoft.KernelMemory.ContentStorage.AzureBlobs/)

* **Microsoft.KernelMemory.Core:** The core library, can be used to build custom
pipelines and handlers, and contains a serverless client to use memory in a
synchronous way, without the web service. .NET 6+.

[![Nuget package](https://img.shields.io/nuget/vpre/Microsoft.KernelMemory.Core)](https://www.nuget.org/packages/Microsoft.KernelMemory.Core/)
[![Example code](https://img.shields.io/badge/example-code-blue)](examples/001-dotnet-Serverless)

* **Microsoft.KernelMemory.Abstractions:** The internal interfaces and models
shared by all packages. .NET Standard 2.0 compatible.
### Packages for Python, Java and other languages

Kernel Memory service offers a **Web API** out of the box, including the **OpenAPI
swagger** documentation that you can leverage to test the API and create custom
web clients. For instance, after starting the service locally, see http://127.0.0.1:9001/swagger/index.html.

[![Nuget package](https://img.shields.io/nuget/vpre/Microsoft.KernelMemory.Abstractions)](https://www.nuget.org/packages/Microsoft.KernelMemory.Abstractions/)
A python package with a Web Client and Semantic Kernel plugin will soon be available.
We also welcome PR contributions to support more languages.

### Data formats

Expand Down Expand Up @@ -355,3 +398,12 @@ running the service locally with OpenAPI enabled.
5. [Script to start RabbitMQ for development tasks](tools/run-rabbitmq.sh)
6. [.NET appsettings.json generator](tools/InteractiveSetup)
## Repository Guidance
This repository is a public resource designed to showcase best practices and efficient architecture
for specific programming scenarios. Although bug fixes and secure, scalable enhancements are part
of our focus, rigorous reviews and strategic considerations of the code are recommended before
production use. Similar to the nature of AI development, the project will rapidly evolve. We warmly
welcome you to participate in the development of Kernel Memory. Feel free to contribute opening
GitHub Issues, sending us PRs, and joining our Discord community. Thank you and happy coding!
3 changes: 2 additions & 1 deletion extensions/AzureAIDocIntel/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Kernel Memory with Azure AI Document Intelligence

[![Discord](https://img.shields.io/discord/1063152441819942922?label=Discord&logo=discord&logoColor=white&color=d82679)](https://aka.ms/SKDiscord)
[![Nuget package](https://img.shields.io/nuget/v/Microsoft.KernelMemory.DataFormats.AzureAIDocIntel)](https://www.nuget.org/packages/Microsoft.KernelMemory.DataFormats.AzureAIDocIntel/)
[![Discord](https://img.shields.io/discord/1063152441819942922?label=Discord&logo=discord&logoColor=white&color=d82679)](https://aka.ms/KMdiscord)

This project contains the [Azure AI Document Intelligence](https://azure.microsoft.com/products/ai-services/ai-document-intelligence)
adapter allowing to use the Azure service in Kernel Memory to extract content
Expand Down
4 changes: 2 additions & 2 deletions extensions/AzureAISearch/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Kernel Memory with Azure AI Search

[//]: # ([![Nuget package](https://img.shields.io/nuget/Microsoft.KernelMemory.MemoryDb.AzureAISearch)](https://www.nuget.org/packages/Microsoft.KernelMemory.MemoryDb.AzureAISearch/))
[![Discord](https://img.shields.io/discord/1063152441819942922?label=Discord&logo=discord&logoColor=white&color=d82679)](https://aka.ms/SKDiscord)
[![Nuget package](https://img.shields.io/nuget/v/Microsoft.KernelMemory.MemoryDb.AzureAISearch)](https://www.nuget.org/packages/Microsoft.KernelMemory.MemoryDb.AzureAISearch/)
[![Discord](https://img.shields.io/discord/1063152441819942922?label=Discord&logo=discord&logoColor=white&color=d82679)](https://aka.ms/KMdiscord)

This project contains the [Azure AI Search](https://azure.microsoft.com/products/ai-services/ai-search)
adapter allowing to use Kernel Memory with Azure AI Search.
3 changes: 2 additions & 1 deletion extensions/AzureBlobs/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Kernel Memory with Azure Blob Storage

[![Discord](https://img.shields.io/discord/1063152441819942922?label=Discord&logo=discord&logoColor=white&color=d82679)](https://aka.ms/SKDiscord)
[![Nuget package](https://img.shields.io/nuget/v/Microsoft.KernelMemory.ContentStorage.AzureBlobs)](https://www.nuget.org/packages/Microsoft.KernelMemory.ContentStorage.AzureBlobs/)
[![Discord](https://img.shields.io/discord/1063152441819942922?label=Discord&logo=discord&logoColor=white&color=d82679)](https://aka.ms/KMdiscord)

This project contains the [Azure Blob Storage](https://learn.microsoft.com/azure/storage/blobs)
adapter allowing Kernel Memory to upload documents and maintain their state in Azure Blobs.
3 changes: 2 additions & 1 deletion extensions/AzureOpenAI/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Kernel Memory with Azure OpenAI

[![Discord](https://img.shields.io/discord/1063152441819942922?label=Discord&logo=discord&logoColor=white&color=d82679)](https://aka.ms/SKDiscord)
[![Nuget package](https://img.shields.io/nuget/v/Microsoft.KernelMemory.AI.AzureOpenAI)](https://www.nuget.org/packages/Microsoft.KernelMemory.AI.AzureOpenAI/)
[![Discord](https://img.shields.io/discord/1063152441819942922?label=Discord&logo=discord&logoColor=white&color=d82679)](https://aka.ms/KMdiscord)

This project contains the [Azure OpenAI](https://azure.microsoft.com/products/ai-services/openai-service)
LLM connector to access to Azure OpenAI LLM models and generate embeddings and text.
3 changes: 2 additions & 1 deletion extensions/AzureQueues/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Kernel Memory with Azure Queue Storage

[![Discord](https://img.shields.io/discord/1063152441819942922?label=Discord&logo=discord&logoColor=white&color=d82679)](https://aka.ms/SKDiscord)
[![Nuget package](https://img.shields.io/nuget/v/Microsoft.KernelMemory.Orchestration.AzureQueues)](https://www.nuget.org/packages/Microsoft.KernelMemory.Orchestration.AzureQueues/)
[![Discord](https://img.shields.io/discord/1063152441819942922?label=Discord&logo=discord&logoColor=white&color=d82679)](https://aka.ms/KMdiscord)

This project contains the [Azure Queue Storage](https://learn.microsoft.com/azure/storage/queues)
adapter allowing to orchestrate Kernel Memory pipelines with Azure Queues.
12 changes: 9 additions & 3 deletions extensions/LlamaSharp/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
# Kernel Memory with LLama

[![Discord](https://img.shields.io/discord/1063152441819942922?label=Discord&logo=discord&logoColor=white&color=d82679)](https://aka.ms/SKDiscord)
[![Nuget package](https://img.shields.io/nuget/v/Microsoft.KernelMemory.AI.LlamaSharp)](https://www.nuget.org/packages/Microsoft.KernelMemory.AI.LlamaSharp/)
[![Discord](https://img.shields.io/discord/1063152441819942922?label=Discord&logo=discord&logoColor=white&color=d82679)](https://aka.ms/KMdiscord)

This project contains the
[LLama](https://ai.meta.com/blog/large-language-model-llama-meta-ai/)
LLM connector to access to LLama LLM models and generate text,
leveraging the
[LLamaSharp]((https://scisharp.github.io/LLamaSharp)) project.


This project contains the [LLama](https://scisharp.github.io/LLamaSharp)
LLM connector to access to LLama LLM models and generate text.
3 changes: 2 additions & 1 deletion extensions/OpenAI/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Kernel Memory with OpenAI

[![Discord](https://img.shields.io/discord/1063152441819942922?label=Discord&logo=discord&logoColor=white&color=d82679)](https://aka.ms/SKDiscord)
[![Nuget package](https://img.shields.io/nuget/v/Microsoft.KernelMemory.AI.OpenAI)](https://www.nuget.org/packages/Microsoft.KernelMemory.AI.OpenAI/)
[![Discord](https://img.shields.io/discord/1063152441819942922?label=Discord&logo=discord&logoColor=white&color=d82679)](https://aka.ms/KMdiscord)

This project contains the [OpenAI](https://openai.com)
LLM connector to access to OpenAI LLM models and generate embeddings and text.
1 change: 1 addition & 0 deletions extensions/Postgres/Postgres/Db/PostgresDbClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,7 @@ DO UPDATE SET
SELECT {columns}, 1 - ({this._colEmbedding} <=> @embedding) AS {similarityActualValue}
FROM {tableName}
WHERE {filterSql}
ORDER BY {similarityActualValue} DESC
LIMIT @limit
OFFSET @offset
";
Expand Down
4 changes: 2 additions & 2 deletions extensions/Postgres/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Kernel Memory with Postgres + pgvector

[![Nuget package](https://img.shields.io/nuget/vpre/Microsoft.KernelMemory.Postgres)](https://www.nuget.org/packages/Microsoft.KernelMemory.Postgres/)
[![Discord](https://img.shields.io/discord/1063152441819942922?label=Discord&logo=discord&logoColor=white&color=d82679)](https://aka.ms/SKDiscord)
[![Nuget package](https://img.shields.io/nuget/v/Microsoft.KernelMemory.MemoryDb.Postgres)](https://www.nuget.org/packages/Microsoft.KernelMemory.MemoryDb.Postgres/)
[![Discord](https://img.shields.io/discord/1063152441819942922?label=Discord&logo=discord&logoColor=white&color=d82679)](https://aka.ms/KMdiscord)

This project contains the [Postgres](https://www.postgresql.org) adapter allowing
to use Kernel Memory with [Postgres+pgvector](https://github.com/pgvector/pgvector).
Expand Down
3 changes: 2 additions & 1 deletion extensions/Qdrant/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Kernel Memory with Qdrant

[![Discord](https://img.shields.io/discord/1063152441819942922?label=Discord&logo=discord&logoColor=white&color=d82679)](https://aka.ms/SKDiscord)
[![Nuget package](https://img.shields.io/nuget/v/Microsoft.KernelMemory.MemoryDb.Qdrant)](https://www.nuget.org/packages/Microsoft.KernelMemory.MemoryDb.Qdrant/)
[![Discord](https://img.shields.io/discord/1063152441819942922?label=Discord&logo=discord&logoColor=white&color=d82679)](https://aka.ms/KMdiscord)

This project contains the [Qdrant](https://qdrant.tech) adapter allowing to use Kernel Memory with Qdrant.

Expand Down
3 changes: 2 additions & 1 deletion extensions/RabbitMQ/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Kernel Memory with RabbitMQ

[![Discord](https://img.shields.io/discord/1063152441819942922?label=Discord&logo=discord&logoColor=white&color=d82679)](https://aka.ms/SKDiscord)
[![Nuget package](https://img.shields.io/nuget/v/Microsoft.KernelMemory.Orchestration.RabbitMQ)](https://www.nuget.org/packages/Microsoft.KernelMemory.Orchestration.RabbitMQ/)
[![Discord](https://img.shields.io/discord/1063152441819942922?label=Discord&logo=discord&logoColor=white&color=d82679)](https://aka.ms/KMdiscord)

This project contains the [RabbitMQ](https://www.rabbitmq.com/) adapter allowing to orchestrate
Kernel Memory pipelines with RabbitMQ queues.
1 change: 1 addition & 0 deletions service/tests/FunctionalTests/FunctionalTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\..\extensions\Postgres\Postgres\Postgres.csproj" />
<ProjectReference Include="..\..\Abstractions\Abstractions.csproj"/>
<ProjectReference Include="..\..\Core\Core.csproj"/>
<ProjectReference Include="..\..\..\clients\dotnet\SemanticKernelPlugin\SemanticKernelPlugin.csproj"/>
Expand Down
Loading

0 comments on commit eed4b78

Please sign in to comment.