Skip to content

.Net: First round of MEVD DI changes #10960

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

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ namespace Microsoft.SemanticKernel;
/// <summary>
/// Extension methods to register Azure AI Search <see cref="IVectorStore"/> instances on the <see cref="IKernelBuilder"/>.
/// </summary>
[Obsolete("Call the corresponding method on the Services property of your IKernelBuilder instance.")]
public static class AzureAISearchKernelBuilderExtensions
{
/// <summary>
Expand All @@ -23,7 +24,7 @@ public static class AzureAISearchKernelBuilderExtensions
/// <returns>The kernel builder.</returns>
public static IKernelBuilder AddAzureAISearchVectorStore(this IKernelBuilder builder, AzureAISearchVectorStoreOptions? options = default, string? serviceId = default)
{
builder.Services.AddAzureAISearchVectorStore(options, serviceId);
builder.Services.AddKeyedAzureAISearchVectorStore(serviceId, options);
return builder;
}

Expand All @@ -38,7 +39,7 @@ public static IKernelBuilder AddAzureAISearchVectorStore(this IKernelBuilder bui
/// <returns>The kernel builder.</returns>
public static IKernelBuilder AddAzureAISearchVectorStore(this IKernelBuilder builder, Uri endpoint, TokenCredential tokenCredential, AzureAISearchVectorStoreOptions? options = default, string? serviceId = default)
{
builder.Services.AddAzureAISearchVectorStore(endpoint, tokenCredential, options, serviceId);
builder.Services.AddKeyedAzureAISearchVectorStore(serviceId, endpoint, tokenCredential, options);
return builder;
}

Expand All @@ -53,7 +54,7 @@ public static IKernelBuilder AddAzureAISearchVectorStore(this IKernelBuilder bui
/// <returns>The kernel builder.</returns>
public static IKernelBuilder AddAzureAISearchVectorStore(this IKernelBuilder builder, Uri endpoint, AzureKeyCredential credential, AzureAISearchVectorStoreOptions? options = default, string? serviceId = default)
{
builder.Services.AddAzureAISearchVectorStore(endpoint, credential, options, serviceId);
builder.Services.AddKeyedAzureAISearchVectorStore(serviceId, endpoint, credential, options);
return builder;
}

Expand All @@ -73,7 +74,7 @@ public static IKernelBuilder AddAzureAISearchVectorStoreRecordCollection<TRecord
AzureAISearchVectorStoreRecordCollectionOptions<TRecord>? options = default,
string? serviceId = default)
{
builder.Services.AddAzureAISearchVectorStoreRecordCollection<TRecord>(collectionName, options, serviceId);
builder.Services.AddKeyedAzureAISearchVectorStoreRecordCollection<TRecord>(serviceId, collectionName, options);
return builder;
}

Expand All @@ -97,7 +98,7 @@ public static IKernelBuilder AddAzureAISearchVectorStoreRecordCollection<TRecord
AzureAISearchVectorStoreRecordCollectionOptions<TRecord>? options = default,
string? serviceId = default)
{
builder.Services.AddAzureAISearchVectorStoreRecordCollection<TRecord>(collectionName, endpoint, tokenCredential, options, serviceId);
builder.Services.AddKeyedAzureAISearchVectorStoreRecordCollection<TRecord>(serviceId, collectionName, endpoint, tokenCredential, options);
return builder;
}

Expand All @@ -121,7 +122,7 @@ public static IKernelBuilder AddAzureAISearchVectorStoreRecordCollection<TRecord
AzureAISearchVectorStoreRecordCollectionOptions<TRecord>? options = default,
string? serviceId = default)
{
builder.Services.AddAzureAISearchVectorStoreRecordCollection<TRecord>(collectionName, endpoint, credential, options, serviceId);
builder.Services.AddKeyedAzureAISearchVectorStoreRecordCollection<TRecord>(serviceId, collectionName, endpoint, credential, options);
return builder;
}
}

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Copyright (c) Microsoft. All rights reserved.

using System;
using Microsoft.Extensions.VectorData;
using Microsoft.SemanticKernel.Connectors.AzureCosmosDBMongoDB;
using MongoDB.Driver;
Expand All @@ -9,6 +10,7 @@ namespace Microsoft.SemanticKernel;
/// <summary>
/// Extension methods to register Azure CosmosDB MongoDB <see cref="IVectorStore"/> instances on the <see cref="IKernelBuilder"/>.
/// </summary>
[Obsolete("Call the corresponding method on the Services property of your IKernelBuilder instance.")]
public static class AzureCosmosDBMongoDBKernelBuilderExtensions
{
/// <summary>
Expand All @@ -24,7 +26,7 @@ public static IKernelBuilder AddAzureCosmosDBMongoDBVectorStore(
AzureCosmosDBMongoDBVectorStoreOptions? options = default,
string? serviceId = default)
{
builder.Services.AddAzureCosmosDBMongoDBVectorStore(options, serviceId);
builder.Services.AddKeyedAzureCosmosDBMongoDBVectorStore(serviceId, options);
return builder;
}

Expand All @@ -45,7 +47,7 @@ public static IKernelBuilder AddAzureCosmosDBMongoDBVectorStore(
AzureCosmosDBMongoDBVectorStoreOptions? options = default,
string? serviceId = default)
{
builder.Services.AddAzureCosmosDBMongoDBVectorStore(connectionString, databaseName, options, serviceId);
builder.Services.AddKeyedAzureCosmosDBMongoDBVectorStore(serviceId, connectionString, databaseName, options);
return builder;
}

Expand All @@ -65,7 +67,7 @@ public static IKernelBuilder AddAzureCosmosDBMongoDBVectorStoreRecordCollection<
AzureCosmosDBMongoDBVectorStoreRecordCollectionOptions<TRecord>? options = default,
string? serviceId = default)
{
builder.Services.AddAzureCosmosDBMongoDBVectorStoreRecordCollection<TRecord>(collectionName, options, serviceId);
builder.Services.AddKeyedAzureCosmosDBMongoDBVectorStoreRecordCollection<TRecord>(serviceId, collectionName, options);
return builder;
}

Expand All @@ -89,7 +91,7 @@ public static IKernelBuilder AddAzureCosmosDBMongoDBVectorStoreRecordCollection<
AzureCosmosDBMongoDBVectorStoreRecordCollectionOptions<TRecord>? options = default,
string? serviceId = default)
{
builder.Services.AddAzureCosmosDBMongoDBVectorStoreRecordCollection<TRecord>(collectionName, connectionString, databaseName, options, serviceId);
builder.Services.AddKeyedAzureCosmosDBMongoDBVectorStoreRecordCollection<TRecord>(serviceId, collectionName, connectionString, databaseName, options);
return builder;
}
}
Loading
Loading