Skip to content

Commit 3b4666e

Browse files
Merge upstream main into fix/vertexai-endpoint
2 parents f505d12 + c028a0c commit 3b4666e

617 files changed

Lines changed: 332 additions & 60504 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

dotnet/Directory.Packages.props

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
<PackageVersion Include="Azure.AI.Projects" Version="2.0.0-beta.2" />
2828
<PackageVersion Include="Azure.Identity" Version="1.21.0" />
2929
<PackageVersion Include="Azure.Monitor.OpenTelemetry.Exporter" Version="1.7.0" />
30-
<PackageVersion Include="Azure.Search.Documents" Version="11.7.0" />
3130
<PackageVersion Include="Community.OData.Linq" Version="2.1.0" />
3231
<PackageVersion Include="Dapr.Actors" Version="1.16.1" />
3332
<PackageVersion Include="Dapr.Actors.AspNetCore" Version="1.16.1" />
@@ -106,17 +105,15 @@
106105
<PackageVersion Include="OpenTelemetry.Instrumentation.Http" Version="1.15.1" />
107106
<PackageVersion Include="OpenTelemetry.Instrumentation.Runtime" Version="1.15.1" />
108107
<PackageVersion Include="PdfPig" Version="0.1.13" />
109-
<PackageVersion Include="Pinecone.Client" Version="3.1.0" />
110108
<PackageVersion Include="Prompty.Core" Version="2.0.0-beta.3" />
111-
<PackageVersion Include="SQLitePCLRaw.lib.e_sqlite3" Version="3.53.3" /> <!-- Transitive dependency of Microsoft.Data.Sqlite pinned to newer version due to vulnerability in <= 2.1.11 (GHSA-2m69-gcr7-jv3q) -->
112109
<PackageVersion Include="PuppeteerSharp" Version="20.2.5" />
113110
<PackageVersion Include="System.Diagnostics.DiagnosticSource" Version="10.0.2" />
114111
<PackageVersion Include="System.IdentityModel.Tokens.Jwt" Version="8.16.0" />
115112
<PackageVersion Include="System.IO.Packaging" Version="10.0.2" />
116113
<PackageVersion Include="System.Linq.AsyncEnumerable" Version="10.0.4" />
117114
<PackageVersion Include="System.Memory.Data" Version="10.0.2" />
118115
<PackageVersion Include="System.Net.Http" Version="4.3.4" />
119-
<PackageVersion Include="System.Numerics.Tensors" Version="10.0.9" />
116+
<PackageVersion Include="System.Numerics.Tensors" Version="10.0.10" />
120117
<PackageVersion Include="System.Text.Json" Version="10.0.6" />
121118
<PackageVersion Include="System.ValueTuple" Version="4.6.2" />
122119
<PackageVersion Include="System.Threading.Tasks.Extensions" Version="4.6.3" />
@@ -172,10 +169,8 @@
172169
<PackageVersion Include="Humanizer" Version="2.14.1" />
173170
<!-- Plugins -->
174171
<PackageVersion Include="DocumentFormat.OpenXml" Version="3.3.0" />
175-
<PackageVersion Include="Microsoft.Data.Sqlite" Version="9.0.10" />
176172
<PackageVersion Include="DuckDB.NET.Data.Full" Version="1.2.0" />
177173
<PackageVersion Include="DuckDB.NET.Data" Version="1.1.3" />
178-
<PackageVersion Include="MongoDB.Driver" Version="3.10.0" />
179174
<PackageVersion Include="Microsoft.Graph" Version="5.105.0" />
180175
<PackageVersion Include="Microsoft.Graph.Core" Version="3.2.6" />
181176
<PackageVersion Include="Microsoft.OpenApi" Version="1.6.24" />
@@ -187,25 +182,14 @@
187182
<PackageVersion Include="YamlDotNet" Version="16.3.0" />
188183
<PackageVersion Include="Fluid.Core" Version="2.31.0" />
189184
<!-- Memory stores -->
190-
<PackageVersion Include="Microsoft.Azure.Cosmos" Version="3.54.0" />
191-
<PackageVersion Include="Pgvector" Version="0.3.2" />
192-
<PackageVersion Include="sqlite-vec" Version="0.1.7-alpha.2.1" />
193-
<PackageVersion Include="NRedisStack" Version="1.0.0" />
194185
<PackageVersion Include="Milvus.Client" Version="2.3.0-preview.1" />
195-
<PackageVersion Include="Testcontainers" Version="4.10.0" />
196186
<PackageVersion Include="Testcontainers.Milvus" Version="4.8.1" />
197187
<PackageVersion Include="Testcontainers.MongoDB" Version="4.6.0" />
198-
<PackageVersion Include="Testcontainers.MsSql" Version="4.6.0" />
199-
<PackageVersion Include="Testcontainers.PostgreSql" Version="4.6.0" />
200-
<PackageVersion Include="Testcontainers.Qdrant" Version="4.10.0" />
201-
<PackageVersion Include="Testcontainers.Redis" Version="4.6.0" />
202-
<PackageVersion Include="Microsoft.Data.SqlClient" Version="6.1.2" />
203-
<PackageVersion Include="Qdrant.Client" Version="1.15.1" />
204188
<!-- VectorData Dependencies -->
205189
<PackageVersion Include="CommunityToolkit.VectorData.AzureAISearch" Version="1.0.0" />
206190
<PackageVersion Include="CommunityToolkit.VectorData.CosmosMongoDB" Version="1.0.0" />
207191
<PackageVersion Include="CommunityToolkit.VectorData.CosmosNoSql" Version="1.0.0" />
208-
<PackageVersion Include="CommunityToolkit.VectorData.InMemory" Version="1.0.0" />
192+
<PackageVersion Include="CommunityToolkit.VectorData.InMemory" Version="1.0.1" />
209193
<PackageVersion Include="CommunityToolkit.VectorData.PgVector" Version="1.0.0" />
210194
<PackageVersion Include="CommunityToolkit.VectorData.Qdrant" Version="1.0.0" />
211195
<PackageVersion Include="CommunityToolkit.VectorData.Redis" Version="1.0.0" />

dotnet/MEVD.slnx

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -20,47 +20,11 @@
2020
<Folder Name="/src/" />
2121
<Folder Name="/src/VectorData/">
2222
<File Path="src/VectorData/Directory.Build.props" />
23-
<Project Path="src/VectorData/AzureAISearch/AzureAISearch.csproj" />
2423
<Project Path="src/VectorData/Chroma/Chroma.csproj" />
25-
<Project Path="src/VectorData/CosmosMongoDB/CosmosMongoDB.csproj" />
26-
<Project Path="src/VectorData/CosmosNoSql/CosmosNoSql.csproj" />
27-
<Project Path="src/VectorData/InMemory/InMemory.csproj" />
2824
<Project Path="src/VectorData/Milvus/Milvus.csproj" />
29-
<Project Path="src/VectorData/MongoDB/MongoDB.csproj" />
30-
<Project Path="src/VectorData/PgVector/PgVector.csproj" />
31-
<Project Path="src/VectorData/Pinecone/Pinecone.csproj" />
32-
<Project Path="src/VectorData/Qdrant/Qdrant.csproj" />
33-
<Project Path="src/VectorData/Redis/Redis.csproj" />
34-
<Project Path="src/VectorData/SqliteVec/SqliteVec.csproj" />
35-
<Project Path="src/VectorData/SqlServer/SqlServer.csproj" />
36-
<Project Path="src/VectorData/Weaviate/Weaviate.csproj" />
3725
</Folder>
3826
<Folder Name="/test/" />
3927
<Folder Name="/test/VectorData/">
40-
<Project Path="test/VectorData/AzureAISearch.ConformanceTests/AzureAISearch.ConformanceTests.csproj" />
41-
<Project Path="test/VectorData/AzureAISearch.UnitTests/AzureAISearch.UnitTests.csproj" />
4228
<Project Path="test/VectorData/Chroma.UnitTests/Chroma.UnitTests.csproj" />
43-
<Project Path="test/VectorData/CosmosMongoDB.ConformanceTests/CosmosMongoDB.ConformanceTests.csproj" />
44-
<Project Path="test/VectorData/CosmosMongoDB.UnitTests/CosmosMongoDB.UnitTests.csproj" />
45-
<Project Path="test/VectorData/CosmosNoSql.ConformanceTests/CosmosNoSql.ConformanceTests.csproj" />
46-
<Project Path="test/VectorData/CosmosNoSql.UnitTests/CosmosNoSql.UnitTests.csproj" />
47-
<Project Path="test/VectorData/InMemory.ConformanceTests/InMemory.ConformanceTests.csproj" />
48-
<Project Path="test/VectorData/InMemory.UnitTests/InMemory.UnitTests.csproj" />
49-
<Project Path="test/VectorData/MongoDB.ConformanceTests/MongoDB.ConformanceTests.csproj" />
50-
<Project Path="test/VectorData/MongoDB.UnitTests/MongoDB.UnitTests.csproj" />
51-
<Project Path="test/VectorData/PgVector.ConformanceTests/PgVector.ConformanceTests.csproj" />
52-
<Project Path="test/VectorData/PgVector.UnitTests/PgVector.UnitTests.csproj" />
53-
<Project Path="test/VectorData/Pinecone.ConformanceTests/Pinecone.ConformanceTests.csproj" />
54-
<Project Path="test/VectorData/Pinecone.UnitTests/Pinecone.UnitTests.csproj" />
55-
<Project Path="test/VectorData/Qdrant.ConformanceTests/Qdrant.ConformanceTests.csproj" />
56-
<Project Path="test/VectorData/Qdrant.UnitTests/Qdrant.UnitTests.csproj" />
57-
<Project Path="test/VectorData/Redis.ConformanceTests/Redis.ConformanceTests.csproj" />
58-
<Project Path="test/VectorData/Redis.UnitTests/Redis.UnitTests.csproj" />
59-
<Project Path="test/VectorData/SqliteVec.ConformanceTests/SqliteVec.ConformanceTests.csproj" />
60-
<Project Path="test/VectorData/SqliteVec.UnitTests/SqliteVec.UnitTests.csproj" />
61-
<Project Path="test/VectorData/SqlServer.ConformanceTests/SqlServer.ConformanceTests.csproj" />
62-
<Project Path="test/VectorData/VectorData.ConformanceTests/VectorData.ConformanceTests.csproj" />
63-
<Project Path="test/VectorData/Weaviate.ConformanceTests/Weaviate.ConformanceTests.csproj" />
64-
<Project Path="test/VectorData/Weaviate.UnitTests/Weaviate.UnitTests.csproj" />
6529
</Folder>
6630
</Solution>

dotnet/src/Connectors/Connectors.Google.UnitTests/Core/Gemini/Clients/GeminiChatClientFunctionCallingTests.cs

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,75 @@ public async Task AsChatClientConvertsServiceToIChatClientAsync()
159159
Assert.IsAssignableFrom<IChatClient>(chatClient);
160160
}
161161

162+
[Fact]
163+
public async Task AutoInvokeDoesNotInvokeFunctionThatWasNotAdvertisedByFunctionChoiceBehaviorAsync()
164+
{
165+
// Arrange - register two functions in the same kernel but only advertise one of them via the
166+
// FunctionChoiceBehavior. The model is then made to request the function that was not advertised.
167+
bool unadvertisedFunctionInvoked = false;
168+
var plugin = KernelPluginFactory.CreateFromFunctions("TestPlugin", new[]
169+
{
170+
KernelFunctionFactory.CreateFromMethod(() => "allowed-result", "AllowedFunction"),
171+
KernelFunctionFactory.CreateFromMethod(() => { unadvertisedFunctionInvoked = true; return "secret"; }, "UnadvertisedFunction"),
172+
});
173+
var kernel = new Kernel();
174+
kernel.Plugins.Add(plugin);
175+
176+
var allowedFunction = kernel.Plugins.GetFunction("TestPlugin", "AllowedFunction");
177+
var settings = new GeminiPromptExecutionSettings
178+
{
179+
FunctionChoiceBehavior = FunctionChoiceBehavior.Auto(functions: [allowedFunction], autoInvoke: true)
180+
};
181+
182+
// The model requests the function that was not advertised, then produces a final text answer.
183+
string functionCallResponse = $$"""
184+
{
185+
"candidates": [
186+
{
187+
"content": {
188+
"parts": [ { "functionCall": { "name": "TestPlugin{{GeminiFunction.NameSeparator}}UnadvertisedFunction", "args": {} } } ],
189+
"role": "model"
190+
},
191+
"finishReason": "STOP",
192+
"index": 0
193+
}
194+
],
195+
"usageMetadata": { "promptTokenCount": 1, "candidatesTokenCount": 1, "totalTokenCount": 2 }
196+
}
197+
""";
198+
string finalTextResponse = """
199+
{
200+
"candidates": [
201+
{
202+
"content": { "parts": [ { "text": "done" } ], "role": "model" },
203+
"finishReason": "STOP",
204+
"index": 0
205+
}
206+
],
207+
"usageMetadata": { "promptTokenCount": 1, "candidatesTokenCount": 1, "totalTokenCount": 2 }
208+
}
209+
""";
210+
using var functionCallHttpResponse = new HttpResponseMessage(System.Net.HttpStatusCode.OK) { Content = new StringContent(functionCallResponse) };
211+
this._messageHandlerStub.ResponseQueue.Enqueue(functionCallHttpResponse);
212+
213+
using var finalTextHttpResponse = new HttpResponseMessage(System.Net.HttpStatusCode.OK) { Content = new StringContent(finalTextResponse) };
214+
this._messageHandlerStub.ResponseQueue.Enqueue(finalTextHttpResponse);
215+
216+
var service = this.CreateChatCompletionService();
217+
var chatHistory = new ChatHistory();
218+
chatHistory.AddUserMessage("Do something");
219+
220+
// Act
221+
var result = await service.GetChatMessageContentsAsync(chatHistory, settings, kernel);
222+
223+
// Assert - the unadvertised function must never be invoked, even though it exists in the kernel.
224+
Assert.False(unadvertisedFunctionInvoked);
225+
// The requested tool call was processed and rejected (not silently ignored): both responses were
226+
// consumed and the model's final text answer was returned.
227+
Assert.Empty(this._messageHandlerStub.ResponseQueue);
228+
Assert.Contains(result, m => m.Content is not null && m.Content.Contains("done", StringComparison.Ordinal));
229+
}
230+
162231
private GoogleAIGeminiChatCompletionService CreateChatCompletionService(HttpClient? httpClient = null)
163232
{
164233
return new GoogleAIGeminiChatCompletionService(

0 commit comments

Comments
 (0)