Skip to content

Commit c4ef3da

Browse files
Bump the dotnet group in /docs/ai/quickstarts/snippets/chat-with-data/openai with 3 updates (#45243)
* Bump the dotnet group Bumps the dotnet group in /docs/ai/quickstarts/snippets/chat-with-data/openai with 3 updates: [Microsoft.Extensions.Configuration](https://github.com/dotnet/runtime), [Microsoft.Extensions.Configuration.UserSecrets](https://github.com/dotnet/runtime) and [Microsoft.Extensions.VectorData.Abstractions](https://github.com/microsoft/semantic-kernel). Updates `Microsoft.Extensions.Configuration` from 9.0.2 to 9.0.3 - [Release notes](https://github.com/dotnet/runtime/releases) - [Commits](dotnet/runtime@v9.0.2...v9.0.3) Updates `Microsoft.Extensions.Configuration` from 9.0.2 to 9.0.3 - [Release notes](https://github.com/dotnet/runtime/releases) - [Commits](dotnet/runtime@v9.0.2...v9.0.3) Updates `Microsoft.Extensions.Configuration.UserSecrets` from 9.0.2 to 9.0.3 - [Release notes](https://github.com/dotnet/runtime/releases) - [Commits](dotnet/runtime@v9.0.2...v9.0.3) Updates `Microsoft.Extensions.VectorData.Abstractions` from 9.0.0-preview.1.25078.1 to 9.0.0-preview.1.25161.1 - [Release notes](https://github.com/microsoft/semantic-kernel/releases) - [Commits](microsoft/semantic-kernel@vectordata-dotnet-9.0.0-preview.1.25078.1...vectordata-dotnet-9.0.0-preview.1.25161.1) --- updated-dependencies: - dependency-name: Microsoft.Extensions.Configuration dependency-type: direct:production update-type: version-update:semver-patch dependency-group: dotnet - dependency-name: Microsoft.Extensions.Configuration dependency-type: direct:production update-type: version-update:semver-patch dependency-group: dotnet - dependency-name: Microsoft.Extensions.Configuration.UserSecrets dependency-type: direct:production update-type: version-update:semver-patch dependency-group: dotnet - dependency-name: Microsoft.Extensions.VectorData.Abstractions dependency-type: direct:production update-type: version-update:semver-patch dependency-group: dotnet ... Signed-off-by: dependabot[bot] <[email protected]> * fix build errors --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Genevieve Warren <[email protected]>
1 parent 52ff976 commit c4ef3da

File tree

3 files changed

+28
-39
lines changed

3 files changed

+28
-39
lines changed

docs/ai/quickstarts/snippets/chat-with-data/openai/CloudService.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
11
using Microsoft.Extensions.VectorData;
2-
using System;
3-
using System.Collections.Generic;
4-
using System.Linq;
5-
using System.Text;
6-
using System.Threading.Tasks;
72

83
namespace VectorDataAI
94
{

docs/ai/quickstarts/snippets/chat-with-data/openai/Program.cs

Lines changed: 23 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,83 +1,77 @@
1-
using Microsoft.Extensions.AI;
2-
using OpenAI;
1+
using System.ClientModel;
2+
using Microsoft.Extensions.AI;
3+
using Microsoft.Extensions.Configuration;
34
using Microsoft.Extensions.VectorData;
45
using Microsoft.SemanticKernel.Connectors.InMemory;
6+
using OpenAI;
57
using VectorDataAI;
6-
using System.ClientModel;
7-
using Microsoft.Extensions.Configuration;
88

99
var cloudServices = new List<CloudService>()
1010
{
11-
new CloudService
12-
{
11+
new() {
1312
Key=0,
1413
Name="Azure App Service",
1514
Description="Host .NET, Java, Node.js, and Python web applications and APIs in a fully managed Azure service. You only need to deploy your code to Azure. Azure takes care of all the infrastructure management like high availability, load balancing, and autoscaling."
1615
},
17-
new CloudService
18-
{
16+
new() {
1917
Key=1,
2018
Name="Azure Service Bus",
2119
Description="A fully managed enterprise message broker supporting both point to point and publish-subscribe integrations. It's ideal for building decoupled applications, queue-based load leveling, or facilitating communication between microservices."
2220
},
23-
new CloudService
24-
{
21+
new() {
2522
Key=2,
2623
Name="Azure Blob Storage",
2724
Description="Azure Blob Storage allows your applications to store and retrieve files in the cloud. Azure Storage is highly scalable to store massive amounts of data and data is stored redundantly to ensure high availability."
2825
},
29-
new CloudService
30-
{
26+
new() {
3127
Key=3,
3228
Name="Microsoft Entra ID",
3329
Description="Manage user identities and control access to your apps, data, and resources.."
3430
},
35-
new CloudService
36-
{
31+
new() {
3732
Key=4,
3833
Name="Azure Key Vault",
3934
Description="Store and access application secrets like connection strings and API keys in an encrypted vault with restricted access to make sure your secrets and your application aren't compromised."
4035
},
41-
new CloudService
42-
{
36+
new() {
4337
Key=5,
4438
Name="Azure AI Search",
4539
Description="Information retrieval at scale for traditional and conversational search applications, with security and options for AI enrichment and vectorization."
4640
}
4741
};
4842

49-
// Load the configuration values
50-
var config = new ConfigurationBuilder().AddUserSecrets<Program>().Build();
43+
// Load the configuration values.
44+
IConfigurationRoot config = new ConfigurationBuilder().AddUserSecrets<Program>().Build();
5145
string model = config["ModelName"];
5246
string key = config["OpenAIKey"];
5347

54-
// Create the embedding generator
48+
// Create the embedding generator.
5549
IEmbeddingGenerator<string, Embedding<float>> generator =
5650
new OpenAIClient(new ApiKeyCredential(key))
5751
.AsEmbeddingGenerator(modelId: model);
5852

59-
// Create and populate the vector store
53+
// Create and populate the vector store.
6054
var vectorStore = new InMemoryVectorStore();
61-
var cloudServicesStore = vectorStore.GetCollection<int, CloudService>("cloudServices");
55+
IVectorStoreRecordCollection<int, CloudService> cloudServicesStore = vectorStore.GetCollection<int, CloudService>("cloudServices");
6256
await cloudServicesStore.CreateCollectionIfNotExistsAsync();
6357

64-
foreach (var service in cloudServices)
58+
foreach (CloudService service in cloudServices)
6559
{
6660
service.Vector = await generator.GenerateEmbeddingVectorAsync(service.Description);
6761
await cloudServicesStore.UpsertAsync(service);
6862
}
6963

70-
// Convert a search query to a vector and search the vector store
71-
var query = "Which Azure service should I use to store my Word documents?";
72-
var queryEmbedding = await generator.GenerateEmbeddingVectorAsync(query);
64+
// Convert a search query to a vector and search the vector store.
65+
string query = "Which Azure service should I use to store my Word documents?";
66+
ReadOnlyMemory<float> queryEmbedding = await generator.GenerateEmbeddingVectorAsync(query);
7367

74-
var results = await cloudServicesStore.VectorizedSearchAsync(queryEmbedding, new VectorSearchOptions()
68+
VectorSearchResults<CloudService> results =
69+
await cloudServicesStore.VectorizedSearchAsync(queryEmbedding, new VectorSearchOptions<CloudService>()
7570
{
76-
Top = 1,
77-
VectorPropertyName = "Vector"
71+
Top = 1
7872
});
7973

80-
await foreach (var result in results.Results)
74+
await foreach (VectorSearchResult<CloudService> result in results.Results)
8175
{
8276
Console.WriteLine($"Name: {result.Record.Name}");
8377
Console.WriteLine($"Description: {result.Record.Description}");

docs/ai/quickstarts/snippets/chat-with-data/openai/VectorDataAI.csproj

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88
</PropertyGroup>
99

1010
<ItemGroup>
11-
<PackageReference Include="Microsoft.Extensions.AI.OpenAI" Version="9.0.1-preview.1.24570.5" />
12-
<PackageReference Include="Microsoft.Extensions.VectorData.Abstractions" Version="9.0.0-preview.1.25078.1" />
13-
<PackageReference Include="Microsoft.SemanticKernel.Connectors.InMemory" Version="1.31.0-preview" />
14-
<PackageReference Include="Microsoft.Extensions.Configuration" Version="9.0.2" />
15-
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="9.0.2" />
11+
<PackageReference Include="Microsoft.Extensions.AI.OpenAI" Version="9.3.0-preview.1.25161.3" />
12+
<PackageReference Include="Microsoft.Extensions.VectorData.Abstractions" Version="9.0.0-preview.1.25161.1" />
13+
<PackageReference Include="Microsoft.SemanticKernel.Connectors.InMemory" Version="1.41.0-preview" />
14+
<PackageReference Include="Microsoft.Extensions.Configuration" Version="10.0.0-preview.1.25080.5" />
15+
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="10.0.0-preview.1.25080.5" />
1616
</ItemGroup>
1717

1818
</Project>

0 commit comments

Comments
 (0)