Skip to content

Commit

Permalink
[TextAnalytics] [Conversations] Update method naming in client.tsp (#…
Browse files Browse the repository at this point in the history
…29622)

* [TA] [Conversations] Update naming in client.tsp

* enable model-namespaces

* fix tsv errors

* small change

* Add prediction base

* one more rename

* another rename

* some missed ones

* small change

* rename

* ta change

* Add HC namespace

* casing + remove hc folder

* remove sentenceSentiment override

* another one

* update

* renames

* disable protocol methods

* tsp compile

* Update naming conventions

* Add AAD auth

* renames

* change

* update TextAnalytics TSP for sdk

* rename for Conversations SDK

* remove duplicates

* update config

* Removed duplicates in naming

* fix client names and operation names

* update

* Fix the casing of the result

* fix Text SDK errors

* fix AnalyzeTextLROResultsKind access level

* bugfix AbstractiveSummarizationLROTask parameters to be optional

* typo

* align

* update Text client name to TextAnalysis

* Fix the examples

* Add tsv compile

* Missed file

* rename issue

* Fix input polymorphism

* Update clientName

* remove model namespace

* Backcompat

* small update

* update client

---------

Co-authored-by: Bidisha Chakraborty <bidishac@microsoft.com>
Co-authored-by: Quentin Robinson <32183739+quentinRobinson@users.noreply.github.com>
  • Loading branch information
3 people authored and hmmorales committed Jul 31, 2024
1 parent 7e0c484 commit 93e5c1d
Show file tree
Hide file tree
Showing 56 changed files with 1,379 additions and 121 deletions.
975 changes: 939 additions & 36 deletions specification/cognitiveservices/Language.AnalyzeText/client.tsp

Large diffs are not rendered by default.

17 changes: 10 additions & 7 deletions specification/cognitiveservices/Language.AnalyzeText/main.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,16 @@ using TypeSpec.Rest;
using TypeSpec.Versioning;
using Azure.Core;
using Azure.Core.Traits;

/** 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 <a href=\"https://docs.microsoft.com/azure/cognitive-services/language-service/overview\">https://docs.microsoft.com/azure/cognitive-services/language-service/overview</a>.0 */
@useAuth(
TypeSpec.Http.ApiKeyAuth<
TypeSpec.Http.ApiKeyLocation.header,
"Ocp-Apim-Subscription-Key"
>
ApiKeyAuth<ApiKeyLocation.header, "Ocp-Apim-Subscription-Key"> | OAuth2Auth<[
{
type: OAuth2FlowType.authorizationCode,
authorizationUrl: "https://login.microsoftonline.com/common/oauth2/authorize",
tokenUrl: "https://login.microsoftonline.com/common/oauth2/token",
scopes: ["https://cognitiveservices.azure.com/.default"],
}
]>
)
@service({
title: "Microsoft Cognitive Language Service - Text Analysis",
Expand All @@ -39,7 +42,7 @@ using Azure.Core.Traits;
}
)
@versioned(Versions)
namespace Language.AnalyzeText;
namespace Language.Text;

/** Analyze Conversations Service Versions */
enum Versions {
Expand Down Expand Up @@ -67,7 +70,7 @@ alias languageOperations = ResourceOperations<ServiceTraits, ErrorResponse>;
@post
@route("/:analyze-text")
op analyzeText is RpcOperation<
AnalyzeTextTask & AnalyzeTextQueryParameters,
AnalyzeTextBody & AnalyzeTextQueryParameters,
AnalyzeTextTaskResult,
{},
ErrorResponse
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ using TypeSpec.Versioning;
using Azure.Core;
using Azure.Core.Traits;

namespace Language.AnalyzeText;
namespace Language.Text;

/** These are the [Azure Active Directory OAuth2](https://docs.microsoft.com/azure/active-directory/develop/v1-overview) Flows. When paired with [Azure role-based access](https://docs.microsoft.com/azure/role-based-access-control/overview) control it can be used to control access to Azure Maps REST APIs. Azure role-based access controls are used to designate access to one or more Azure Maps resource account or sub-resources. Any user, group, or service principal can be granted access via a built-in role or a custom role composed of one or more permissions to Azure Maps REST APIs.\n\nTo implement scenarios, we recommend viewing [authentication concepts](https://aka.ms/amauth). In summary, this security definition provides a solution for modeling application(s) via objects capable of access control on specific APIs and scopes.\n\n#### Notes\n* This security definition **requires** the use of the `x-ms-client-id` header to indicate which Azure Maps resource the application is requesting access to. This can be acquired from the [Maps management API](https://aka.ms/amauthdetails).\n* \nThe `Authorization URL` is specific to the Azure public cloud instance. Sovereign clouds have unique Authorization URLs and Azure Active directory configurations. \n* \nThe Azure role-based access control is configured from the [Azure management plane](https://aka.ms/amrbac) via Azure portal, PowerShell, CLI, Azure SDKs, or REST APIs.\n* \nUsage of the [Azure Maps Web SDK](https://aka.ms/amaadmc) allows for configuration based setup of an application for multiple use cases.\n* Currently, Azure Active Directory [v1.0 or v2.0](https://docs.microsoft.com/azure/active-directory/develop/azure-ad-endpoint-comparison) supports Work, School, and Guests but does not support Personal accounts. */
#suppress "@azure-tools/typespec-azure-core/casing-style" "The names of Model types must use PascalCase"
Expand Down Expand Up @@ -485,9 +485,17 @@ model PreBuiltTaskParameters is TaskParameters {
modelVersion?: string = "latest";
}

alias AnalyzeTextBody = {
/** The input documents to analyze. */
@body
@clientName("analyzeTextInput", "csharp")
body: AnalyzeTextTask;
};

alias ShowStatsQueryParameter = QueryParametersTrait<{
/** (Optional) if set to true, response will contain request and document level statistics. */
@query
@clientName("showStatistics", "csharp")
showStats?: boolean;
}>;

Expand All @@ -508,6 +516,7 @@ alias AnalyzeTextJobQueryParameters = QueryParametersTrait<{
alias AnalyzeTextQueryParameters = {
/** (Optional) if set to true, response will contain request and document level statistics. */
@query
@clientName("showStatistics", "csharp")
showStats?: boolean;
};

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import "@typespec/versioning";

using Language.Text;
using Azure.ClientGenerator.Core;
using TypeSpec.Versioning;

namespace Language.AnalyzeText;
namespace Language.Text;
/** Supported parameters for a custom Healthcare task. */
@added(Versions.v2023_11_15_preview)
model CustomHealthcareTaskParameters is CustomTaskParameters {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ using TypeSpec.Http;
using TypeSpec.Rest;
using TypeSpec.Versioning;

namespace Language.AnalyzeText;
namespace Language.Text;

/** Supported parameters for a Custom Entities task. */
model CustomEntitiesTaskParameters is CustomTaskParameters {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import "@azure-tools/typespec-client-generator-core";
using Azure.ClientGenerator.Core;
using TypeSpec.Versioning;

namespace Language.AnalyzeText;
namespace Language.Text;

/** Contains the analyze text Entity linking input. */
model AnalyzeTextEntityLinkingInput extends AnalyzeTextTask {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import "@azure-tools/typespec-client-generator-core";
using Azure.ClientGenerator.Core;
using TypeSpec.Versioning;

namespace Language.AnalyzeText;
namespace Language.Text;

/** The entity recognition analyze text input task request. */
model AnalyzeTextEntityRecognitionInput extends AnalyzeTextTask {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import "@azure-tools/typespec-azure-core";
using TypeSpec.Versioning;
using Azure.Core;

namespace Language.AnalyzeText;
namespace Language.Text;

/** Supported parameters for a Healthcare task. */
model HealthcareTaskParameters is PreBuiltTaskParameters {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import "@azure-tools/typespec-client-generator-core";
using Azure.ClientGenerator.Core;
using TypeSpec.Versioning;

namespace Language.AnalyzeText;
namespace Language.Text;

@doc("Contains the analyze text KeyPhraseExtraction task input.")
model AnalyzeTextKeyPhraseExtractionInput extends AnalyzeTextTask {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import "@azure-tools/typespec-client-generator-core";
using Azure.ClientGenerator.Core;
using TypeSpec.Versioning;

namespace Language.AnalyzeText;
namespace Language.Text;

/** Contains the language detection document analysis input. */
model LanguageDetectionAnalysisInput {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import "@azure-tools/typespec-client-generator-core";
using Azure.ClientGenerator.Core;
using TypeSpec.Versioning;

namespace Language.AnalyzeText;
namespace Language.Text;

/** Contains the analyze text PIIEntityRecognition task input. */
#suppress "@azure-tools/typespec-azure-core/casing-style"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ using Azure.ClientGenerator.Core;
using TypeSpec.Versioning;
using Azure.Core;

namespace Language.AnalyzeText;
namespace Language.Text;

/** Contains the analyze text SentimentAnalysis task input. */
model AnalyzeTextSentimentAnalysisInput extends AnalyzeTextTask {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import "@azure-tools/typespec-client-generator-core";
using Azure.ClientGenerator.Core;
using TypeSpec.Versioning;

namespace Language.AnalyzeText;
namespace Language.Text;

/** Supported parameters for an Extractive Summarization task. */
@added(Versions.v2023_04_01)
Expand Down Expand Up @@ -107,7 +107,7 @@ model AbstractiveSummarizationLROTask extends AnalyzeTextLROTask {
kind: AnalyzeTextLROTaskKind.AbstractiveSummarization;

/** Parameters for the Abstractive Summarization task. */
parameters: AbstractiveSummarizationTaskParameters;
parameters?: AbstractiveSummarizationTaskParameters;
}

/** Supported parameters for the pre-built Abstractive Summarization task. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@ options:
package-dir: "Azure.AI.Language.AnalyzeText"
clear-output-folder: true
model-namespace: false
namespace: "Azure.AI.Language.AnalyzeText"
namespace: "Azure.AI.Language.Text"
flavor: azure
generate-protocol-methods: true
Loading

0 comments on commit 93e5c1d

Please sign in to comment.