Skip to content

Commit

Permalink
Postgres connector for Semantic Memory (microsoft#946)
Browse files Browse the repository at this point in the history
### 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.
  • Loading branch information
JadynWong authored May 19, 2023
1 parent 3232990 commit c88d42e
Show file tree
Hide file tree
Showing 13 changed files with 1,503 additions and 0 deletions.
1 change: 1 addition & 0 deletions FEATURE_MATRIX.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
| Weaviate (Memory) ||| Vector optimized |
| CosmosDB (Memory) ||| CosmosDB is not optimized for vector storage |
| Sqlite (Memory) ||| Sqlite is not optimized for vector storage |
| Postgres (Memory) ||| Vector optimized (required the [pgvector](https://github.com/pgvector/pgvector) extension) |
| Azure Cognitive Search ||| |
| MsGraph ||| Contains connectors for OneDrive, Outlook, ToDos, and Organization Hierarchies |
| Document Skills ||| Currently only supports Word documents |
Expand Down
2 changes: 2 additions & 0 deletions dotnet/Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
<ItemGroup>
<PackageVersion Include="Azure.Search.Documents" Version="11.5.0-beta.2" />
<PackageVersion Include="Microsoft.Bcl.HashCode" Version="[1.1.0, )" />
<PackageVersion Include="Microsoft.Bcl.AsyncInterfaces" Version="[7.0.0, )" />
<PackageVersion Include="Pgvector" Version="0.1.2" />
<PackageVersion Include="System.Linq.Async" Version="[6.0.1, )" />
<PackageVersion Include="System.Text.Json" Version="[6.0.0, )" />
<PackageVersion Include="Azure.AI.OpenAI" Version="[1.0.0-beta.5, )" />
Expand Down
9 changes: 9 additions & 0 deletions dotnet/SK-dotnet.sln
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Connectors.Memory.Sqlite",
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Connectors.Memory.CosmosDB", "src\Connectors\Connectors.Memory.CosmosDB\Connectors.Memory.CosmosDB.csproj", "{EA61C289-7928-4B78-A9C1-7AAD61F907CD}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Connectors.Memory.Postgres", "src\Connectors\Connectors.Memory.Postgres\Connectors.Memory.Postgres.csproj", "{C9F957FA-A70F-4A6D-8F95-23FCD7F4FB87}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Connectors.AI.OpenAI", "src\Connectors\Connectors.AI.OpenAI\Connectors.AI.OpenAI.csproj", "{AFA81EB7-F869-467D-8A90-744305D80AAC}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SemanticKernel.Abstractions", "src\SemanticKernel.Abstractions\SemanticKernel.Abstractions.csproj", "{627742DB-1E52-468A-99BD-6FF1A542D25B}"
Expand Down Expand Up @@ -215,6 +217,12 @@ Global
{EA61C289-7928-4B78-A9C1-7AAD61F907CD}.Publish|Any CPU.Build.0 = Release|Any CPU
{EA61C289-7928-4B78-A9C1-7AAD61F907CD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EA61C289-7928-4B78-A9C1-7AAD61F907CD}.Release|Any CPU.Build.0 = Release|Any CPU
{C9F957FA-A70F-4A6D-8F95-23FCD7F4FB87}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C9F957FA-A70F-4A6D-8F95-23FCD7F4FB87}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C9F957FA-A70F-4A6D-8F95-23FCD7F4FB87}.Publish|Any CPU.ActiveCfg = Publish|Any CPU
{C9F957FA-A70F-4A6D-8F95-23FCD7F4FB87}.Publish|Any CPU.Build.0 = Publish|Any CPU
{C9F957FA-A70F-4A6D-8F95-23FCD7F4FB87}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C9F957FA-A70F-4A6D-8F95-23FCD7F4FB87}.Release|Any CPU.Build.0 = Release|Any CPU
{AFA81EB7-F869-467D-8A90-744305D80AAC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AFA81EB7-F869-467D-8A90-744305D80AAC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AFA81EB7-F869-467D-8A90-744305D80AAC}.Publish|Any CPU.ActiveCfg = Publish|Any CPU
Expand Down Expand Up @@ -308,6 +316,7 @@ Global
{5DEBAA62-F117-496A-8778-FED3604B70E2} = {0247C2C9-86C3-45BA-8873-28B0948EDC0C}
{EC004F12-2F60-4EDD-B3CD-3A504900D929} = {0247C2C9-86C3-45BA-8873-28B0948EDC0C}
{EA61C289-7928-4B78-A9C1-7AAD61F907CD} = {0247C2C9-86C3-45BA-8873-28B0948EDC0C}
{C9F957FA-A70F-4A6D-8F95-23FCD7F4FB87} = {0247C2C9-86C3-45BA-8873-28B0948EDC0C}
{AFA81EB7-F869-467D-8A90-744305D80AAC} = {0247C2C9-86C3-45BA-8873-28B0948EDC0C}
{627742DB-1E52-468A-99BD-6FF1A542D25B} = {831DDCA2-7D2C-4C31-80DB-6BDB3E1F7AE0}
{E3299033-EB81-4C4C-BCD9-E8DC40937969} = {831DDCA2-7D2C-4C31-80DB-6BDB3E1F7AE0}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<!-- THIS PROPERTY GROUP MUST COME FIRST -->
<AssemblyName>Microsoft.SemanticKernel.Connectors.Memory.Postgres</AssemblyName>
<RootNamespace>$(AssemblyName)</RootNamespace>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>

<!-- IMPORT NUGET PACKAGE SHARED PROPERTIES -->
<Import Project="$(RepoRoot)/dotnet/nuget/nuget-package.props" />

<PropertyGroup>
<!-- NuGet Package Settings -->
<Title>Semantic Kernel - Postgres Connector</Title>
<Description>Postgres(with pgvector extension) connector for Semantic Kernel skills and semantic memory</Description>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" />
<PackageReference Include="Pgvector" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\SemanticKernel\SemanticKernel.csproj" />
</ItemGroup>

</Project>
Loading

0 comments on commit c88d42e

Please sign in to comment.