semantic-kernel icon indicating copy to clipboard operation
semantic-kernel copied to clipboard

Postgres connector for Semantic Memory

Open JadynWong opened this issue 1 year ago • 3 comments

Motivation and Context

Postgres supports cosine similarity search by installing the pgvector extension.

Description

Add a new Semantic Memory Connector leveraging Postgres with pgvector extension. Update the syntax example to demonstrate how it is used.

Contribution Checklist

  • [x] The code builds clean without any errors or warnings
  • [x] The PR follows SK Contribution Guidelines (https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md)
  • [x] The code follows the .NET coding conventions (https://learn.microsoft.com/dotnet/csharp/fundamentals/coding-style/coding-conventions) verified with dotnet format
  • [x] All unit tests pass, and I have added new tests where possible
  • [x] I didn't break anyone :smile:

Close #945

JadynWong avatar May 11 '23 10:05 JadynWong

@microsoft-github-policy-service agree

JadynWong avatar May 11 '23 10:05 JadynWong

I need some help, because some packages depend on different versions of nuget and cause conflict warnings when compiling.

Pgvector 0.1.2 -> Npgsql 7.0.0 -> Microsoft.Bcl.HashCode (>= 1.1.1) Pgvector 0.1.2 -> Npgsql 7.0.0 -> System.Text.Json (>= 7.0.0) Pgvector 0.1.2 -> Npgsql 7.0.0 -> System.Text.Json 7.0.0 -> Microsoft.Bcl.AsyncInterfaces (>= 7.0.0) Microsoft.SemanticKernel.Skills.Web -> System.Text.Json 6.0.0 SemanticKernel.Abstractions -> System.Text.Json 6.0.0 ~~

Update

After merge #955, it seems normal.

JadynWong avatar May 11 '23 17:05 JadynWong

Thanks for the PR, looks great overall. If you could add a readme with instructions on quickly setting up postgres locally or even just a link to documentation would be helpful.

I have added the README.md file. https://github.com/JadynWong/semantic-kernel/blob/jadyn/feature-postgres-memory/dotnet/src/Connectors/Connectors.Memory.Postgres/README.md

JadynWong avatar May 12 '23 16:05 JadynWong

Hi, @adrianwyatt,

Can you review these new commits and let me know if there is anything else that can be done?

Thank you!

JadynWong avatar May 19 '23 00:05 JadynWong

Hi @lemillermicrosoft. It looks like the formatting style of the .cs file was changed by #1030. Can you retrigger these actions? Thanks.

JadynWong avatar May 19 '23 08:05 JadynWong