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

Python: postgres memory store #1354

Merged
merged 48 commits into from
Jul 11, 2023

Conversation

cschadewitz
Copy link
Contributor

@cschadewitz cschadewitz commented Jun 6, 2023

Motivation and Context

Description

Implemention of the MemoryStore to use a Postgresql (with pgvector extension) to resolve #1270

Taking a different approach from the .net implementation:
Collections as postgres schemas as opposed to collection being another column in the table, willing to change to match but would love to have a discussion comparing the options.

Contribution Checklist

@github-actions github-actions bot added the python Pull requests for the Python Semantic Kernel label Jun 6, 2023
@cschadewitz
Copy link
Contributor Author

@microsoft-github-policy-service agree

@cschadewitz
Copy link
Contributor Author

Working on change to conform to new Memory Record field

@cschadewitz cschadewitz requested a review from a team as a code owner June 19, 2023 16:48
Copy link
Member

@dmytrostruk dmytrostruk left a comment

Choose a reason for hiding this comment

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

@cschadewitz Thank you for contribution! I left initial comments. As soon as they are resolved, we will test it locally and if everything works as expected - merge it to main! 😃

@dmytrostruk dmytrostruk added PR: feedback to address Waiting for PR owner to address comments/questions memory connector ai connector Anything related to AI connectors labels Jun 28, 2023
@nacharya1 nacharya1 changed the title Python postgres memory store Python: postgres memory store Jul 3, 2023
@github-actions github-actions bot added the docs and tests Improvements or additions to documentation label Jul 5, 2023
Copy link
Member

@dmytrostruk dmytrostruk left a comment

Choose a reason for hiding this comment

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

@cschadewitz Thank you for all the hard work! I left some comments, but some of them can be definitely resolved in scope of follow-up PR. I think the most important one which should be resolved before merging to main is regarding timezones, please find the details under my comment. Thanks again!

Thanks again!

@awharrison-28
Copy link
Contributor

Hi @cschadewitz - I'm setting up infra to be able to run the integration tests in CI. As soon as that's set up, we'll get this in asap.

@awharrison-28 awharrison-28 added this pull request to the merge queue Jul 11, 2023
Merged via the queue into microsoft:main with commit 88d67de Jul 11, 2023
@awharrison-28 awharrison-28 removed the PR: feedback to address Waiting for PR owner to address comments/questions label Jul 11, 2023
@robertmujica
Copy link

Great work @cschadewitz , wondering if there is any pre-release i can use to test it ?

@cschadewitz
Copy link
Contributor Author

cschadewitz commented Jul 13, 2023

Great work @cschadewitz , wondering if there is any pre-release i can use to test it ?

Funny you should ask, I made a request for python to get nightly/pre-release builds during yesterdays community hour. Here is another community member that wants pre-release pip packages @alexchaomander .
Thanks!

@robertmujica
Copy link

for now i download the code and added a reference to this file so i can test my kernel with this memory connector, if i find a problem will report here, thanks again for putting it together.

piotrek-appstream pushed a commit to Appstream-Studio/semantic-kernel that referenced this pull request Jul 19, 2023
### Motivation and Context
<!-- Thank you for your contribution to the semantic-kernel repo!
Please help reviewers and future users, providing the following
information:
  1. Why is this change required?
  Brings parity to python implementation
  2. What problem does it solve?
With the pgvector extension, Postgres is a viable option for the storing
of embeddings for memory in Semantic Kernel.
The C# implementation is already capable of this, but the feature has
yet to be added to python.
  3. What scenario does it contribute to?
  Additional options for memory storage
  4. If it fixes an open issue, please link to the issue here.
-->


### Description
Implemention of the MemoryStore to use a Postgresql (with pgvector
extension) to resolve microsoft#1270

Taking a different approach from the .net implementation:
Collections as postgres schemas as opposed to collection being another
column in the table, willing to change to match but would love to have a
discussion comparing the options.




### Contribution Checklist
<!-- Before submitting this PR, please make sure: -->
- [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 😄

---------

Co-authored-by: Dmytro Struk <13853051+dmytrostruk@users.noreply.github.com>
Co-authored-by: Shawn Callegari <36091529+shawncal@users.noreply.github.com>
Co-authored-by: Abby Harrison <abby.harrison@microsoft.com>
Co-authored-by: Abby Harrison <54643756+awharrison-28@users.noreply.github.com>
johnoliver pushed a commit to johnoliver/semantic-kernel that referenced this pull request Jun 5, 2024
### Motivation and Context
<!-- Thank you for your contribution to the semantic-kernel repo!
Please help reviewers and future users, providing the following
information:
  1. Why is this change required?
  Brings parity to python implementation
  2. What problem does it solve?
With the pgvector extension, Postgres is a viable option for the storing
of embeddings for memory in Semantic Kernel.
The C# implementation is already capable of this, but the feature has
yet to be added to python.
  3. What scenario does it contribute to?
  Additional options for memory storage
  4. If it fixes an open issue, please link to the issue here.
-->


### Description
Implemention of the MemoryStore to use a Postgresql (with pgvector
extension) to resolve microsoft#1270

Taking a different approach from the .net implementation:
Collections as postgres schemas as opposed to collection being another
column in the table, willing to change to match but would love to have a
discussion comparing the options.




### Contribution Checklist
<!-- Before submitting this PR, please make sure: -->
- [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 😄

---------

Co-authored-by: Dmytro Struk <13853051+dmytrostruk@users.noreply.github.com>
Co-authored-by: Shawn Callegari <36091529+shawncal@users.noreply.github.com>
Co-authored-by: Abby Harrison <abby.harrison@microsoft.com>
Co-authored-by: Abby Harrison <54643756+awharrison-28@users.noreply.github.com>
johnoliver pushed a commit to johnoliver/semantic-kernel that referenced this pull request Jun 5, 2024
### Motivation and Context
<!-- Thank you for your contribution to the semantic-kernel repo!
Please help reviewers and future users, providing the following
information:
  1. Why is this change required?
  Brings parity to python implementation
  2. What problem does it solve?
With the pgvector extension, Postgres is a viable option for the storing
of embeddings for memory in Semantic Kernel.
The C# implementation is already capable of this, but the feature has
yet to be added to python.
  3. What scenario does it contribute to?
  Additional options for memory storage
  4. If it fixes an open issue, please link to the issue here.
-->


### Description
Implemention of the MemoryStore to use a Postgresql (with pgvector
extension) to resolve microsoft#1270

Taking a different approach from the .net implementation:
Collections as postgres schemas as opposed to collection being another
column in the table, willing to change to match but would love to have a
discussion comparing the options.




### Contribution Checklist
<!-- Before submitting this PR, please make sure: -->
- [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 😄

---------

Co-authored-by: Dmytro Struk <13853051+dmytrostruk@users.noreply.github.com>
Co-authored-by: Shawn Callegari <36091529+shawncal@users.noreply.github.com>
Co-authored-by: Abby Harrison <abby.harrison@microsoft.com>
Co-authored-by: Abby Harrison <54643756+awharrison-28@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ai connector Anything related to AI connectors docs and tests Improvements or additions to documentation memory connector python Pull requests for the Python Semantic Kernel
Projects
Archived in project
Status: Sprint: Done
Development

Successfully merging this pull request may close these issues.

Python: Add Postgres with pgvector as a Memory Store for Python
6 participants