diff --git a/dotnet/src/Functions/Functions.OpenApi/OpenApiKernelPluginFactory.cs b/dotnet/src/Functions/Functions.OpenApi/OpenApiKernelPluginFactory.cs index 62db2dbe95da..1621d06490f4 100644 --- a/dotnet/src/Functions/Functions.OpenApi/OpenApiKernelPluginFactory.cs +++ b/dotnet/src/Functions/Functions.OpenApi/OpenApiKernelPluginFactory.cs @@ -265,7 +265,8 @@ async Task ExecuteAsync(Kernel kernel, KernelFunction // Add unstructured metadata, specific to Open API, to the metadata property bag. var additionalMetadata = new Dictionary { - { OpenApiKernelPluginFactory.OperationExtensionsMethodKey, operation.Method.ToString().ToUpperInvariant() } + { OpenApiKernelPluginFactory.OperationExtensionsMethodKey, operation.Method.ToString().ToUpperInvariant() }, + { OpenApiKernelPluginFactory.OperationExtensionsServerUrlsKey, string.IsNullOrEmpty(operation.Server?.Url) ? Array.Empty() : [ operation.Server!.Url! ] } }; if (operation.Extensions is { Count: > 0 }) { @@ -290,6 +291,9 @@ async Task ExecuteAsync(Kernel kernel, KernelFunction /// The metadata property bag key to use when storing the method of an operation. private const string OperationExtensionsMethodKey = "method"; + /// The metadata property bag key to use when storing the server of an operation. + private const string OperationExtensionsServerUrlsKey = "server-urls"; + /// The metadata property bag key to use for the list of extension values provided in the swagger file at the operation level. private const string OperationExtensionsMetadataKey = "operation-extensions"; diff --git a/dotnet/src/Functions/Functions.UnitTests/OpenApi/Extensions/OpenApiKernelExtensionsTests.cs b/dotnet/src/Functions/Functions.UnitTests/OpenApi/Extensions/OpenApiKernelExtensionsTests.cs index 2f1983ec4382..ded08f4adab4 100644 --- a/dotnet/src/Functions/Functions.UnitTests/OpenApi/Extensions/OpenApiKernelExtensionsTests.cs +++ b/dotnet/src/Functions/Functions.UnitTests/OpenApi/Extensions/OpenApiKernelExtensionsTests.cs @@ -276,12 +276,16 @@ public async Task ItShouldReplicateMetadataToOperationAsync(string documentFileN // Assert Metadata Keys and Values Assert.True(plugin.TryGetFunction("OpenApiExtensions", out var function)); var additionalProperties = function.Metadata.AdditionalProperties; - Assert.Equal(2, additionalProperties.Count); + Assert.Equal(3, additionalProperties.Count); Assert.Contains("method", additionalProperties.Keys); + Assert.Contains("server-urls", additionalProperties.Keys); Assert.Contains("operation-extensions", additionalProperties.Keys); Assert.Equal("GET", additionalProperties["method"]); + var serverUrls = additionalProperties["server-urls"] as string[]; + Assert.NotNull(serverUrls); + Assert.Equal(["https://my-key-vault.vault.azure.net"], serverUrls); // Assert Operation Extension keys var operationExtensions = additionalProperties["operation-extensions"] as Dictionary; diff --git a/dotnet/src/Functions/Functions.UnitTests/OpenApi/OpenApiKernelPluginFactoryTests.cs b/dotnet/src/Functions/Functions.UnitTests/OpenApi/OpenApiKernelPluginFactoryTests.cs index 3ce3f230e888..7b8c59434c37 100644 --- a/dotnet/src/Functions/Functions.UnitTests/OpenApi/OpenApiKernelPluginFactoryTests.cs +++ b/dotnet/src/Functions/Functions.UnitTests/OpenApi/OpenApiKernelPluginFactoryTests.cs @@ -267,12 +267,16 @@ public async Task ItShouldReplicateMetadataToOperationAsync(string documentFileN // Assert Metadata Keys and Values Assert.True(plugin.TryGetFunction("OpenApiExtensions", out var function)); var additionalProperties = function.Metadata.AdditionalProperties; - Assert.Equal(2, additionalProperties.Count); + Assert.Equal(3, additionalProperties.Count); Assert.Contains("method", additionalProperties.Keys); + Assert.Contains("server-urls", additionalProperties.Keys); Assert.Contains("operation-extensions", additionalProperties.Keys); Assert.Equal("GET", additionalProperties["method"]); + var serverUrls = additionalProperties["server-urls"] as string[]; + Assert.NotNull(serverUrls); + Assert.Equal(["https://my-key-vault.vault.azure.net"], serverUrls); // Assert Operation Extension keys var operationExtensions = additionalProperties["operation-extensions"] as Dictionary; diff --git a/dotnet/src/IntegrationTests/Plugins/Web/Google/GoogleTextSearchTests.cs b/dotnet/src/IntegrationTests/Plugins/Web/Google/GoogleTextSearchTests.cs index 1ea798c53a1d..73244ce75d8b 100644 --- a/dotnet/src/IntegrationTests/Plugins/Web/Google/GoogleTextSearchTests.cs +++ b/dotnet/src/IntegrationTests/Plugins/Web/Google/GoogleTextSearchTests.cs @@ -14,6 +14,51 @@ namespace SemanticKernel.IntegrationTests.Plugins.Web.Google; /// public class GoogleTextSearchTests : BaseTextSearchTests { + // If null, all tests will be enabled + private const string SkipReason = "Failing in integration test pipeline because daily quota exceeded"; + + [Fact(Skip = SkipReason)] + public override async Task CanSearchAsync() + { + await base.CanSearchAsync(); + } + + [Fact(Skip = SkipReason)] + public override async Task CanGetTextSearchResultsAsync() + { + await base.CanGetTextSearchResultsAsync(); + } + + [Fact(Skip = SkipReason)] + public override async Task CanGetSearchResultsAsync() + { + await base.CanGetSearchResultsAsync(); + } + + [Fact(Skip = SkipReason)] + public override async Task UsingTextSearchWithAFilterAsync() + { + await base.UsingTextSearchWithAFilterAsync(); + } + + [Fact(Skip = SkipReason)] + public override async Task FunctionCallingUsingCreateWithSearchAsync() + { + await base.FunctionCallingUsingCreateWithSearchAsync(); + } + + [Fact(Skip = SkipReason)] + public override async Task FunctionCallingUsingCreateWithGetSearchResultsAsync() + { + await base.FunctionCallingUsingCreateWithGetSearchResultsAsync(); + } + + [Fact(Skip = SkipReason)] + public override async Task FunctionCallingUsingGetTextSearchResultsAsync() + { + await base.FunctionCallingUsingGetTextSearchResultsAsync(); + } + /// public override Task CreateTextSearchAsync() {