Skip to content
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
4 changes: 2 additions & 2 deletions docs/ai/quickstarts/build-chat-app.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ Complete the following steps to create a .NET console app to connect to an AI mo
```bash
dotnet add package Azure.Identity
dotnet add package Azure.AI.OpenAI
dotnet add package Microsoft.Extensions.AI.OpenAI
dotnet add package Microsoft.Extensions.AI.OpenAI --prerelease
dotnet add package Microsoft.Extensions.Configuration
dotnet add package Microsoft.Extensions.Configuration.UserSecrets
```
Expand All @@ -67,7 +67,7 @@ Complete the following steps to create a .NET console app to connect to an AI mo

```bash
dotnet add package OpenAI
dotnet add package Microsoft.Extensions.AI.OpenAI
dotnet add package Microsoft.Extensions.AI.OpenAI --prerelease
dotnet add package Microsoft.Extensions.Configuration
dotnet add package Microsoft.Extensions.Configuration.UserSecrets
```
Expand Down
14 changes: 8 additions & 6 deletions docs/ai/quickstarts/build-vector-search-app.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,10 @@ Complete the following steps to create a .NET console app that can:
dotnet add package Microsoft.SemanticKernel.Connectors.InMemory --prerelease
dotnet add package Microsoft.Extensions.Configuration
dotnet add package Microsoft.Extensions.Configuration.UserSecrets
dotnet add package System.Linq.AsyncEnumerable
```

The following list describes what each package is used for in the `VectorDataAI` app:
The following list describes each package in the `VectorDataAI` app:

- [`Azure.Identity`](https://www.nuget.org/packages/Azure.Identity) provides [`Microsoft Entra ID`](/entra/fundamentals/whatis) token authentication support across the Azure SDK using classes such as `DefaultAzureCredential`.
- [`Azure.AI.OpenAI`](https://www.nuget.org/packages/Azure.AI.OpenAI) is the official package for using OpenAI's .NET library with the Azure OpenAI Service.
Expand All @@ -98,9 +99,10 @@ Complete the following steps to create a .NET console app that can:
dotnet add package Microsoft.SemanticKernel.Connectors.InMemory --prerelease
dotnet add package Microsoft.Extensions.Configuration
dotnet add package Microsoft.Extensions.Configuration.UserSecrets
dotnet add package System.Linq.AsyncEnumerable
```

The following list describes what each package is used for in the `VectorDataAI` app:
The following list describes each package in the `VectorDataAI` app:

- [`Microsoft.Extensions.AI.OpenAI`](https://www.nuget.org/packages/Microsoft.Extensions.AI.OpenAI) provides AI abstractions for OpenAI-compatible models or endpoints. This library also includes the official [`OpenAI`](https://www.nuget.org/packages/OpenAI) library for the OpenAI service API as a dependency.
- [`Microsoft.SemanticKernel.Connectors.InMemory`](https://www.nuget.org/packages/Microsoft.SemanticKernel.Connectors.InMemory) provides an in-memory vector store class to hold queryable vector data records.
Expand Down Expand Up @@ -143,16 +145,16 @@ Complete the following steps to create a .NET console app that can:

## Add the app code

1. Add a new class named **CloudService** to your project with the following properties:
1. Add a new class named `CloudService` to your project with the following properties:

:::code language="csharp" source="snippets/chat-with-data/azure-openai/CloudService.cs" :::

In the preceding code:

- The C# attributes provided by `Microsoft.Extensions.VectorData` influence how each property is handled when used in a vector store.
- The **Vector** property stores a generated embedding that represents the semantic meaning of the **Name** and **Description** for vector searches.
- The `Vector` property stores a generated embedding that represents the semantic meaning of the `Name` and `Description` for vector searches.

1. In the **Program.cs** file, add the following code to create a data set that describes a collection of cloud services:
1. In the `Program.cs` file, add the following code to create a data set that describes a collection of cloud services:

:::code language="csharp" source="snippets/chat-with-data/azure-openai/program.cs" id="DataSet":::

Expand Down Expand Up @@ -189,7 +191,7 @@ Complete the following steps to create a .NET console app that can:
dotnet run
```

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.
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.

:::zone target="docs" pivot="azure-openai"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
using Microsoft.Extensions.VectorData;

namespace VectorDataAI
namespace VectorDataAI;

internal class CloudService
{
internal class CloudService
{
[VectorStoreRecordKey]
public int Key { get; set; }
[VectorStoreRecordKey]
public int Key { get; set; }

[VectorStoreRecordData]
public string Name { get; set; }
[VectorStoreRecordData]
public string Name { get; set; }

[VectorStoreRecordData]
public string Description { get; set; }
[VectorStoreRecordData]
public string Description { get; set; }

[VectorStoreRecordVector(384, DistanceFunction.CosineSimilarity)]
public ReadOnlyMemory<float> Vector { get; set; }
}
[VectorStoreRecordVector(Dimensions: 384, DistanceFunction = DistanceFunction.CosineSimilarity)]
public ReadOnlyMemory<float> Vector { get; set; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -64,27 +64,23 @@

foreach (CloudService service in cloudServices)
{
service.Vector = await generator.GenerateEmbeddingVectorAsync(service.Description);
service.Vector = await generator.GenerateVectorAsync(service.Description);
await cloudServicesStore.UpsertAsync(service);
}
// </SnippetVectorStore>

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

VectorSearchResults<CloudService> results =
await cloudServicesStore.VectorizedSearchAsync(queryEmbedding, new VectorSearchOptions<CloudService>()
{
Top = 1
});
List<VectorSearchResult<CloudService>> results =
await cloudServicesStore.SearchEmbeddingAsync(queryEmbedding, top: 1).ToListAsync();

await foreach (VectorSearchResult<CloudService> result in results.Results)
foreach (VectorSearchResult<CloudService> result in results)
{
Console.WriteLine($"Name: {result.Record.Name}");
Console.WriteLine($"Description: {result.Record.Description}");
Console.WriteLine($"Vector match score: {result.Score}");
Console.WriteLine();
}
// </SnippetSearch>
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<UserSecretsId>5981f38c-e59c-46cc-80bb-463f8c3f1691</UserSecretsId>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Azure.Identity" Version="1.13.2" />
<PackageReference Include="Azure.AI.OpenAI" Version="2.1.0" />
<PackageReference Include="Microsoft.Extensions.AI.OpenAI" Version="9.4.0-preview.1.25207.5" />
<PackageReference Include="Microsoft.Extensions.VectorData.Abstractions" Version="9.0.0-preview.1.25161.1" />
<PackageReference Include="Microsoft.SemanticKernel.Connectors.InMemory" Version="1.41.0-preview" />
<PackageReference Include="Microsoft.Extensions.AI.OpenAI" Version="9.4.3-preview.1.25230.7" />
<PackageReference Include="Microsoft.Extensions.VectorData.Abstractions" Version="9.0.0-preview.1.25229.1" />
<PackageReference Include="Microsoft.SemanticKernel.Connectors.InMemory" Version="1.48.0-preview" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="10.0.0-preview.3.25171.5" />
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="10.0.0-preview.3.25171.5" />
<PackageReference Include="System.Linq.AsyncEnumerable" Version="10.0.0-preview.3.25171.5" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ internal class CloudService
[VectorStoreRecordData]
public string Description { get; set; }

[VectorStoreRecordVector(384, DistanceFunction.CosineSimilarity)]
[VectorStoreRecordVector(Dimensions: 384, DistanceFunction = DistanceFunction.CosineSimilarity)]
public ReadOnlyMemory<float> Vector { get; set; }
}
}
14 changes: 5 additions & 9 deletions docs/ai/quickstarts/snippets/chat-with-data/openai/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,24 +58,20 @@

foreach (CloudService service in cloudServices)
{
service.Vector = await generator.GenerateEmbeddingVectorAsync(service.Description);
service.Vector = await generator.GenerateVectorAsync(service.Description);
await cloudServicesStore.UpsertAsync(service);
}

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

VectorSearchResults<CloudService> results =
await cloudServicesStore.VectorizedSearchAsync(queryEmbedding, new VectorSearchOptions<CloudService>()
{
Top = 1
});
List<VectorSearchResult<CloudService>> results =
await cloudServicesStore.SearchEmbeddingAsync(queryEmbedding, top: 1).ToListAsync();

await foreach (VectorSearchResult<CloudService> result in results.Results)
foreach (VectorSearchResult<CloudService> result in results)
{
Console.WriteLine($"Name: {result.Record.Name}");
Console.WriteLine($"Description: {result.Record.Description}");
Console.WriteLine($"Vector match score: {result.Score}");
Console.WriteLine();
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.AI.OpenAI" Version="9.4.0-preview.1.25207.5" />
<PackageReference Include="Microsoft.Extensions.VectorData.Abstractions" Version="9.0.0-preview.1.25161.1" />
<PackageReference Include="Microsoft.SemanticKernel.Connectors.InMemory" Version="1.41.0-preview" />
<PackageReference Include="Microsoft.Extensions.AI.OpenAI" Version="9.4.3-preview.1.25230.7" />
<PackageReference Include="Microsoft.Extensions.VectorData.Abstractions" Version="9.0.0-preview.1.25229.1" />
<PackageReference Include="Microsoft.SemanticKernel.Connectors.InMemory" Version="1.48.0-preview" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="10.0.0-preview.3.25171.5" />
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="10.0.0-preview.3.25171.5" />
<PackageReference Include="System.Linq.AsyncEnumerable" Version="10.0.0-preview.3.25171.5" />
</ItemGroup>

</Project>
10 changes: 5 additions & 5 deletions docs/azure/includes/dotnet-all.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
| AI Model Inference | NuGet [1.0.0-beta.4](https://www.nuget.org/packages/Azure.AI.Inference/1.0.0-beta.4) | [docs](/dotnet/api/overview/azure/AI.Inference-readme?view=azure-dotnet-preview&amp;preserve-view=true) | GitHub [1.0.0-beta.4](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.Inference_1.0.0-beta.4/sdk/ai/Azure.AI.Inference/) |
| Anomaly Detector | NuGet [3.0.0-preview.7](https://www.nuget.org/packages/Azure.AI.AnomalyDetector/3.0.0-preview.7) | [docs](/dotnet/api/overview/azure/AI.AnomalyDetector-readme?view=azure-dotnet-preview&amp;preserve-view=true) | GitHub [3.0.0-preview.7](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.AnomalyDetector_3.0.0-preview.7/sdk/anomalydetector/Azure.AI.AnomalyDetector/) |
| App Configuration | NuGet [1.6.0](https://www.nuget.org/packages/Azure.Data.AppConfiguration/1.6.0) | [docs](/dotnet/api/overview/azure/Data.AppConfiguration-readme) | GitHub [1.6.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Data.AppConfiguration_1.6.0/sdk/appconfiguration/Azure.Data.AppConfiguration/) |
| App Configuration Provider | NuGet [8.1.1](https://www.nuget.org/packages/Microsoft.Extensions.Configuration.AzureAppConfiguration/8.1.1)<br>NuGet [8.2.0-preview](https://www.nuget.org/packages/Microsoft.Extensions.Configuration.AzureAppConfiguration/8.2.0-preview) | [docs](/dotnet/api/overview/azure/Microsoft.Extensions.Configuration.AzureAppConfiguration-readme) | GitHub [8.1.1](https://github.com/Azure/AppConfiguration-DotnetProvider) |
| App Configuration Provider | NuGet [8.1.2](https://www.nuget.org/packages/Microsoft.Extensions.Configuration.AzureAppConfiguration/8.1.2)<br>NuGet [8.2.0-preview](https://www.nuget.org/packages/Microsoft.Extensions.Configuration.AzureAppConfiguration/8.2.0-preview) | [docs](/dotnet/api/overview/azure/Microsoft.Extensions.Configuration.AzureAppConfiguration-readme) | GitHub [8.1.2](https://github.com/Azure/AppConfiguration-DotnetProvider) |
| Attestation | NuGet [1.0.0](https://www.nuget.org/packages/Azure.Security.Attestation/1.0.0) | [docs](/dotnet/api/overview/azure/Security.Attestation-readme) | GitHub [1.0.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Security.Attestation_1.0.0/sdk/attestation/Azure.Security.Attestation/) |
| Azure AI Search | NuGet [11.6.0](https://www.nuget.org/packages/Azure.Search.Documents/11.6.0)<br>NuGet [11.7.0-beta.3](https://www.nuget.org/packages/Azure.Search.Documents/11.7.0-beta.3) | [docs](/dotnet/api/overview/azure/Search.Documents-readme) | GitHub [11.6.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Search.Documents_11.6.0/sdk/search/Azure.Search.Documents/)<br>GitHub [11.7.0-beta.3](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Search.Documents_11.7.0-beta.3/sdk/search/Azure.Search.Documents/) |
| Azure Object Anchors Conversion | NuGet [0.3.0-beta.6](https://www.nuget.org/packages/Azure.MixedReality.ObjectAnchors.Conversion/0.3.0-beta.6) | [docs](/dotnet/api/overview/azure/MixedReality.ObjectAnchors.Conversion-readme?view=azure-dotnet-preview&amp;preserve-view=true) | GitHub [0.3.0-beta.6](https://github.com/Azure/azure-sdk-for-net/tree/Azure.MixedReality.ObjectAnchors.Conversion_0.3.0-beta.6/sdk/objectanchors/Azure.MixedReality.ObjectAnchors.Conversion/) |
Expand Down Expand Up @@ -53,7 +53,7 @@
| Health Insights Cancer Profiling | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.Health.Insights.CancerProfiling/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/Health.Insights.CancerProfiling-readme?view=azure-dotnet-preview&amp;preserve-view=true) | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Health.Insights.CancerProfiling_1.0.0-beta.1/sdk/healthinsights/Azure.Health.Insights.CancerProfiling/) |
| Health Insights Clinical Matching | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.Health.Insights.ClinicalMatching/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/Health.Insights.ClinicalMatching-readme?view=azure-dotnet-preview&amp;preserve-view=true) | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Health.Insights.ClinicalMatching_1.0.0-beta.1/sdk/healthinsights/Azure.Health.Insights.ClinicalMatching/) |
| Health Insights Radiology Insights | NuGet [1.0.0](https://www.nuget.org/packages/Azure.Health.Insights.RadiologyInsights/1.0.0) | [docs](/dotnet/api/overview/azure/Health.Insights.RadiologyInsights-readme) | GitHub [1.0.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Health.Insights.RadiologyInsights_1.0.0/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/) |
| Identity | NuGet [1.13.2](https://www.nuget.org/packages/Azure.Identity/1.13.2)<br>NuGet [1.14.0-beta.3](https://www.nuget.org/packages/Azure.Identity/1.14.0-beta.3) | [docs](/dotnet/api/overview/azure/Identity-readme) | GitHub [1.13.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Identity_1.13.2/sdk/identity/Azure.Identity/)<br>GitHub [1.14.0-beta.3](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Identity_1.14.0-beta.3/sdk/identity/Azure.Identity/) |
| Identity | NuGet [1.13.2](https://www.nuget.org/packages/Azure.Identity/1.13.2)<br>NuGet [1.14.0-beta.4](https://www.nuget.org/packages/Azure.Identity/1.14.0-beta.4) | [docs](/dotnet/api/overview/azure/Identity-readme) | GitHub [1.13.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Identity_1.13.2/sdk/identity/Azure.Identity/)<br>GitHub [1.14.0-beta.4](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Identity_1.14.0-beta.4/sdk/identity/Azure.Identity/) |
| Identity Broker | NuGet [1.2.0](https://www.nuget.org/packages/Azure.Identity.Broker/1.2.0)<br>NuGet [1.3.0-beta.2](https://www.nuget.org/packages/Azure.Identity.Broker/1.3.0-beta.2) | [docs](/dotnet/api/overview/azure/Identity.Broker-readme) | GitHub [1.2.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Identity.Broker_1.2.0/sdk/identity/Azure.Identity.Broker/)<br>GitHub [1.3.0-beta.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Identity.Broker_1.3.0-beta.2/sdk/identity/Azure.Identity.Broker/) |
| Image Analysis | NuGet [1.0.0](https://www.nuget.org/packages/Azure.AI.Vision.ImageAnalysis/1.0.0) | [docs](/dotnet/api/overview/azure/AI.Vision.ImageAnalysis-readme) | GitHub [1.0.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.Vision.ImageAnalysis_1.0.0/sdk/vision/Azure.AI.Vision.ImageAnalysis/) |
| Key Vault - Administration | NuGet [4.5.0](https://www.nuget.org/packages/Azure.Security.KeyVault.Administration/4.5.0)<br>NuGet [4.6.0-beta.1](https://www.nuget.org/packages/Azure.Security.KeyVault.Administration/4.6.0-beta.1) | [docs](/dotnet/api/overview/azure/Security.KeyVault.Administration-readme) | GitHub [4.5.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Security.KeyVault.Administration_4.5.0/sdk/keyvault/Azure.Security.KeyVault.Administration/)<br>GitHub [4.6.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Security.KeyVault.Administration_4.6.0-beta.1/sdk/keyvault/Azure.Security.KeyVault.Administration/) |
Expand Down Expand Up @@ -383,9 +383,9 @@
| Functions Worker Extension MCP | NuGet [1.0.0-preview.2](https://www.nuget.org/packages/Microsoft.Azure.Functions.Worker.Extensions.Mcp/1.0.0-preview.2) | | |
| Functions Worker Extension MySQL | NuGet [1.0.129](https://www.nuget.org/packages/Microsoft.Azure.Functions.Worker.Extensions.MySql/1.0.129) | | |
| HTTP ASPNETCore Analyzers | NuGet [1.0.3](https://www.nuget.org/packages/Microsoft.Azure.Functions.Worker.Extensions.Http.AspNetCore.Analyzers/1.0.3) | | |
| IoT Operations MQTT | NuGet [0.10.0](https://www.nuget.org/packages/Azure.Iot.Operations.Mqtt/0.10.0) | | |
| IoT Operations Protocol | NuGet [0.10.0](https://www.nuget.org/packages/Azure.Iot.Operations.Protocol/0.10.0) | | |
| IoT Operations Services | NuGet [0.10.1](https://www.nuget.org/packages/Azure.Iot.Operations.Services/0.10.1) | | |
| IoT Operations MQTT | NuGet [0.10.1](https://www.nuget.org/packages/Azure.Iot.Operations.Mqtt/0.10.1) | | |
| IoT Operations Protocol | NuGet [0.11.0](https://www.nuget.org/packages/Azure.Iot.Operations.Protocol/0.11.0) | | |
| IoT Operations Services | NuGet [0.11.0](https://www.nuget.org/packages/Azure.Iot.Operations.Services/0.11.0) | | |
| Item Templates NetCore | NuGet [4.0.5086](https://www.nuget.org/packages/Microsoft.Azure.Functions.Worker.ItemTemplates.NetCore/4.0.5086) | | |
| Item Templates NetFx | NuGet [4.0.5086](https://www.nuget.org/packages/Microsoft.Azure.Functions.Worker.ItemTemplates.NetFx/4.0.5086) | | |
| Microsoft.Azure.DataFactoryTestingFramework.Expressions | NuGet [0.2.7](https://www.nuget.org/packages/Microsoft.Azure.DataFactoryTestingFramework.Expressions/0.2.7) | | |
Expand Down
Loading
Loading