Skip to content

Commit 041056e

Browse files
author
Bidisha Chakraborty
committed
small update
1 parent 2a62794 commit 041056e

File tree

3 files changed

+21
-33
lines changed

3 files changed

+21
-33
lines changed

sdk/cognitivelanguage/Azure.AI.Language.Documents/tests/Infrastructure/DocumentAnalysisClientTestEnvironment.cs

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,9 @@ namespace Azure.AI.Language.Documents.Tests
88
{
99
public class DocumentAnalysisClientTestEnvironment : TestEnvironment
1010
{
11-
public Uri Endpoint => new(GetRecordedVariable("AZURE_TEXT_ENDPOINT"));
11+
public Uri Endpoint => new(GetRecordedVariable("AZURE_DOCUMENTS_ENDPOINT"));
1212

13-
// Add other client paramters here as above.
14-
public string ApiKey => GetRecordedVariable("AZURE_TEXT_KEY", options => options.IsSecret());
15-
16-
public string CTProjectName => GetRecordedVariable("AZURE_TEXT_CUSTOM_NER_PROJECT");
17-
18-
public string CTDeploymentName => GetRecordedVariable("AZURE_TEXT_CUSTOM_NER_DEPLOYMENT");
19-
20-
public string CSCProjectName => GetRecordedVariable("AZURE_TEXT_CUSTOM_SINGLE_CLASSIFICATION_PROJECT");
21-
22-
public string CSCDeploymentName => GetRecordedVariable("AZURE_TEXT_CUSTOM_SINGLE_CLASSIFICATION_DEPLOYMENT");
23-
24-
public string CMCProjectName => GetRecordedVariable("AZURE_TEXT_CUSTOM_MULTI_CLASSIFICATION_PROJECT");
25-
26-
public string CMCDeploymentName => GetRecordedVariable("AZURE_TEXT_CUSTOM_MULTI_CLASSIFICATION_DEPLOYMENT");
13+
// Add other client parameters here as above.
14+
public string ApiKey => GetRecordedVariable("AZURE_DOCUMENTS_KEY", options => options.IsSecret());
2715
}
2816
}

sdk/cognitivelanguage/Azure.AI.Language.Documents/tests/Samples/CreateClient.cs

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,12 @@
88
using Azure.AI.Language.Documents.Tests;
99
using Azure.Core.TestFramework;
1010
using NUnit.Framework;
11+
using System.Collections.Generic;
1112
#region Snippet:Documents_Identity_Namespace
1213
using Azure.Identity;
1314
#endregion
1415

15-
namespace Azure.AI.Language.TextAnalytics.Tests.Samples
16+
namespace Azure.AI.Language.Documents.Tests.Samples
1617
{
1718
public partial class CreateClient : SamplesBase<DocumentAnalysisClientTestEnvironment>
1819
{
@@ -26,7 +27,7 @@ public void CreateDocumentAnalysisClientForSpecificApiVersion()
2627
endpoint = TestEnvironment.Endpoint;
2728
credential = new(TestEnvironment.ApiKey);
2829
#endif
29-
DocumentAnalysisClientOptions options = new DocumentAnalysisClientOptions(DocumentAnalysisClientOptions.ServiceVersion.V2023_04_01);
30+
DocumentAnalysisClientOptions options = new DocumentAnalysisClientOptions(DocumentAnalysisClientOptions.ServiceVersion.V2024_11_15_Preview);
3031
var client = new DocumentAnalysisClient(endpoint, credential, options);
3132
#endregion
3233
}
@@ -68,29 +69,26 @@ public void BadArgument()
6869
#region Snippet:DocumentAnalysisClient_BadRequest
6970
try
7071
{
71-
string textA =
72-
"We love this trail and make the trip every year. The views are breathtaking and well worth the hike!"
73-
+ " Yesterday was foggy though, so we missed the spectacular views. We tried again today and it was"
74-
+ " amazing. Everyone in my family liked the trail although it was too challenging for the less"
75-
+ " athletic among us. Not necessarily recommended for small children. A hotel close to the trail"
76-
+ " offers services for childcare in case you want that.";
72+
var body = new MultiLanguageDocumentInput()
73+
{
74+
Documents =
75+
{
76+
new MultiLanguageInput("D", null, null),
77+
}
78+
};
7779

78-
AnalyzeTextInput body = new TextEntityRecognitionInput()
80+
var actions = new List<AnalyzeDocumentsOperationAction>()
7981
{
80-
TextInput = new MultiLanguageTextInput()
82+
new PiiEntityRecognitionOperationAction()
8183
{
82-
MultiLanguageInputs =
84+
Parameters = new PiiActionContent()
8385
{
84-
new MultiLanguageInput("D", textA),
85-
}
86+
ModelVersion = "NotValid", // Invalid model version will is a bad request.
87+
},
8688
},
87-
ActionContent = new EntitiesActionContent()
88-
{
89-
ModelVersion = "NotValid", // Invalid model version will is a bad request.
90-
}
9189
};
9290

93-
Response<AnalyzeTextResult> response = client.AnalyzeText(body);
91+
var response = client.AnalyzeDocumentsOperation(body, actions);
9492
}
9593
catch (RequestFailedException ex)
9694
{

sdk/cognitivelanguage/tests.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,6 @@ extends:
2121
AZURE_TEXT_CUSTOM_SINGLE_CLASSIFICATION_DEPLOYMENT: $(csc-deployment)
2222
AZURE_TEXT_CUSTOM_MULTI_CLASSIFICATION_PROJECT: $(cmc-project)
2323
AZURE_TEXT_CUSTOM_MULTI_CLASSIFICATION_DEPLOYMENT: $(cmc-deployment)
24+
AZURE_DOCUMENTS_ENDPOINT: $(doc-uri)
25+
AZURE_DOCUMENTS_KEY: $(doc-key)
2426
ServiceDirectory: cognitivelanguage

0 commit comments

Comments
 (0)