Skip to content
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

Updating to latest MEAI #500

Merged
merged 2 commits into from
Feb 25, 2025
Merged
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
5 changes: 4 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,8 @@
},
"rust-analyzer.linkedProjects": [
"examples/rust/actix_api/Cargo.toml",
]
],
"[aspnetcorerazor]": {
"editor.defaultFormatter": "ms-dotnettools.csharp"
}
}
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<DotNetExtensionsVersion>9.0.0</DotNetExtensionsVersion>
<OpenTelemetryVersion>1.11.0</OpenTelemetryVersion>
<TestContainersVersion>4.2.0</TestContainersVersion>
<MEAIVersion>9.1.0-preview.1.25064.3</MEAIVersion>
<MEAIVersion>9.3.0-preview.1.25114.11</MEAIVersion>
<IsPackable>false</IsPackable>
<UsePublicApiAnalyzers>true</UsePublicApiAnalyzers>

Expand Down
2 changes: 1 addition & 1 deletion Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
<!-- External packages -->
<PackageVersion Include="Azure.Provisioning.AppContainers" Version="1.0.0" />
<PackageVersion Include="JsonSchema.Net" Version="7.3.3" />
<PackageVersion Include="OllamaSharp" Version="5.0.6" />
<PackageVersion Include="OllamaSharp" Version="5.1.2" />
<PackageVersion Include="OpenFeature.Contrib.GOFeatureFlag" Version="0.2.0" />
<PackageVersion Include="MassTransit" Version="8.3.6" />
<PackageVersion Include="MassTransit.ActiveMQ" Version="8.3.1" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
<div>
<label>
<InputRadio Value="ServiceKeys.Phi3" />
@OllamaClient1.Metadata.ModelId
@(OllamaClient1.GetService<ChatClientMetadata>()?.ModelId)
</label>
</div>
<div>
<label>
<InputRadio Value="ServiceKeys.Llama" />
@OllamaClient2.Metadata.ModelId
@(OllamaClient2.GetService<ChatClientMetadata>()?.ModelId)
</label>
</div>
</InputRadioGroup>
Expand Down Expand Up @@ -61,7 +61,7 @@
bool gotResponse = false;
_response = "Asking Ollama...";

var stream = client.CompleteStreamingAsync(_prompt);
var stream = client.GetStreamingResponseAsync(_prompt);

await foreach (var answerToken in stream)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,8 @@ public void RegisteringChatClientAndEmbeddingGeneratorReturnsCorrectModelForServ
var chatClient = host.Services.GetRequiredService<IChatClient>();
var embeddingGenerator = host.Services.GetRequiredService<IEmbeddingGenerator<string, Embedding<float>>>();

Assert.Equal("Chat", chatClient.Metadata.ModelId);
Assert.Equal("Embedding", embeddingGenerator.Metadata.ModelId);
Assert.Equal("Chat", chatClient.GetService<ChatClientMetadata>()?.ModelId);
Assert.Equal("Embedding", embeddingGenerator.GetService<EmbeddingGeneratorMetadata>()?.ModelId);
}

[Fact]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ public void ReadsFromConnectionStringCorrectly(bool useKeyed)
host.Services.GetRequiredKeyedService<IChatClient>("Ollama") :
host.Services.GetRequiredService<IChatClient>();

Assert.NotNull(client.Metadata.ProviderUri);
Assert.Equal(Endpoint, client.Metadata.ProviderUri);
Assert.NotNull(client.GetService<ChatClientMetadata>()?.ProviderUri);
Assert.Equal(Endpoint, client.GetService<ChatClientMetadata>()?.ProviderUri);
}

[Theory]
Expand All @@ -61,9 +61,9 @@ public void CanSetConnectionStringInCode(bool useKeyed)
host.Services.GetRequiredKeyedService<IChatClient>("Ollama") :
host.Services.GetRequiredService<IChatClient>();

Assert.NotNull(client.Metadata.ProviderUri);
Assert.Equal(Endpoint, client.Metadata.ProviderUri);
Assert.DoesNotContain("http://not-used", client.Metadata.ProviderUri.ToString());
Assert.NotNull(client.GetService<ChatClientMetadata>()?.ProviderUri);
Assert.Equal(Endpoint, client.GetService<ChatClientMetadata>()?.ProviderUri);
Assert.DoesNotContain("http://not-used", client.GetService<ChatClientMetadata>()?.ProviderUri?.ToString());
}

[Theory]
Expand Down Expand Up @@ -91,9 +91,9 @@ public void ConnectionStringWinsOverConfigSection(bool useKeyed)
host.Services.GetRequiredKeyedService<IChatClient>("Ollama") :
host.Services.GetRequiredService<IChatClient>();

Assert.NotNull(client.Metadata.ProviderUri);
Assert.Equal(Endpoint, client.Metadata.ProviderUri);
Assert.DoesNotContain("http://not-used", client.Metadata.ProviderUri.ToString());
Assert.NotNull(client.GetService<ChatClientMetadata>()?.ProviderUri);
Assert.Equal(Endpoint, client.GetService<ChatClientMetadata>()?.ProviderUri);
Assert.DoesNotContain("http://not-used", client.GetService<ChatClientMetadata>()?.ProviderUri?.ToString());
}

[Fact]
Expand All @@ -115,9 +115,9 @@ public void CanSetMultipleKeyedClients()
var client2 = host.Services.GetRequiredKeyedService<IChatClient>("Ollama2");
var client3 = host.Services.GetRequiredKeyedService<IChatClient>("Ollama3");

Assert.Equal(Endpoint, client.Metadata.ProviderUri);
Assert.Equal("https://localhost:5002/", client2.Metadata.ProviderUri?.ToString());
Assert.Equal("https://localhost:5003/", client3.Metadata.ProviderUri?.ToString());
Assert.Equal(Endpoint, client.GetService<ChatClientMetadata>()?.ProviderUri);
Assert.Equal("https://localhost:5002/", client2.GetService<ChatClientMetadata>()?.ProviderUri?.ToString());
Assert.Equal("https://localhost:5003/", client3.GetService<ChatClientMetadata>()?.ProviderUri?.ToString());

Assert.NotEqual(client, client2);
Assert.NotEqual(client, client3);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ public void ReadsFromConnectionStringCorrectly(bool useKeyed)
host.Services.GetRequiredKeyedService<IEmbeddingGenerator<string, Embedding<float>>>("Ollama") :
host.Services.GetRequiredService<IEmbeddingGenerator<string, Embedding<float>>>();

Assert.NotNull(client.Metadata.ProviderUri);
Assert.Equal(Endpoint, client.Metadata.ProviderUri);
Assert.NotNull(client.GetService<EmbeddingGeneratorMetadata>()?.ProviderUri);
Assert.Equal(Endpoint, client.GetService<EmbeddingGeneratorMetadata>()?.ProviderUri);
}

[Theory]
Expand All @@ -61,9 +61,9 @@ public void CanSetConnectionStringInCode(bool useKeyed)
host.Services.GetRequiredKeyedService<IEmbeddingGenerator<string, Embedding<float>>>("Ollama") :
host.Services.GetRequiredService<IEmbeddingGenerator<string, Embedding<float>>>();

Assert.NotNull(client.Metadata.ProviderUri);
Assert.Equal(Endpoint, client.Metadata.ProviderUri);
Assert.DoesNotContain("http://not-used", client.Metadata.ProviderUri.ToString());
Assert.NotNull(client.GetService<EmbeddingGeneratorMetadata>()?.ProviderUri);
Assert.Equal(Endpoint, client.GetService<EmbeddingGeneratorMetadata>()?.ProviderUri);
Assert.DoesNotContain("http://not-used", client.GetService<EmbeddingGeneratorMetadata>()?.ProviderUri?.ToString());
}

[Theory]
Expand Down Expand Up @@ -91,9 +91,9 @@ public void ConnectionStringWinsOverConfigSection(bool useKeyed)
host.Services.GetRequiredKeyedService<IEmbeddingGenerator<string, Embedding<float>>>("Ollama") :
host.Services.GetRequiredService<IEmbeddingGenerator<string, Embedding<float>>>();

Assert.NotNull(client.Metadata.ProviderUri);
Assert.Equal(Endpoint, client.Metadata.ProviderUri);
Assert.DoesNotContain("http://not-used", client.Metadata.ProviderUri.ToString());
Assert.NotNull(client.GetService<EmbeddingGeneratorMetadata>()?.ProviderUri);
Assert.Equal(Endpoint, client.GetService<EmbeddingGeneratorMetadata>()?.ProviderUri);
Assert.DoesNotContain("http://not-used", client.GetService<EmbeddingGeneratorMetadata>()?.ProviderUri?.ToString());
}

[Fact]
Expand All @@ -115,9 +115,9 @@ public void CanSetMultipleKeyedClients()
var client2 = host.Services.GetRequiredKeyedService<IEmbeddingGenerator<string, Embedding<float>>>("Ollama2");
var client3 = host.Services.GetRequiredKeyedService<IEmbeddingGenerator<string, Embedding<float>>>("Ollama3");

Assert.Equal(Endpoint, client.Metadata.ProviderUri);
Assert.Equal("https://localhost:5002/", client2.Metadata.ProviderUri?.ToString());
Assert.Equal("https://localhost:5003/", client3.Metadata.ProviderUri?.ToString());
Assert.Equal(Endpoint, client.GetService<EmbeddingGeneratorMetadata>()?.ProviderUri);
Assert.Equal("https://localhost:5002/", client2.GetService<EmbeddingGeneratorMetadata>()?.ProviderUri?.ToString());
Assert.Equal("https://localhost:5003/", client3.GetService<EmbeddingGeneratorMetadata>()?.ProviderUri?.ToString());

Assert.NotEqual(client, client2);
Assert.NotEqual(client, client3);
Expand Down
Loading