Skip to content

Commit 672f01c

Browse files
author
Bidisha Chakraborty
committed
update
1 parent cd48345 commit 672f01c

File tree

54 files changed

+1981
-3362
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+1981
-3362
lines changed
Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,9 @@
11
# Release History
22

3-
## 1.0.0-beta.2 (Unreleased)
4-
5-
### Features Added
6-
7-
- Exposed `JsonModelWriteCore` for model serialization procedure.
8-
9-
### Breaking Changes
10-
11-
### Bugs Fixed
12-
13-
### Other Changes
14-
15-
## 1.0.0-beta.1 (2024-08-06)
3+
## 1.0.0-beta.1 (Unreleased)
164

175
- Initial release
186

197
### Features Added
20-
21-
- Added support for analyze-text API Versions
22-
- 2022-05-01
23-
- 2023-04-01
24-
- 2023-11-15-preview
8+
- Added support for analyze-documents API Versions
9+
- 2024-11-15-preview

sdk/cognitivelanguage/Azure.AI.Language.Documents/README.md

Lines changed: 184 additions & 33 deletions
Large diffs are not rendered by default.

sdk/cognitivelanguage/Azure.AI.Language.Documents/api/Azure.AI.Language.Documents.net8.0.cs

Lines changed: 1030 additions & 0 deletions
Large diffs are not rendered by default.

sdk/cognitivelanguage/Azure.AI.Language.Documents/api/Azure.AI.Language.Documents.netstandard2.0.cs

Lines changed: 129 additions & 267 deletions
Large diffs are not rendered by default.

sdk/cognitivelanguage/Azure.AI.Language.Documents/src/AnalyzeDocumentsClient.cs renamed to sdk/cognitivelanguage/Azure.AI.Language.Documents/src/DocumentAnalysisClient.cs

Lines changed: 29 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -3,30 +3,31 @@
33

44
using System;
55
using System.Collections.Generic;
6-
using System.Linq;
7-
using System.Text;
8-
using Azure.Core;
9-
using System.Threading;
106
using System.Threading.Tasks;
7+
using System.Threading;
8+
using Azure.Core;
119
using Azure.Core.Pipeline;
10+
using System.Linq;
1211

1312
namespace Azure.AI.Language.Documents
1413
{
15-
/// <summary> The language service API is a suite of natural language processing (NLP) skills built with best-in-class Microsoft machine learning algorithms. The API can be used to analyze unstructured text for tasks such as sentiment analysis, key phrase extraction, language detection and question answering. Further documentation can be found in &lt;a href=\"https://docs.microsoft.com/azure/cognitive-services/language-service/overview\"&gt;https://docs.microsoft.com/azure/cognitive-services/language-service/overview&lt;/a&gt;.0. </summary>
16-
public partial class AnalyzeDocumentsClient
14+
[CodeGenModel("AnalyzeDocumentsClient")]
15+
16+
public partial class DocumentAnalysisClient
1717
{
18-
/// <summary> Initializes a new instance of TextAnalysisClient. </summary>
18+
/// <summary>
19+
/// Initializes a new instance of the <see cref="DocumentAnalysisClient"/> class.
20+
/// </summary>
1921
/// <param name="endpoint"> Supported Cognitive Services endpoint (e.g., https://&lt;resource-name&gt;.cognitiveservices.azure.com). </param>
2022
/// <param name="credential"> A credential used to authenticate to an Azure Service. </param>
2123
/// <param name="options"> The options for configuring the client. </param>
22-
/// <exception cref="ArgumentNullException"> <paramref name="endpoint"/> or <paramref name="credential"/> is null. </exception>
23-
public AnalyzeDocumentsClient(Uri endpoint, TokenCredential credential, AnalyzeDocumentsClientOptions options)
24+
public DocumentAnalysisClient(Uri endpoint, TokenCredential credential, DocumentAnalysisClientOptions options = default)
2425
{
2526
Argument.AssertNotNull(endpoint, nameof(endpoint));
2627
Argument.AssertNotNull(credential, nameof(credential));
27-
options ??= new AnalyzeDocumentsClientOptions();
28+
options ??= new DocumentAnalysisClientOptions();
2829

29-
var authorizationScope = $"{(string.IsNullOrEmpty(options.Audience?.ToString()) ? TextAudience.AzurePublicCloud : options.Audience)}/.default";
30+
var authorizationScope = $"{(string.IsNullOrEmpty(options.Audience?.ToString()) ? DocumentsAudience.AzurePublicCloud : options.Audience)}/.default";
3031

3132
_tokenCredential = credential;
3233

@@ -37,30 +38,30 @@ public AnalyzeDocumentsClient(Uri endpoint, TokenCredential credential, AnalyzeD
3738
}
3839

3940
/// <summary> Submit a collection of text documents for analysis and get the results. Specify one or more unique tasks to be executed as a long-running operation. </summary>
40-
/// <param name="textInput"> Contains the input to be analyzed. </param>
41+
/// <param name="documentsInput"> Contains the documents to be analyzed. </param>
4142
/// <param name="actions"> List of tasks to be performed as part of the LRO. </param>
4243
/// <param name="displayName"> Name for the task. </param>
4344
/// <param name="defaultLanguage"> Default language to use for records requesting automatic language detection. </param>
4445
/// <param name="cancellationToken"> The cancellation token to use. </param>
45-
/// <exception cref="ArgumentNullException"> <paramref name="textInput"/> or <paramref name="actions"/> is null. </exception>
46-
public virtual Response<AnalyzeTextOperationState> AnalyzeTextOperation(MultiLanguageTextInput textInput, IEnumerable<AnalyzeTextOperationAction> actions, string displayName = null, string defaultLanguage = null, CancellationToken cancellationToken = default)
46+
/// <exception cref="ArgumentNullException"> <paramref name="documentsInput"/> or <paramref name="actions"/> is null. </exception>
47+
public virtual Response<AnalyzeDocumentsOperationState> AnalyzeDocumentsOperation(MultiLanguageDocumentInput documentsInput, IEnumerable<AnalyzeDocumentsOperationAction> actions, string displayName = null, string defaultLanguage = null, CancellationToken cancellationToken = default)
4748
{
48-
Argument.AssertNotNull(textInput, nameof(textInput));
49+
Argument.AssertNotNull(documentsInput, nameof(documentsInput));
4950
Argument.AssertNotNull(actions, nameof(actions));
5051

51-
string scopeName = $"{nameof(AnalyzeDocumentsClient)}.{nameof(AnalyzeTextOperation)}";
52+
string scopeName = $"{nameof(DocumentAnalysisClient)}.{nameof(AnalyzeDocumentsOperation)}";
5253
using var scope = ClientDiagnostics.CreateScope(scopeName);
5354
scope.Start();
5455

55-
AnalyzeTextSubmitJobRequest analyzeTextOperationInput = new AnalyzeTextSubmitJobRequest(displayName, textInput, actions.ToList(), defaultLanguage, null);
56+
var analyzeDocumentsInput = new AnalyzeDocumentsOperationInput(displayName, documentsInput, actions.ToList(), defaultLanguage, null);
5657
RequestContext context = FromCancellationToken(cancellationToken);
5758

5859
try
5960
{
60-
using HttpMessage message = CreateAnalyzeTextSubmitOperationRequest(analyzeTextOperationInput.ToRequestContent(), context);
61+
using HttpMessage message = CreateAnalyzeDocumentsSubmitOperationRequest(analyzeDocumentsInput.ToRequestContent(), context);
6162
var operation = ProtocolOperationHelpers.ProcessMessage(_pipeline, message, ClientDiagnostics, scopeName, OperationFinalStateVia.OperationLocation, context, WaitUntil.Completed);
6263
Response response = operation.GetRawResponse();
63-
return Response.FromValue(AnalyzeTextOperationState.FromResponse(response), response);
64+
return Response.FromValue(AnalyzeDocumentsOperationState.FromResponse(response), response);
6465
}
6566
catch (Exception e)
6667
{
@@ -69,31 +70,31 @@ public virtual Response<AnalyzeTextOperationState> AnalyzeTextOperation(MultiLan
6970
}
7071
}
7172

72-
/// <summary> Submit a collection of text documents for analysis and get the results. Specify one or more unique tasks to be executed as a long-running operation. </summary>
73-
/// <param name="textInput"> Contains the input to be analyzed. </param>
73+
/// <summary> Submit a collection of documents for analysis and get the results. Specify one or more unique tasks to be executed as a long-running operation. </summary>
74+
/// <param name="documentsInput"> Contains the input to be analyzed. </param>
7475
/// <param name="actions"> List of tasks to be performed as part of the LRO. </param>
7576
/// <param name="displayName"> Name for the task. </param>
7677
/// <param name="defaultLanguage"> Default language to use for records requesting automatic language detection. </param>
7778
/// <param name="cancellationToken"> The cancellation token to use. </param>
78-
/// <exception cref="ArgumentNullException"> <paramref name="textInput"/> or <paramref name="actions"/> is null. </exception>
79-
public virtual async Task<Response<AnalyzeTextOperationState>> AnalyzeTextOperationAsync(MultiLanguageTextInput textInput, IEnumerable<AnalyzeTextOperationAction> actions, string displayName = null, string defaultLanguage = null, CancellationToken cancellationToken = default)
79+
/// <exception cref="ArgumentNullException"> <paramref name="documentsInput"/> or <paramref name="actions"/> is null. </exception>
80+
public virtual async Task<Response<AnalyzeDocumentsOperationState>> AnalyzeDocumentsOperationAsync(MultiLanguageDocumentInput documentsInput, IEnumerable<AnalyzeDocumentsOperationAction> actions, string displayName = null, string defaultLanguage = null, CancellationToken cancellationToken = default)
8081
{
81-
Argument.AssertNotNull(textInput, nameof(textInput));
82+
Argument.AssertNotNull(documentsInput, nameof(documentsInput));
8283
Argument.AssertNotNull(actions, nameof(actions));
8384

84-
string scopeName = $"{nameof(AnalyzeDocumentsClient)}.{nameof(AnalyzeTextOperation)}";
85+
string scopeName = $"{nameof(DocumentAnalysisClient)}.{nameof(AnalyzeDocumentsOperation)}";
8586
using var scope = ClientDiagnostics.CreateScope(scopeName);
8687
scope.Start();
8788

88-
AnalyzeTextSubmitJobRequest analyzeTextOperationInput = new AnalyzeTextSubmitJobRequest(displayName, textInput, actions.ToList(), defaultLanguage, null);
89+
var analyzeDocumentsInput = new AnalyzeDocumentsOperationInput(displayName, documentsInput, actions.ToList(), defaultLanguage, null);
8990
RequestContext context = FromCancellationToken(cancellationToken);
9091

9192
try
9293
{
93-
using HttpMessage message = CreateAnalyzeTextSubmitOperationRequest(analyzeTextOperationInput.ToRequestContent(), context);
94+
using HttpMessage message = CreateAnalyzeDocumentsSubmitOperationRequest(analyzeDocumentsInput.ToRequestContent(), context);
9495
var operation = await ProtocolOperationHelpers.ProcessMessageAsync(_pipeline, message, ClientDiagnostics, scopeName, OperationFinalStateVia.OperationLocation, context, WaitUntil.Completed).ConfigureAwait(false);
9596
Response response = operation.GetRawResponse();
96-
return Response.FromValue(AnalyzeTextOperationState.FromResponse(response), response);
97+
return Response.FromValue(AnalyzeDocumentsOperationState.FromResponse(response), response);
9798
}
9899
catch (Exception e)
99100
{
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
namespace Azure.AI.Language.Documents
77
{
88
[CodeGenModel("AILanguageDocumentsClientBuilderExtensions")]
9-
public static partial class LanguageDocumentsClientBuilderExtensions
9+
public static partial class DocumentAnalysisClientBuilderExtensions
1010
{
1111
}
1212
}

sdk/cognitivelanguage/Azure.AI.Language.Documents/src/AnalyzeDocumentsClientOptions.cs renamed to sdk/cognitivelanguage/Azure.AI.Language.Documents/src/DocumentAnalysisClientOptions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public partial class DocumentAnalysisClientOptions : ClientOptions
1313
/// <summary>
1414
/// Gets or sets the audience to use for authentication with Azure Active Directory (AAD). The audience is not considered when using a shared key.
1515
/// </summary>
16-
/// <value>If <c>null</c>, <see cref="TextAudience.AzurePublicCloud" /> will be assumed.</value>
17-
internal TextAudience? Audience { get; set; }
16+
/// <value>If <c>null</c>, <see cref="DocumentsAudience.AzurePublicCloud" /> will be assumed.</value>
17+
internal DocumentsAudience? Audience { get; set; }
1818
}
1919
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License.
3+
4+
using Azure.Core;
5+
6+
namespace Azure.AI.Language.Documents
7+
{
8+
[CodeGenModel("AILanguageDocumentsModelFactory")]
9+
public partial class DocumentAnalysisModelFactory
10+
{
11+
}
12+
}

sdk/cognitivelanguage/Azure.AI.Language.Documents/src/TextAudience.cs renamed to sdk/cognitivelanguage/Azure.AI.Language.Documents/src/DocumentsAudience.cs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,20 @@
44
using System;
55
using System.ComponentModel;
66

7-
namespace Azure.AI.Language.Text
7+
namespace Azure.AI.Language.Documents
88
{
99
/// <summary> Cloud audiences available for Text. </summary>
10-
internal readonly partial struct TextAudience : IEquatable<TextAudience>
10+
internal readonly partial struct DocumentsAudience : IEquatable<DocumentsAudience>
1111
{
1212
private readonly string _value;
1313

1414
/// <summary>
15-
/// Initializes a new instance of the <see cref="TextAudience"/> object.
15+
/// Initializes a new instance of the <see cref="DocumentsAudience"/> object.
1616
/// </summary>
1717
/// <param name="value">The Azure Active Directory audience to use when forming authorization scopes.For the Language service, this value corresponds to a URL that identifies the Azure cloud where the resource is located. For more information: <see href="https://learn.microsoft.com/azure/azure-government/documentation-government-cognitiveservices" />.</param>
1818
/// <exception cref="ArgumentNullException"> <paramref name="value"/> is null. </exception>
1919
/// <remarks>Please use one of the constant members over creating a custom value unless you have special needs for doing so.</remarks>
20-
public TextAudience(string value)
20+
public DocumentsAudience(string value)
2121
{
2222
Argument.AssertNotNullOrEmpty(value, nameof(value));
2323
_value = value;
@@ -28,26 +28,26 @@ public TextAudience(string value)
2828
private const string AzurePublicCloudValue = "https://cognitiveservices.azure.com";
2929

3030
/// <summary> Azure China. </summary>
31-
public static TextAudience AzureChina { get; } = new TextAudience(AzureChinaValue);
31+
public static DocumentsAudience AzureChina { get; } = new DocumentsAudience(AzureChinaValue);
3232

3333
/// <summary> Azure Government. </summary>
34-
public static TextAudience AzureGovernment { get; } = new TextAudience(AzureGovernmentValue);
34+
public static DocumentsAudience AzureGovernment { get; } = new DocumentsAudience(AzureGovernmentValue);
3535

3636
/// <summary> Azure Public Cloud. </summary>
37-
public static TextAudience AzurePublicCloud { get; } = new TextAudience(AzurePublicCloudValue);
37+
public static DocumentsAudience AzurePublicCloud { get; } = new DocumentsAudience(AzurePublicCloudValue);
3838

39-
/// <summary> Determines if two <see cref="TextAudience"/> values are the same. </summary>
40-
public static bool operator ==(TextAudience left, TextAudience right) => left.Equals(right);
41-
/// <summary> Determines if two <see cref="TextAudience"/> values are not the same. </summary>
42-
public static bool operator !=(TextAudience left, TextAudience right) => !left.Equals(right);
43-
/// <summary> Converts a string to a <see cref="TextAudience"/>. </summary>
44-
public static implicit operator TextAudience(string value) => new TextAudience(value);
39+
/// <summary> Determines if two <see cref="DocumentsAudience"/> values are the same. </summary>
40+
public static bool operator ==(DocumentsAudience left, DocumentsAudience right) => left.Equals(right);
41+
/// <summary> Determines if two <see cref="DocumentsAudience"/> values are not the same. </summary>
42+
public static bool operator !=(DocumentsAudience left, DocumentsAudience right) => !left.Equals(right);
43+
/// <summary> Converts a string to a <see cref="DocumentsAudience"/>. </summary>
44+
public static implicit operator DocumentsAudience(string value) => new DocumentsAudience(value);
4545

4646
/// <inheritdoc />
4747
[EditorBrowsable(EditorBrowsableState.Never)]
48-
public override bool Equals(object obj) => obj is TextAudience other && Equals(other);
48+
public override bool Equals(object obj) => obj is DocumentsAudience other && Equals(other);
4949
/// <inheritdoc />
50-
public bool Equals(TextAudience other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase);
50+
public bool Equals(DocumentsAudience other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase);
5151

5252
/// <inheritdoc />
5353
[EditorBrowsable(EditorBrowsableState.Never)]

sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/AILanguageDocumentsClientBuilderExtensions.cs

Lines changed: 0 additions & 37 deletions
This file was deleted.

0 commit comments

Comments
 (0)