Skip to content

Commit

Permalink
.Net: Simplify memory namespaces (#4230)
Browse files Browse the repository at this point in the history
Closes task `#1` of the issue -
#3151

### Description

The `Memory` keyword is removed from the namespaces to make them
slightly shorter and aligned with AI connector namespaces:
- `Microsoft.SemanticKernel.Connectors.Memory.Chroma` ->
`Microsoft.SemanticKernel.Connectors.Chroma`
- `Microsoft.SemanticKernel.Connectors.Memory.AzureAISearch` ->
`Microsoft.SemanticKernel.Connectors.AzureAISearch`
- same for Kusto, Milvus, etc

The `MemoryBuilder`, `VolatileMemoryStore` classes that live in the
`Plugins.Memory` project under the
`Microsoft.SemanticKernel.Plugins.Memory` namespace are moved to
`Microsoft.SemanticKernel.Memory` namespace where they naturally belong
to.

---------

Co-authored-by: Mark Wallace <127216156+markwallace-microsoft@users.noreply.github.com>
  • Loading branch information
SergeyMenshykh and markwallace-microsoft authored Dec 13, 2023
1 parent c410053 commit 0095578
Show file tree
Hide file tree
Showing 168 changed files with 212 additions and 243 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.SemanticKernel.Connectors.Memory.AzureAISearch;
using Microsoft.SemanticKernel.Connectors.AzureAISearch;
using Microsoft.SemanticKernel.Connectors.OpenAI;
using Microsoft.SemanticKernel.Memory;
using Microsoft.SemanticKernel.Plugins.Memory;

/* The files contains two examples about SK Semantic Memory.
*
Expand Down
22 changes: 11 additions & 11 deletions dotnet/samples/KernelSyntaxExamples/Example15_TextMemoryPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@
using System.Threading;
using System.Threading.Tasks;
using Microsoft.SemanticKernel;
using Microsoft.SemanticKernel.Connectors.Memory.AzureAISearch;
using Microsoft.SemanticKernel.Connectors.Memory.Chroma;
using Microsoft.SemanticKernel.Connectors.Memory.DuckDB;
using Microsoft.SemanticKernel.Connectors.Memory.Kusto;
using Microsoft.SemanticKernel.Connectors.Memory.MongoDB;
using Microsoft.SemanticKernel.Connectors.Memory.Pinecone;
using Microsoft.SemanticKernel.Connectors.Memory.Postgres;
using Microsoft.SemanticKernel.Connectors.Memory.Qdrant;
using Microsoft.SemanticKernel.Connectors.Memory.Redis;
using Microsoft.SemanticKernel.Connectors.Memory.Sqlite;
using Microsoft.SemanticKernel.Connectors.Memory.Weaviate;
using Microsoft.SemanticKernel.Connectors.AzureAISearch;
using Microsoft.SemanticKernel.Connectors.Chroma;
using Microsoft.SemanticKernel.Connectors.DuckDB;
using Microsoft.SemanticKernel.Connectors.Kusto;
using Microsoft.SemanticKernel.Connectors.MongoDB;
using Microsoft.SemanticKernel.Connectors.OpenAI;
using Microsoft.SemanticKernel.Connectors.Pinecone;
using Microsoft.SemanticKernel.Connectors.Postgres;
using Microsoft.SemanticKernel.Connectors.Qdrant;
using Microsoft.SemanticKernel.Connectors.Redis;
using Microsoft.SemanticKernel.Connectors.Sqlite;
using Microsoft.SemanticKernel.Connectors.Weaviate;
using Microsoft.SemanticKernel.Memory;
using Microsoft.SemanticKernel.Plugins.Memory;
using Npgsql;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
using Microsoft.SemanticKernel.Memory;
using Microsoft.SemanticKernel.Text;

namespace Microsoft.SemanticKernel.Connectors.Memory.AzureAISearch;
namespace Microsoft.SemanticKernel.Connectors.AzureAISearch;

/// <summary>
/// Azure AI Search record and index definition.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
using Microsoft.SemanticKernel.Http;
using Microsoft.SemanticKernel.Memory;

namespace Microsoft.SemanticKernel.Connectors.Memory.AzureAISearch;
namespace Microsoft.SemanticKernel.Connectors.AzureAISearch;

/// <summary>
/// <see cref="AzureAISearchMemoryStore"/> is a memory store implementation using Azure AI Search.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<!-- THIS PROPERTY GROUP MUST COME FIRST -->
<AssemblyName>Microsoft.SemanticKernel.Connectors.Memory.AzureAISearch</AssemblyName>
<RootNamespace>Microsoft.SemanticKernel.Connectors.Memory.AzureAISearch</RootNamespace>
<AssemblyName>Microsoft.SemanticKernel.Connectors.AzureAISearch</AssemblyName>
<RootNamespace>Microsoft.SemanticKernel.Connectors.AzureAISearch</RootNamespace>
<TargetFramework>netstandard2.0</TargetFramework>

<!--NU5104: A stable release of a package should not have a prerelease dependency.-->
Expand All @@ -15,7 +15,7 @@

<PropertyGroup>
<!-- NuGet Package Settings -->
<PackageId>Microsoft.SemanticKernel.Connectors.Memory.AzureAISearch</PackageId>
<PackageId>Microsoft.SemanticKernel.Connectors.AzureAISearch</PackageId>
<Title>Semantic Kernel - Azure AI Search Semantic Memory</Title>
<Description>Azure AI Search Semantic Memory connector for Semantic Kernel</Description>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using Azure;
using Microsoft.SemanticKernel.Http;

namespace Microsoft.SemanticKernel.Connectors.Memory.AzureAISearch;
namespace Microsoft.SemanticKernel.Connectors.AzureAISearch;

/// <summary>
/// Provides extension methods for the <see cref="RequestFailedException"/> class.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,9 @@
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Abstractions;
using Microsoft.SemanticKernel.Connectors.Memory.Chroma.Http.ApiSchema;
using Microsoft.SemanticKernel.Connectors.Memory.Chroma.Http.ApiSchema.Internal;
using Microsoft.SemanticKernel.Http;

namespace Microsoft.SemanticKernel.Connectors.Memory.Chroma;
namespace Microsoft.SemanticKernel.Connectors.Chroma;

/// <summary>
/// An implementation of a client for the Chroma Vector DB. This class is used to
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

using System.Net.Http;
using Microsoft.SemanticKernel.Http;
using Microsoft.SemanticKernel.Plugins.Memory;
using Microsoft.SemanticKernel.Memory;

namespace Microsoft.SemanticKernel.Connectors.Memory.Chroma;
namespace Microsoft.SemanticKernel.Connectors.Chroma;

/// <summary>
/// Provides extension methods for the <see cref="MemoryBuilder"/> class to configure Chroma memory connector.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,11 @@
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Abstractions;
using Microsoft.SemanticKernel.Connectors.Memory.Chroma.Http.ApiSchema;
using Microsoft.SemanticKernel.Http;
using Microsoft.SemanticKernel.Memory;
using Microsoft.SemanticKernel.Text;

namespace Microsoft.SemanticKernel.Connectors.Memory.Chroma;
namespace Microsoft.SemanticKernel.Connectors.Chroma;

/// <summary>
/// An implementation of <see cref="IMemoryStore" /> for Chroma.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<!-- THIS PROPERTY GROUP MUST COME FIRST -->
<AssemblyName>Microsoft.SemanticKernel.Connectors.Memory.Chroma</AssemblyName>
<AssemblyName>Microsoft.SemanticKernel.Connectors.Chroma</AssemblyName>
<RootNamespace>$(AssemblyName)</RootNamespace>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

using System.Text.Json.Serialization;

namespace Microsoft.SemanticKernel.Connectors.Memory.Chroma.Http.ApiSchema;
namespace Microsoft.SemanticKernel.Connectors.Chroma;

/// <summary>
/// Chroma collection model.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using System.Collections.Generic;
using System.Text.Json.Serialization;

namespace Microsoft.SemanticKernel.Connectors.Memory.Chroma.Http.ApiSchema;
namespace Microsoft.SemanticKernel.Connectors.Chroma;

/// <summary>
/// Chroma embeddings model.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using System.Collections.Generic;
using System.Text.Json.Serialization;

namespace Microsoft.SemanticKernel.Connectors.Memory.Chroma.Http.ApiSchema;
namespace Microsoft.SemanticKernel.Connectors.Chroma;

/// <summary>
/// Chroma query result model. Contains result sets after search operation.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using System.Net.Http;
using System.Text.Json.Serialization;

namespace Microsoft.SemanticKernel.Connectors.Memory.Chroma.Http.ApiSchema.Internal;
namespace Microsoft.SemanticKernel.Connectors.Chroma;

internal sealed class CreateCollectionRequest
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using System.Net.Http;
using System.Text.Json.Serialization;

namespace Microsoft.SemanticKernel.Connectors.Memory.Chroma.Http.ApiSchema.Internal;
namespace Microsoft.SemanticKernel.Connectors.Chroma;

internal sealed class DeleteCollectionRequest
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using System.Net.Http;
using System.Text.Json.Serialization;

namespace Microsoft.SemanticKernel.Connectors.Memory.Chroma.Http.ApiSchema.Internal;
namespace Microsoft.SemanticKernel.Connectors.Chroma;

internal sealed class DeleteEmbeddingsRequest
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using System.Net.Http;
using System.Text.Json.Serialization;

namespace Microsoft.SemanticKernel.Connectors.Memory.Chroma.Http.ApiSchema.Internal;
namespace Microsoft.SemanticKernel.Connectors.Chroma;

internal sealed class GetCollectionRequest
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using System.Net.Http;
using System.Text.Json.Serialization;

namespace Microsoft.SemanticKernel.Connectors.Memory.Chroma.Http.ApiSchema.Internal;
namespace Microsoft.SemanticKernel.Connectors.Chroma;

internal sealed class GetEmbeddingsRequest
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

using System.Net.Http;

namespace Microsoft.SemanticKernel.Connectors.Memory.Chroma.Http.ApiSchema.Internal;
namespace Microsoft.SemanticKernel.Connectors.Chroma;

internal sealed class ListCollectionsRequest
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using System.Net.Http;
using System.Text.Json.Serialization;

namespace Microsoft.SemanticKernel.Connectors.Memory.Chroma.Http.ApiSchema.Internal;
namespace Microsoft.SemanticKernel.Connectors.Chroma;

internal sealed class QueryEmbeddingsRequest
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using System.Net.Http;
using System.Text.Json.Serialization;

namespace Microsoft.SemanticKernel.Connectors.Memory.Chroma.Http.ApiSchema.Internal;
namespace Microsoft.SemanticKernel.Connectors.Chroma;

internal sealed class UpsertEmbeddingsRequest
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.SemanticKernel.Connectors.Memory.Chroma.Http.ApiSchema;

namespace Microsoft.SemanticKernel.Connectors.Memory.Chroma;
namespace Microsoft.SemanticKernel.Connectors.Chroma;

/// <summary>
/// Interface for client to make requests to Chroma API.
Expand Down
2 changes: 1 addition & 1 deletion dotnet/src/Connectors/Connectors.Memory.Chroma/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Microsoft.SemanticKernel.Connectors.Memory.Chroma
# Microsoft.SemanticKernel.Connectors.Chroma

This assembly contains implementation of Semantic Kernel Memory Store using [Chroma](https://docs.trychroma.com/), open-source embedding database.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<!-- THIS PROPERTY GROUP MUST COME FIRST -->
<AssemblyName>Microsoft.SemanticKernel.Connectors.Memory.DuckDB</AssemblyName>
<AssemblyName>Microsoft.SemanticKernel.Connectors.DuckDB</AssemblyName>
<RootNamespace>$(AssemblyName)</RootNamespace>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion dotnet/src/Connectors/Connectors.Memory.DuckDB/Database.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
using System.Threading.Tasks;
using DuckDB.NET.Data;

namespace Microsoft.SemanticKernel.Connectors.Memory.DuckDB;
namespace Microsoft.SemanticKernel.Connectors.DuckDB;

internal struct DatabaseEntry
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

using System.Data.Common;

namespace Microsoft.SemanticKernel.Connectors.Memory.DuckDB;
namespace Microsoft.SemanticKernel.Connectors.DuckDB;

internal static class DuckDBExtensions
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
using DuckDB.NET.Data;
using Microsoft.SemanticKernel.Memory;

namespace Microsoft.SemanticKernel.Connectors.Memory.DuckDB;
namespace Microsoft.SemanticKernel.Connectors.DuckDB;

/// <summary>
/// An implementation of <see cref="IMemoryStore"/> backed by a DuckDB database.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<!-- THIS PROPERTY GROUP MUST COME FIRST -->
<AssemblyName>Microsoft.SemanticKernel.Connectors.Memory.Kusto</AssemblyName>
<RootNamespace>Microsoft.SemanticKernel.Connectors.Memory.Kusto</RootNamespace>
<AssemblyName>Microsoft.SemanticKernel.Connectors.Kusto</AssemblyName>
<RootNamespace>Microsoft.SemanticKernel.Connectors.Kusto</RootNamespace>
<TargetFramework>netstandard2.0</TargetFramework>

<!--NU5104: A stable release of a package should not have a prerelease dependency.-->
Expand All @@ -15,7 +15,7 @@

<PropertyGroup>
<!-- NuGet Package Settings -->
<PackageId>Microsoft.SemanticKernel.Connectors.Memory.Kusto</PackageId>
<PackageId>Microsoft.SemanticKernel.Connectors.Kusto</PackageId>
<Title>Semantic Kernel - Azure Data Explorer (Kusto) Semantic Memory</Title>
<Description>Azure Data Explorer (Kusto) Semantic Memory connector for Semantic Kernel</Description>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
using Microsoft.SemanticKernel.Memory;
using Microsoft.SemanticKernel.Text;

namespace Microsoft.SemanticKernel.Connectors.Memory.Kusto;
namespace Microsoft.SemanticKernel.Connectors.Kusto;

/// <summary>
/// Kusto memory record entity.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
using Microsoft.SemanticKernel.Http;
using Microsoft.SemanticKernel.Memory;

namespace Microsoft.SemanticKernel.Connectors.Memory.Kusto;
namespace Microsoft.SemanticKernel.Connectors.Kusto;

/// <summary>
/// An implementation of <see cref="IMemoryStore"/> backed by a Kusto database.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
using Microsoft.SemanticKernel.Memory;
using Microsoft.SemanticKernel.Text;

namespace Microsoft.SemanticKernel.Connectors.Memory.Kusto;
namespace Microsoft.SemanticKernel.Connectors.Kusto;

/// <summary>
/// Contains serialization/deserialization logic for memory record properties in Kusto.
Expand Down
2 changes: 1 addition & 1 deletion dotnet/src/Connectors/Connectors.Memory.Kusto/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Microsoft.SemanticKernel.Connectors.Memory.Kusto
# Microsoft.SemanticKernel.Connectors.Kusto

This connector uses [Azure Data Explorer (Kusto)](https://learn.microsoft.com/en-us/azure/data-explorer/) to implement Semantic Memory.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<!-- THIS PROPERTY GROUP MUST COME FIRST -->
<AssemblyName>Microsoft.SemanticKernel.Connectors.Memory.Milvus</AssemblyName>
<AssemblyName>Microsoft.SemanticKernel.Connectors.Milvus</AssemblyName>
<RootNamespace>$(AssemblyName)</RootNamespace>
<TargetFrameworks>net6.0;netstandard2.0</TargetFrameworks>
<Nullable>enable</Nullable>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
using Microsoft.SemanticKernel.Memory;
using Milvus.Client;

namespace Microsoft.SemanticKernel.Connectors.Memory.Milvus;
namespace Microsoft.SemanticKernel.Connectors.Milvus;

/// <summary>
/// An implementation of <see cref="IMemoryStore" /> for the Milvus vector database.
Expand Down
2 changes: 1 addition & 1 deletion dotnet/src/Connectors/Connectors.Memory.Milvus/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Microsoft.SemanticKernel.Connectors.Memory.Milvus
# Microsoft.SemanticKernel.Connectors.Milvus

This is an implementation of the Semantic Kernel Memory Store abstraction for the [Milvus vector database](https://milvus.io).

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<!-- THIS PROPERTY GROUP MUST COME FIRST -->
<AssemblyName>Microsoft.SemanticKernel.Connectors.Memory.MongoDB</AssemblyName>
<AssemblyName>Microsoft.SemanticKernel.Connectors.MongoDB</AssemblyName>
<RootNamespace>$(AssemblyName)</RootNamespace>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using MongoDB.Bson;
using MongoDB.Bson.Serialization.Attributes;

namespace Microsoft.SemanticKernel.Connectors.Memory.MongoDB;
namespace Microsoft.SemanticKernel.Connectors.MongoDB;

/// <summary>
/// A MongoDB memory entry.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using Microsoft.SemanticKernel.Memory;
using MongoDB.Bson.Serialization.Attributes;

namespace Microsoft.SemanticKernel.Connectors.Memory.MongoDB;
namespace Microsoft.SemanticKernel.Connectors.MongoDB;

/// <summary>
/// A MongoDB record metadata.
Expand Down
Loading

0 comments on commit 0095578

Please sign in to comment.