Skip to content

Commit

Permalink
update version
Browse files Browse the repository at this point in the history
  • Loading branch information
deyaaeldeen committed Nov 6, 2020
1 parent cdec7a2 commit b1abb41
Show file tree
Hide file tree
Showing 11 changed files with 40 additions and 64 deletions.
2 changes: 1 addition & 1 deletion sdk/textanalytics/ai-text-analytics/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"sdk-type": "client",
"author": "Microsoft Corporation",
"description": "An isomorphic client library for the Azure Text Analytics service.",
"version": "5.2.0-beta.1",
"version": "5.1.0-beta.3",
"keywords": [
"node",
"azure",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,14 +160,8 @@ export type DocumentSentimentLabel = "positive" | "neutral" | "negative" | "mixe

// @public (undocumented)
export type EntitiesTask = {
parameters?: EntitiesTaskParameters;
};

// @public (undocumented)
export interface EntitiesTaskParameters {
// (undocumented)
modelVersion?: string;
}
};

// @public
export interface Entity {
Expand Down Expand Up @@ -256,8 +250,10 @@ export interface JobManifestTasks {
entityRecognitionPiiTasks?: PiiTask[];
// (undocumented)
entityRecognitionTasks?: EntitiesTask[];
// Warning: (ae-forgotten-export) The symbol "KeyPhrasesTask" needs to be exported by the entry point index.d.ts
//
// (undocumented)
keyPhraseExtractionTasks?: KeyPhrasesTask[];
keyPhraseExtractionTasks?: KeyPhrasesTask_2[];
}

// @public (undocumented)
Expand Down Expand Up @@ -328,16 +324,9 @@ export enum PiiEntityDomainType {

// @public (undocumented)
export type PiiTask = {
parameters?: PiiTaskParameters;
};

// @public (undocumented)
export interface PiiTaskParameters {
// (undocumented)
domain?: PiiTaskParametersDomain;
// (undocumented)
modelVersion?: string;
}
};

// @public
export type PiiTaskParametersDomain = "phi" | "none" | string;
Expand Down
2 changes: 1 addition & 1 deletion sdk/textanalytics/ai-text-analytics/src/constants.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

export const SDK_VERSION: string = "5.2.0-beta.1";
export const SDK_VERSION: string = "5.1.0-beta.3";
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import * as coreHttp from "@azure/core-http";
import { GeneratedClientOptionalParams } from "./models";

const packageName = "@azure/ai-text-analytics";
const packageVersion = "5.2.0-beta.1";
const packageVersion = "5.1.0-beta.3";

export class GeneratedClientContext extends coreHttp.ServiceClient {
endpoint: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -890,13 +890,13 @@ export type ErrorCodeValue =
* Defines values for State.
*/
export type State =
| "notstarted"
| "notStarted"
| "running"
| "succeeded"
| "failed"
| "rejected"
| "cancelled"
| "cancelling"
| "notStarted"
| "partiallyCompleted";
/**
* Defines values for DocumentSentimentLabel.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -457,13 +457,13 @@ export const JobMetadata: coreHttp.CompositeMapper = {
type: {
name: "Enum",
allowedValues: [
"notstarted",
"notStarted",
"running",
"succeeded",
"failed",
"rejected",
"cancelled",
"cancelling",
"notStarted",
"partiallyCompleted"
]
}
Expand Down Expand Up @@ -609,13 +609,13 @@ export const TaskState: coreHttp.CompositeMapper = {
type: {
name: "Enum",
allowedValues: [
"notstarted",
"notStarted",
"running",
"succeeded",
"failed",
"rejected",
"cancelled",
"cancelling",
"notStarted",
"partiallyCompleted"
]
}
Expand Down
2 changes: 0 additions & 2 deletions sdk/textanalytics/ai-text-analytics/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,8 @@ export {
RecognizeLinkedEntitiesOptions,
PiiEntityDomainType,
JobManifestTasks,
EntitiesTaskParameters,
EntitiesTask,
PiiTask,
PiiTaskParameters,
BeginAnalyzeOptions,
AnalyzePollerLike,
BeginAnalyzeHealthcareOptions,
Expand Down
26 changes: 11 additions & 15 deletions sdk/textanalytics/ai-text-analytics/src/textAnalyticsClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ import {
GeneratedClientEntitiesRecognitionPiiOptionalParams,
GeneratedClientSentimentOptionalParams,
PiiTaskParametersDomain,
TextDocumentInput,
KeyPhrasesTask
TextDocumentInput
} from "./generated/models";
import {
DetectLanguageResultArray,
Expand Down Expand Up @@ -49,7 +48,7 @@ import {
import { createSpan } from "./tracing";
import { CanonicalCode } from "@opentelemetry/api";
import { createTextAnalyticsAzureKeyCredentialPolicy } from "./azureKeyCredentialPolicy";
import { addEncodingParamToTask, addStrEncodingParam, handleInvalidDocumentBatch } from "./util";
import { addEncodingParamToTask, AddParamsToTask, addStrEncodingParam, handleInvalidDocumentBatch } from "./util";
import {
BeginAnalyzeHealthcareOperationState,
BeginAnalyzeHealthcarePoller,
Expand Down Expand Up @@ -151,20 +150,16 @@ export type ExtractKeyPhrasesOptions = TextAnalyticsOperationOptions;
*/
export type RecognizeLinkedEntitiesOptions = TextAnalyticsOperationOptions;

export interface EntitiesTaskParameters {
modelVersion?: string;
}

export type EntitiesTask = {
parameters?: EntitiesTaskParameters;
modelVersion?: string;
};

export type PiiTask = {
parameters?: PiiTaskParameters;
domain?: PiiTaskParametersDomain;
modelVersion?: string;
};

export interface PiiTaskParameters {
domain?: PiiTaskParametersDomain;
export interface KeyPhrasesTask {
modelVersion?: string;
}

Expand Down Expand Up @@ -892,10 +887,11 @@ export class TextAnalyticsClient {
}

function addEncodingParamToAnalyzeInput(tasks: JobManifestTasks): GeneratedJobManifestTasks {
let tasksWithEncodingParam: GeneratedJobManifestTasks = tasks;
tasksWithEncodingParam.entityRecognitionPiiTasks?.map(addEncodingParamToTask);
tasksWithEncodingParam.entityRecognitionTasks?.map(addEncodingParamToTask);
return tasks;
return {
entityRecognitionPiiTasks: tasks.entityRecognitionPiiTasks?.map(addEncodingParamToTask).map(AddParamsToTask),
entityRecognitionTasks: tasks.entityRecognitionPiiTasks?.map(addEncodingParamToTask).map(AddParamsToTask),
keyPhraseExtractionTasks: tasks.keyPhraseExtractionTasks?.map(AddParamsToTask)
};
}

function isStringArray(documents: any[]): documents is string[] {
Expand Down
16 changes: 9 additions & 7 deletions sdk/textanalytics/ai-text-analytics/src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under the MIT license.

import { RestError } from "@azure/core-http";
import { StringIndexType } from "./generated/models";
import { StringIndexType, StringIndexTypeResponse } from "./generated/models";
import { logger } from "./logger";

export interface IdObject {
Expand Down Expand Up @@ -70,15 +70,17 @@ export function addStrEncodingParam<T>(options: T): T & { stringIndexType: Strin
return { ...options, stringIndexType: jsEncodingUnit };
}

export function addEncodingParamToTask<X, Y>(
task: X & { parameters?: Y & { stringIndexType?: StringIndexType } }
): X & { parameters?: Y & { stringIndexType?: StringIndexType } } {
if (task.parameters) {
task.parameters.stringIndexType = jsEncodingUnit;
}
export function addEncodingParamToTask<X>(
task: X & { stringIndexType?: StringIndexTypeResponse }
): X & { stringIndexType?: StringIndexTypeResponse } {
task.stringIndexType = jsEncodingUnit;
return task;
}

export function AddParamsToTask<X>(task: X): { parameters?: X } {
return { parameters: task };
}

export interface PageParam {
top: number;
skip: number;
Expand Down
4 changes: 2 additions & 2 deletions sdk/textanalytics/ai-text-analytics/swagger/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ generate-metadata: false
license-header: MICROSOFT_MIT_NO_VERSION
output-folder: ../
source-code-folder-path: ./src/generated
input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/master/specification/cognitiveservices/data-plane/TextAnalytics/preview/v3.1-preview.3/TextAnalytics.json
input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/6037ac7502b32c0540753915bd7643bd81fad991/specification/cognitiveservices/data-plane/TextAnalytics/preview/v3.1-preview.3/TextAnalytics.json
add-credentials: false
package-version: 5.2.0-beta.1
package-version: 5.1.0-beta.3
v3: true
use-extension:
"@autorest/typescript": "6.0.0-dev.20201027.1"
Expand Down
17 changes: 4 additions & 13 deletions sdk/textanalytics/ai-text-analytics/test/apiKey.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -485,23 +485,14 @@ describe("[API Key] TextAnalyticsClient", function() {
});

describe("#analyze", () => {
it.only("input strings", async () => {
it("input strings", async () => {
const docs = [
{ id: "1", language: "en", text: "Microsoft was founded by Bill Gates and Paul Allen." },
{
id: "2",
language: "en",
text: "I did not like the hotel we stayed at. It was too expensive."
},
{
id: "3",
language: "en",
text: "The restaurant had really good food. I recommend you try it."
}
{ id: "1", language: "en", text: "Microsoft was founded by Bill Gates and Paul Allen" },
{ id: "2", language: "es", text: "Microsoft fue fundado por Bill Gates y Paul Allen" }
];

const poller = await client.beginAnalyze(docs, {
entityRecognitionTasks: [{ parameters: { modelVersion: "latest" } }]
entityRecognitionTasks: [{ modelVersion: "latest" }]
});
const result = await poller.pollUntilDone();
for await (const doc of result) {
Expand Down

0 comments on commit b1abb41

Please sign in to comment.