Skip to content

Commit

Permalink
CodeGen from PR 27740 in Azure/azure-rest-api-specs
Browse files Browse the repository at this point in the history
Merge 79ccb276e0eeb82473b3809fd215519c177a45a8 into 6e12137e69c1427ab45c4bab8cf98bd85503e4f2
  • Loading branch information
SDKAuto committed Feb 12, 2024
1 parent 64b62c6 commit 4422150
Show file tree
Hide file tree
Showing 12 changed files with 116 additions and 60 deletions.
44 changes: 35 additions & 9 deletions sdk/vision/ai-vision-image-analysis-rest/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,43 @@
# Release History

## 1.0.0-beta.2 (Unreleased)

### Features Added
## 1.0.0-beta.2 (2024-02-12)

**Features**

### Breaking Changes
The type names for AnalyzeFromBuffer* have changed to AnalyzeFromImageData*
- Added operation group AnalyzeFromImageData
- Added Interface AnalyzeFromImageData200Response
- Added Interface AnalyzeFromImageDataBodyParam
- Added Interface AnalyzeFromImageDataDefaultHeaders
- Added Interface AnalyzeFromImageDataDefaultResponse
- Added Interface AnalyzeFromImageDataMediaTypesParam
- Added Interface AnalyzeFromImageDataQueryParam
- Added Interface AnalyzeFromImageDataQueryParamProperties
- Added Type Alias AnalyzeFromImageDataParameters
- Interface ImageAnalysisResultOutput has a new optional parameter caption
- Interface ImageAnalysisResultOutput has a new optional parameter denseCaptions
- Interface ImageAnalysisResultOutput has a new optional parameter objects
- Interface ImageAnalysisResultOutput has a new optional parameter people
- Interface ImageAnalysisResultOutput has a new optional parameter read
- Interface ImageAnalysisResultOutput has a new optional parameter smartCrops
- Interface ImageAnalysisResultOutput has a new optional parameter tags

### Bugs Fixed
**Breaking Changes**

### Other Changes
- Removed operation group AnalyzeFromBuffer
- Interface ImageAnalysisResultOutput no longer has parameter captionResult
- Interface ImageAnalysisResultOutput no longer has parameter denseCaptionsResult
- Interface ImageAnalysisResultOutput no longer has parameter objectsResult
- Interface ImageAnalysisResultOutput no longer has parameter peopleResult
- Interface ImageAnalysisResultOutput no longer has parameter readResult
- Interface ImageAnalysisResultOutput no longer has parameter smartCropsResult
- Interface ImageAnalysisResultOutput no longer has parameter tagsResult
- Interface ImageBoundingBoxOutput no longer has parameter h
- Interface ImageBoundingBoxOutput no longer has parameter w
- Interface ImageBoundingBoxOutput has a new required parameter height
- Interface ImageBoundingBoxOutput has a new required parameter width

# Release History

## 1.0.0-beta.1 (2024-01-09)

### Features Added
Initial release of Image Analysis SDK. Uses the generally available [Computer Vision REST API (2023-10-01)](https://eastus.dev.cognitive.microsoft.com/docs/services/Cognitive_Services_Unified_Vision_API_2023-10-01).

Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@
}
}
}
}
}
2 changes: 1 addition & 1 deletion sdk/vision/ai-vision-image-analysis-rest/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -114,4 +114,4 @@
"browser": {
"./dist-esm/test/public/utils/env.js": "./dist-esm/test/public/utils/env.browser.js"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -195,21 +195,21 @@ export type ImageAnalysisClient = Client & {

// @public
export interface ImageAnalysisResultOutput {
captionResult?: CaptionResultOutput;
denseCaptionsResult?: DenseCaptionsResultOutput;
caption?: CaptionResultOutput;
denseCaptions?: DenseCaptionsResultOutput;
metadata: ImageMetadataOutput;
modelVersion: string;
objectsResult?: ObjectsResultOutput;
peopleResult?: PeopleResultOutput;
readResult?: ReadResultOutput;
smartCropsResult?: SmartCropsResultOutput;
tagsResult?: TagsResultOutput;
objects?: ObjectsResultOutput;
people?: PeopleResultOutput;
read?: ReadResultOutput;
smartCrops?: SmartCropsResultOutput;
tags?: TagsResultOutput;
}

// @public
export interface ImageBoundingBoxOutput {
h: number;
w: number;
height: number;
width: number;
x: number;
y: number;
}
Expand Down
13 changes: 10 additions & 3 deletions sdk/vision/ai-vision-image-analysis-rest/src/clientDefinitions.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

import { AnalyzeFromImageDataParameters, AnalyzeFromUrlParameters } from "./parameters";
import {
AnalyzeFromImageDataParameters,
AnalyzeFromUrlParameters,
} from "./parameters";
import {
AnalyzeFromImageData200Response,
AnalyzeFromImageDataDefaultResponse,
Expand All @@ -14,11 +17,15 @@ export interface AnalyzeFromImageData {
/** Performs a single Image Analysis operation */
post(
options: AnalyzeFromImageDataParameters,
): StreamableMethod<AnalyzeFromImageData200Response | AnalyzeFromImageDataDefaultResponse>;
): StreamableMethod<
AnalyzeFromImageData200Response | AnalyzeFromImageDataDefaultResponse
>;
/** Performs a single Image Analysis operation */
post(
options: AnalyzeFromUrlParameters,
): StreamableMethod<AnalyzeFromUrl200Response | AnalyzeFromUrlDefaultResponse>;
): StreamableMethod<
AnalyzeFromUrl200Response | AnalyzeFromUrlDefaultResponse
>;
}

export interface Routes {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,16 @@ export default function createClient(
logger: options.loggingOptions?.logger ?? logger.info,
},
credentials: {
apiKeyHeaderName: options.credentials?.apiKeyHeaderName ?? "Ocp-Apim-Subscription-Key",
apiKeyHeaderName:
options.credentials?.apiKeyHeaderName ?? "Ocp-Apim-Subscription-Key",
},
};

const client = getClient(baseUrl, credentials, options) as ImageAnalysisClient;
const client = getClient(
baseUrl,
credentials,
options,
) as ImageAnalysisClient;

return client;
}
17 changes: 12 additions & 5 deletions sdk/vision/ai-vision-image-analysis-rest/src/isUnexpected.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,17 +55,24 @@ function getParametrizedPathSuccess(method: string, path: string): string[] {

// track if we have found a match to return the values found.
let found = true;
for (let i = candidateParts.length - 1, j = pathParts.length - 1; i >= 1 && j >= 1; i--, j--) {
if (candidateParts[i]?.startsWith("{") && candidateParts[i]?.indexOf("}") !== -1) {
for (
let i = candidateParts.length - 1, j = pathParts.length - 1;
i >= 1 && j >= 1;
i--, j--
) {
if (
candidateParts[i]?.startsWith("{") &&
candidateParts[i]?.indexOf("}") !== -1
) {
const start = candidateParts[i]!.indexOf("}") + 1,
end = candidateParts[i]?.length;
// If the current part of the candidate is a "template" part
// Try to use the suffix of pattern to match the path
// {guid} ==> $
// {guid}:export ==> :export$
const isMatched = new RegExp(`${candidateParts[i]?.slice(start, end)}`).test(
pathParts[j] || "",
);
const isMatched = new RegExp(
`${candidateParts[i]?.slice(start, end)}`,
).test(pathParts[j] || "");

if (!isMatched) {
found = false;
Expand Down
18 changes: 9 additions & 9 deletions sdk/vision/ai-vision-image-analysis-rest/src/outputModels.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,29 @@
/** Represents the outcome of an Image Analysis operation. */
export interface ImageAnalysisResultOutput {
/** The generated phrase that describes the content of the analyzed image. */
captionResult?: CaptionResultOutput;
caption?: CaptionResultOutput;
/**
* The up to 10 generated phrases, the first describing the content of the whole image,
* and the others describing the content of different regions of the image.
*/
denseCaptionsResult?: DenseCaptionsResultOutput;
denseCaptions?: DenseCaptionsResultOutput;
/** Metadata associated with the analyzed image. */
metadata: ImageMetadataOutput;
/** The cloud AI model used for the analysis */
modelVersion: string;
/** A list of detected physical objects in the analyzed image, and their location. */
objectsResult?: ObjectsResultOutput;
objects?: ObjectsResultOutput;
/** A list of detected people in the analyzed image, and their location. */
peopleResult?: PeopleResultOutput;
people?: PeopleResultOutput;
/** The extracted printed and hand-written text in the analyze image. Also knows as OCR. */
readResult?: ReadResultOutput;
read?: ReadResultOutput;
/**
* A list of crop regions at the desired as aspect ratios (if provided) that can be used as image thumbnails.
* These regions preserve as much content as possible from the analyzed image, with priority given to detected faces.
*/
smartCropsResult?: SmartCropsResultOutput;
smartCrops?: SmartCropsResultOutput;
/** A list of content tags in the analyzed image. */
tagsResult?: TagsResultOutput;
tags?: TagsResultOutput;
}

/** Represents a generated phrase that describes the content of the whole image. */
Expand Down Expand Up @@ -69,9 +69,9 @@ export interface ImageBoundingBoxOutput {
/** Y-coordinate of the top left point of the area, in pixels. */
y: number;
/** Width of the area, in pixels. */
w: number;
width: number;
/** Height of the area, in pixels. */
h: number;
height: number;
}

/** Metadata associated with the analyzed image. */
Expand Down
6 changes: 5 additions & 1 deletion sdk/vision/ai-vision-image-analysis-rest/src/parameters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ export interface AnalyzeFromImageDataBodyParam {
*
* Value may contain any sequence of octets
*/
body: string | Uint8Array | ReadableStream<Uint8Array> | NodeJS.ReadableStream;
body:
| string
| Uint8Array
| ReadableStream<Uint8Array>
| NodeJS.ReadableStream;
}

export interface AnalyzeFromImageDataQueryParamProperties {
Expand Down
12 changes: 9 additions & 3 deletions sdk/vision/ai-vision-image-analysis-rest/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
{
"extends": "../../../tsconfig.package",
"compilerOptions": { "outDir": "./dist-esm", "declarationDir": "./types" },
"include": ["src/**/*.ts", "./test/**/*.ts"]
}
"compilerOptions": {
"outDir": "./dist-esm",
"declarationDir": "./types"
},
"include": [
"src/**/*.ts",
"./test/**/*.ts"
]
}
5 changes: 3 additions & 2 deletions sdk/vision/ai-vision-image-analysis-rest/tsp-location.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
commit: 0200a1b1ebdc13cef42097b124c98ee25566ce5e
directory: specification/ai/ImageAnalysis
additionalDirectories: []
repo: Azure/azure-rest-api-specs
commit: 3cf7400ba3d65978bef86e9c4197a5e7f7bf5277
additionalDirectories: []

30 changes: 15 additions & 15 deletions sdk/vision/ci.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file.

trigger:
branches:
include:
- main
- hotfix/*
- release/*
- restapi*
- main
- hotfix/*
- release/*
- restapi*
paths:
include:
- sdk/vision/

- sdk/vision/
pr:
branches:
include:
- main
- feature/*
- hotfix/*
- release/*
- restapi*
- main
- feature/*
- hotfix/*
- release/*
- restapi*
exclude:
- feature/v4
paths:
include:
- sdk/vision/

- sdk/vision/
extends:
template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml
parameters:
ServiceDirectory: vision
Artifacts:
- name: azure-rest-ai-vision-image-analysis
safeName: azurerestaivisionimageanalysis
safeName: azurerestaivisionimageanalysis

0 comments on commit 4422150

Please sign in to comment.