Skip to content

Commit 89c8783

Browse files
Bump Microsoft.Extensions.VectorData.Abstractions from 9.0.0-preview.1.25161.1 to 9.0.0-preview.1.25229.1 in /docs/ai/quickstarts/snippets/chat-with-data/azure-openai in the dotnet group (#45969)
* Bump Microsoft.Extensions.VectorData.Abstractions Bumps the dotnet group in /docs/ai/quickstarts/snippets/chat-with-data/azure-openai with 1 update: [Microsoft.Extensions.VectorData.Abstractions](https://github.com/microsoft/semantic-kernel). Updates `Microsoft.Extensions.VectorData.Abstractions` from 9.0.0-preview.1.25161.1 to 9.0.0-preview.1.25229.1 - [Release notes](https://github.com/microsoft/semantic-kernel/releases) - [Commits](https://github.com/microsoft/semantic-kernel/commits) --- updated-dependencies: - dependency-name: Microsoft.Extensions.VectorData.Abstractions dependency-version: 9.0.0-preview.1.25229.1 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: dotnet ... Signed-off-by: dependabot[bot] <support@github.com> * resolve build errors --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Genevieve Warren <24882762+gewarren@users.noreply.github.com>
1 parent f72b57f commit 89c8783

File tree

4 files changed

+17
-19
lines changed

4 files changed

+17
-19
lines changed

docs/ai/quickstarts/build-vector-search-app.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -145,16 +145,16 @@ Complete the following steps to create a .NET console app that can:
145145
146146
## Add the app code
147147
148-
1. Add a new class named **CloudService** to your project with the following properties:
148+
1. Add a new class named `CloudService` to your project with the following properties:
149149
150150
:::code language="csharp" source="snippets/chat-with-data/azure-openai/CloudService.cs" :::
151151
152152
In the preceding code:
153153
154154
- The C# attributes provided by `Microsoft.Extensions.VectorData` influence how each property is handled when used in a vector store.
155-
- The **Vector** property stores a generated embedding that represents the semantic meaning of the **Name** and **Description** for vector searches.
155+
- The `Vector` property stores a generated embedding that represents the semantic meaning of the `Name` and `Description` for vector searches.
156156
157-
1. In the **Program.cs** file, add the following code to create a data set that describes a collection of cloud services:
157+
1. In the `Program.cs` file, add the following code to create a data set that describes a collection of cloud services:
158158
159159
:::code language="csharp" source="snippets/chat-with-data/azure-openai/program.cs" id="DataSet":::
160160
@@ -191,7 +191,7 @@ Complete the following steps to create a .NET console app that can:
191191
dotnet run
192192
```
193193
194-
The app prints out the top result of the vector search, which is the cloud service that is most relevant to the original query. You can modify the query to try different search scenarios.
194+
The app prints out the top result of the vector search, which is the cloud service that's most relevant to the original query. You can modify the query to try different search scenarios.
195195
196196
:::zone target="docs" pivot="azure-openai"
197197

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ internal class CloudService
1313
[VectorStoreRecordData]
1414
public string Description { get; set; }
1515

16-
[VectorStoreRecordVector(384, DistanceFunction.CosineSimilarity)]
16+
[VectorStoreRecordVector(Dimensions: 384, DistanceFunction = DistanceFunction.CosineSimilarity)]
1717
public ReadOnlyMemory<float> Vector { get; set; }
1818
}

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

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -64,27 +64,23 @@
6464

6565
foreach (CloudService service in cloudServices)
6666
{
67-
service.Vector = await generator.GenerateEmbeddingVectorAsync(service.Description);
67+
service.Vector = await generator.GenerateVectorAsync(service.Description);
6868
await cloudServicesStore.UpsertAsync(service);
6969
}
7070
// </SnippetVectorStore>
7171

7272
// <SnippetSearch>
7373
// Convert a search query to a vector and search the vector store
7474
string query = "Which Azure service should I use to store my Word documents?";
75-
ReadOnlyMemory<float> queryEmbedding = await generator.GenerateEmbeddingVectorAsync(query);
75+
ReadOnlyMemory<float> queryEmbedding = await generator.GenerateVectorAsync(query);
7676

77-
VectorSearchResults<CloudService> results =
78-
await cloudServicesStore.VectorizedSearchAsync(queryEmbedding, new VectorSearchOptions<CloudService>()
79-
{
80-
Top = 1
81-
});
77+
List<VectorSearchResult<CloudService>> results =
78+
await cloudServicesStore.SearchEmbeddingAsync(queryEmbedding, top: 1).ToListAsync();
8279

83-
await foreach (VectorSearchResult<CloudService> result in results.Results)
80+
foreach (VectorSearchResult<CloudService> result in results)
8481
{
8582
Console.WriteLine($"Name: {result.Record.Name}");
8683
Console.WriteLine($"Description: {result.Record.Description}");
8784
Console.WriteLine($"Vector match score: {result.Score}");
88-
Console.WriteLine();
8985
}
9086
// </SnippetSearch>
Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,22 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>net8.0</TargetFramework>
5+
<TargetFramework>net9.0</TargetFramework>
66
<ImplicitUsings>enable</ImplicitUsings>
77
<Nullable>enable</Nullable>
8+
<UserSecretsId>5981f38c-e59c-46cc-80bb-463f8c3f1691</UserSecretsId>
89
</PropertyGroup>
910

1011
<ItemGroup>
1112
<PackageReference Include="Azure.Identity" Version="1.13.2" />
1213
<PackageReference Include="Azure.AI.OpenAI" Version="2.1.0" />
13-
<PackageReference Include="Microsoft.Extensions.AI.OpenAI" Version="9.4.0-preview.1.25207.5" />
14-
<PackageReference Include="Microsoft.Extensions.VectorData.Abstractions" Version="9.0.0-preview.1.25161.1" />
15-
<PackageReference Include="Microsoft.SemanticKernel.Connectors.InMemory" Version="1.41.0-preview" />
14+
<PackageReference Include="Microsoft.Extensions.AI.OpenAI" Version="9.4.3-preview.1.25230.7" />
15+
<PackageReference Include="Microsoft.Extensions.VectorData.Abstractions" Version="9.0.0-preview.1.25229.1" />
16+
<PackageReference Include="Microsoft.SemanticKernel.Connectors.InMemory" Version="1.48.0-preview" />
1617
<PackageReference Include="Microsoft.Extensions.Configuration" Version="10.0.0-preview.3.25171.5" />
1718
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="10.0.0-preview.3.25171.5" />
19+
<PackageReference Include="System.Linq.AsyncEnumerable" Version="10.0.0-preview.3.25171.5" />
1820
</ItemGroup>
1921

2022
</Project>

0 commit comments

Comments
 (0)