Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

js release notes for the 2025-01 release #8363

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
98 changes: 98 additions & 0 deletions _data/releases/2025-01/js.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
entries:
- Name: '@azure-rest/ai-document-intelligence'
Version: 1.0.0
DisplayName: Document Intelligence
ServiceName: Cognitive Services
VersionType: GA
Hidden: false
ChangelogUrl: https://github.com/Azure/azure-sdk-for-js/tree/@azure-rest/ai-document-intelligence_1.0.0/sdk/documentintelligence/ai-document-intelligence-rest/CHANGELOG.md
ChangelogContent: |-
#### Breaking Changes

- Removes the `poller.getOperationId()` for a given polling operation. Use `parseResultIdFromResponse` to extract the `operationId` directly.
- `getLongRunningPoller` function is not async anymore, do not `await` on it.

#### Features Added

- Adds `streamToUint8Array`, a convenience function that buffers a `NodeJS.ReadableStream` in a `Uint8Array`. It can be used to read the pdf and png responses from the results of an analysis.

```ts
import DocumentIntelligence from "@azure-rest/ai-document-intelligence";
import { streamToUint8Array } from "@azure-rest/ai-document-intelligence";

const client = DocumentIntelligence("<DOCUMENT_INTELLIGENCE_ENDPOINT>", {
key: "<DOCUMENT_INTELLIGENCE_API_KEY>",
});

// Do analysis on you document and get the resultId, figureId

// Example for the figures api that provides an image output
const output = await client
.path(
"/documentModels/{modelId}/analyzeResults/{resultId}/figures/{figureId}",
"prebuilt-layout",
resultId,
figureId
)
.get()
.asNodeStream(); // output.body would be NodeJS.ReadableStream

if (output.status !== "200" || !output.body) {
throw new Error("The response was unexpected, expected NodeJS.ReadableStream in the body.");
}

const imageData = await streamToUint8Array(output.body);
fs.promises.writeFile(`./figures/${figureId}.png`, imageData); // Or you can consume the NodeJS.ReadableStream directly
```

- Adds `parseResultIdFromResponse`, a convenience function that extracts the `operationId` from the batch analysis response.

```js
// Example
const initialResponse = await client
.path("/documentModels/{modelId}:analyzeBatch", "prebuilt-layout")
.post({
contentType: "application/json",
body: {
azureBlobSource: {
containerUrl: batchTrainingFilesContainerUrl(),
},
resultContainerUrl: batchTrainingFilesResultContainerUrl(),
resultPrefix: "result",
},
});

if (isUnexpected(initialResponse)) {
throw initialResponse.body.error;
}
const batchResultId = parseResultIdFromResponse(initialResponse);

const response = await client
.path(
"/documentModels/{modelId}/analyzeBatchResults/{resultId}",
"prebuilt-layout",
batchResultId
)
.get();
```

- Changes the following interfaces as follows:

- `AnalyzeBatchDocumentsBodyParam`:
- Updates `body` to be required.
- `AnalyzeBatchOperationOutput`:
- Adds `resultId`.
- `AnalyzeDocumentBodyParam`:
- Changes `body` from optional to required.
- `DocumentClassifierDetailsOutput`:
- Adds `modifiedDateTime`.
- `DocumentModelDetailsOutput`:
- Adds `modifiedDateTime`.

- Introduces new interfaces to define query parameters for document analysis requests, allowing customizable `style` and `explode` options:
- **AnalyzeBatchDocumentsFeaturesQueryParam**: Accepts DocumentAnalysisFeature[] values.
- **AnalyzeBatchDocumentsOutputQueryParam**: Accepts AnalyzeOutputOption[] values.
- **AnalyzeBatchDocumentsQueryFieldsQueryParam**: Accepts string[] values.
- **AnalyzeDocumentFeaturesQueryParam**: Accepts DocumentAnalysisFeature[] values.
- **AnalyzeDocumentFromStreamFeaturesQueryParam**: Accepts DocumentAnalysisFeature[] values.

Loading