Skip to content

Commit d3cd140

Browse files
ShivangiRejaShivangiReja
andauthored
[Search] Update Samples as per Azure OpenAI GA Version (Azure#46397)
* [Search] Update Samples as per OpenAI GA Version * Update ApiKeyCredential -> AzureKeyCredential --------- Co-authored-by: ShivangiReja <[email protected]>
1 parent 86ccbe7 commit d3cd140

9 files changed

+10
-11
lines changed

eng/Packages.Data.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@
128128
<PackageReference Update="Azure.Storage.Blobs" Version="12.21.1" />
129129
<PackageReference Update="Azure.Storage.Queues" Version="12.19.1" />
130130
<PackageReference Update="Azure.Storage.Files.Shares" Version="12.19.1" />
131-
<PackageReference Update="Azure.AI.OpenAI" Version="2.0.0-beta.6" />
131+
<PackageReference Update="Azure.AI.OpenAI" Version="2.0.0" />
132132
<PackageReference Update="Azure.ResourceManager" Version="1.13.0" />
133133
<PackageReference Update="Azure.ResourceManager.AppConfiguration" Version="1.3.2" />
134134
<PackageReference Update="Azure.ResourceManager.ApplicationInsights" Version="1.0.0" />

sdk/search/Azure.Search.Documents/assets.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
"AssetsRepo": "Azure/azure-sdk-assets",
33
"AssetsRepoPrefixPath": "net",
44
"TagPrefix": "net/search/Azure.Search.Documents",
5-
"Tag": "net/search/Azure.Search.Documents_71e5c48d88"
5+
"Tag": "net/search/Azure.Search.Documents_1b05ea0ca5"
66
}

sdk/search/Azure.Search.Documents/samples/Sample07_VectorSearch_UsingReducedEmbeddings.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ public static ReadOnlyMemory<float> GetEmbeddings(string input)
107107
{
108108
Dimensions = 256
109109
};
110-
Embedding embedding = embeddingClient.GenerateEmbedding(input, embeddingsOptions);
110+
OpenAIEmbedding embedding = embeddingClient.GenerateEmbedding(input, embeddingsOptions);
111111
return embedding.ToFloats();
112112
}
113113
```

sdk/search/Azure.Search.Documents/samples/Sample07_VectorSearch_UsingSemanticHybridQuery.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public static ReadOnlyMemory<float> GetEmbeddings(string input)
9898
AzureOpenAIClient openAIClient = new AzureOpenAIClient(endpoint, credential);
9999
EmbeddingClient embeddingClient = openAIClient.GetEmbeddingClient("text-embedding-ada-002");
100100

101-
Embedding embedding = embeddingClient.GenerateEmbedding(input);
101+
OpenAIEmbedding embedding = embeddingClient.GenerateEmbedding(input);
102102
return embedding.ToFloats();
103103
}
104104
```

sdk/search/Azure.Search.Documents/samples/Sample07_VectorSearch_UsingVectorizableTextQuery.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ public static ReadOnlyMemory<float> GetEmbeddings(string input)
9797
AzureOpenAIClient openAIClient = new AzureOpenAIClient(endpoint, credential);
9898
EmbeddingClient embeddingClient = openAIClient.GetEmbeddingClient("text-embedding-ada-002");
9999

100-
Embedding embedding = embeddingClient.GenerateEmbedding(input);
100+
OpenAIEmbedding embedding = embeddingClient.GenerateEmbedding(input);
101101
return embedding.ToFloats();
102102
}
103103
```

sdk/search/Azure.Search.Documents/samples/Sample07_VectorSearch_UsingVectorizedQuery.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public static ReadOnlyMemory<float> GetEmbeddings(string input)
8080
AzureOpenAIClient openAIClient = new AzureOpenAIClient(endpoint, credential);
8181
EmbeddingClient embeddingClient = openAIClient.GetEmbeddingClient("text-embedding-ada-002");
8282

83-
Embedding embedding = embeddingClient.GenerateEmbedding(input);
83+
OpenAIEmbedding embedding = embeddingClient.GenerateEmbedding(input);
8484
return embedding.ToFloats();
8585
}
8686
```

sdk/search/Azure.Search.Documents/tests/Azure.Search.Documents.Tests.csproj

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,6 @@
3535
<PackageReference Include="Azure.Storage.Blobs" />
3636
<PackageReference Include="Azure.Security.KeyVault.Keys" />
3737
<PackageReference Include="Microsoft.Spatial" />
38-
39-
<!-- Temporarily retain package-only references to Azure.AI.OpenAI pending 2.0.0 GA updates -->
40-
<ExcludeFromProjectReferenceToConversion Include="Azure.AI.OpenAI" />
4138
</ItemGroup>
4239

4340
<ItemGroup>

sdk/search/Azure.Search.Documents/tests/Samples/Sample07_VectorSearchCommons.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// Licensed under the MIT License.
33

44
using System;
5+
using System.ClientModel;
56
using Azure.AI.OpenAI;
67
using OpenAI.Embeddings;
78
#pragma warning disable SA1402 // File may only contain a single type
@@ -20,7 +21,7 @@ public static ReadOnlyMemory<float> GetEmbeddings(string input)
2021
AzureOpenAIClient openAIClient = new AzureOpenAIClient(endpoint, credential);
2122
EmbeddingClient embeddingClient = openAIClient.GetEmbeddingClient("text-embedding-ada-002");
2223

23-
Embedding embedding = embeddingClient.GenerateEmbedding(input);
24+
OpenAIEmbedding embedding = embeddingClient.GenerateEmbedding(input);
2425
return embedding.ToFloats();
2526
}
2627
#endregion

sdk/search/Azure.Search.Documents/tests/Samples/Sample07_VectorSearch_UsingReducedEmbeddings.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
using Azure.Core.TestFramework;
1111
using Azure.AI.OpenAI;
1212
using OpenAI.Embeddings;
13+
using System.ClientModel;
1314

1415
namespace Azure.Search.Documents.Tests.Samples.VectorSearch
1516
{
@@ -179,7 +180,7 @@ public static ReadOnlyMemory<float> GetEmbeddings(string input)
179180
{
180181
Dimensions = 256
181182
};
182-
Embedding embedding = embeddingClient.GenerateEmbedding(input, embeddingsOptions);
183+
OpenAIEmbedding embedding = embeddingClient.GenerateEmbedding(input, embeddingsOptions);
183184
return embedding.ToFloats();
184185
}
185186
#endregion

0 commit comments

Comments
 (0)