Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Postgres connector for Semantic Memory #946

Merged
merged 17 commits into from May 19, 2023

Conversation

JadynWong
Copy link
Contributor

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

Close #945

@github-actions github-actions bot added .NET Issue or Pull requests regarding .NET code kernel Issues or pull requests impacting the core kernel samples labels May 11, 2023
@JadynWong
Copy link
Contributor Author

@microsoft-github-policy-service agree

@JadynWong JadynWong marked this pull request as draft May 11, 2023 16:56
@JadynWong JadynWong force-pushed the jadyn/feature-postgres-memory branch from d7a1a14 to 4dda575 Compare May 11, 2023 17:23
@JadynWong
Copy link
Contributor Author

JadynWong commented May 11, 2023

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 JadynWong force-pushed the jadyn/feature-postgres-memory branch from 4dda575 to fb79006 Compare May 11, 2023 17:35
@JadynWong JadynWong marked this pull request as ready for review May 11, 2023 17:40
@JadynWong JadynWong force-pushed the jadyn/feature-postgres-memory branch 2 times, most recently from 76960ea to a449a73 Compare May 12, 2023 01:26
@github-actions github-actions bot added the python Pull requests for the Python Semantic Kernel label May 12, 2023
@JadynWong JadynWong force-pushed the jadyn/feature-postgres-memory branch from a449a73 to 7ab1cbd Compare May 12, 2023 01:29
@github-actions github-actions bot removed the python Pull requests for the Python Semantic Kernel label May 12, 2023
Copy link
Member

@lemillermicrosoft lemillermicrosoft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@JadynWong JadynWong force-pushed the jadyn/feature-postgres-memory branch from 7ab1cbd to d83ccc6 Compare May 12, 2023 16:54
@JadynWong
Copy link
Contributor Author

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

Copy link
Member

@lemillermicrosoft lemillermicrosoft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested, works! Thanks again for putting this together. One minor change potentially in the readme. Otherwise LGTM.

@lemillermicrosoft lemillermicrosoft added the PR: ready for review All feedback addressed, ready for reviews label May 12, 2023
@adrianwyatt adrianwyatt self-assigned this May 15, 2023
@adrianwyatt adrianwyatt added PR: feedback to address Waiting for PR owner to address comments/questions and removed PR: ready for review All feedback addressed, ready for reviews labels May 15, 2023
@JadynWong
Copy link
Contributor Author

Hi, @adrianwyatt,

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

Thank you!

@JadynWong
Copy link
Contributor Author

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

@lemillermicrosoft lemillermicrosoft added PR: ready for review All feedback addressed, ready for reviews PR: ready to merge PR has been approved by all reviewers, and is ready to merge. and removed PR: feedback to address Waiting for PR owner to address comments/questions labels May 19, 2023
@adrianwyatt adrianwyatt enabled auto-merge (squash) May 19, 2023 15:55
@adrianwyatt adrianwyatt merged commit c88d42e into microsoft:main May 19, 2023
18 checks passed
@JadynWong JadynWong deleted the jadyn/feature-postgres-memory branch May 20, 2023 00:38
shawncal pushed a commit to shawncal/semantic-kernel that referenced this pull request Jul 6, 2023
### Motivation and Context
Postgres supports cosine similarity search by installing the [pgvector
extension](https://github.com/pgvector/pgvector).

### Description
Add a new Semantic Memory Connector leveraging Postgres with pgvector
extension. Update the syntax example to demonstrate how it is used.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kernel Issues or pull requests impacting the core kernel .NET Issue or Pull requests regarding .NET code PR: ready for review All feedback addressed, ready for reviews PR: ready to merge PR has been approved by all reviewers, and is ready to merge.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use postgres with pgvector extension as memory store
3 participants