Skip to content

feat: update Translator and AnalyzeText API support - #2696

Merged
Rana Singh (ranadeepsingh) merged 4 commits into
microsoft:masterfrom
ranadeepsingh:feat/translator-2026-language-api
Sep 4, 2026
Merged

feat: update Translator and AnalyzeText API support#2696
Rana Singh (ranadeepsingh) merged 4 commits into
microsoft:masterfrom
ranadeepsingh:feat/translator-2026-language-api

Conversation

@ranadeepsingh

@ranadeepsingh Rana Singh (ranadeepsingh) commented Sep 4, 2026

Copy link
Copy Markdown
Collaborator

Summary

Modernize the Azure AI language service integrations covered by #2693 and #2694:

  • add opt-in Translator Text API 2026-06-06 support for Translate and Transliterate
  • add a public Languages transformer with API-version-specific scopes and schemas
  • update AnalyzeText to use the GA 2024-11-01 API by default
  • document Translator migration, compatibility, and removed operations

Translator compatibility

Translator API 3.0 remains the default so existing pipelines keep their serialized parameters, request bodies, and output schemas.

When apiVersion is set to 2026-06-06:

  • Translate and Transliterate use the new inputs payload and wrapped value responses
  • compatible source, target, model, fallback, text type, and profanity controls are mapped to the new contract
  • Detect, BreakSentence, Dictionary Lookup, and Dictionary Examples are rejected before network execution because the 2026 API removed them
  • Languages validates the scopes supported by the selected API version
  • null and blank array entries are filtered before constructing 2026 requests, and requests without a valid target language fail with a clear error

Validation

  • Azure CI UnitTests translate: 59 passed, 0 failed
  • Azure CI UnitTests language: 98 passed, 0 failed
  • Azure Pipeline build 234539362: all checks passed
  • cognitive compile and Scala style checks
  • generated Python wrapper checks and repository Python formatting
  • Fabric Spark 3.5 runtime smoke
  • Fabric exact-jar provenance: Translate loaded from the cognitive jar built from this PR

The Translator request and response contracts were checked against the stable Azure Translator 2026-06-06 OpenAPI specification and migration documentation. Fabric validation proves managed-runtime and exact-jar compatibility; live Translator 2026-06-06 service behavior is covered by deterministic protocol tests rather than a credentialed Fabric service call.

Closes #2693
Closes #2694

AB#2693

## Summary`nAdd opt-in Translator Text API 2026-06-06 support for Translate, Transliterate, and Languages while preserving API 3.0 defaults and behavior. Update AnalyzeText to default to the 2024-11-01 GA API and add offline regression, schema, validation, fuzzing, and documentation coverage.

## Prompting Intent`nFix microsoft#2693 and microsoft#2694 in a new worktree. Preserve existing serialized and JVM behavior, implement the official version-specific wire contracts and removed-operation validation, avoid live-service tests, and prepare a merge-ready pull request against master.

## Linked Sources`n- Requirements: https://github.com/microsoft/SynapseML/issues/2693`n- Requirements: https://github.com/microsoft/SynapseML/issues/2694`n- Migration guide: https://learn.microsoft.com/azure/ai-services/translator/text-translation/how-to/migrate-to-2026-06-06`n- REST specification: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/translation/data-plane/TextTranslation/stable/2026-06-06

## Rationale`nKeep API 3.0 as the Translator default because 2026-06-06 is not wire-compatible. Use a scalar persisted API-version parameter so Spark output schemas remain deterministic, branch request and response handling only for supported operations, and reject removed operations before network execution. Model Languages scopes and schemas per API version and retain the existing Translate controls where the new target schema has direct equivalents.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>`nCopilot-Session: 7a122689-457b-4d0d-b387-2fac644ee89b
Copilot AI lite review requested due to automatic review settings September 4, 2026 17:49
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown

Hey Rana Singh (@ranadeepsingh) 👋!
Thank you so much for contributing to our repository 🙌.
Someone from SynapseML Team will be reviewing this pull request soon.

We use semantic commit messages to streamline the release process.
Before your pull request can be merged, you should make sure your first commit and PR title start with a semantic prefix.
This helps us to create release messages and credit you for your hard work!

Examples of commit messages with semantic prefixes:

  • fix: Fix LightGBM crashes with empty partitions
  • feat: Make HTTP on Spark back-offs configurable
  • docs: Update Spark Serving usage
  • build: Add codecov support
  • perf: improve LightGBM memory usage
  • refactor: make python code generation rely on classes
  • style: Remove nulls from CNTKModel
  • test: Add test coverage for CNTKModel

To test your commit locally, please follow our guild on building from source.
Check out the developer guide for additional guidance on testing your change.

@ranadeepsingh

Copy link
Copy Markdown
Collaborator Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

The Translator request-building logic can throw null-related runtime exceptions on common array-column inputs and should be corrected before approval.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review tier: Lite
Findings: 1 Medium severity · 1 Low severity

New issues introduced by this change (2)
Severity Finding
Medium severity cognitive/​src/​main/​scala/​com/​microsoft/​azure/​synapse/​ml/​services/​translate/​TextTranslator.scalaTextAsOnlyEntity always constructs inputs using JsString(s) even when running against API…
Low severity cognitive/​src/​main/​scala/​com/​microsoft/​azure/​synapse/​ml/​services/​translate/​TextTranslator.scalasupportedApiVersions is built from a Set.mkString, which is not guaranteed to be stable across…
What changed in this PR

Adds opt-in support for Azure Translator Text API 2026-06-06 across SynapseML’s Translator transformers while preserving API 3.0 as the default contract, and updates Azure Language AnalyzeText to default to the latest GA API version.

Changes:

  • Introduces Translator API version selection (3.0 default, opt-in 2026-06-06) with version-specific request/response handling for Translate and Transliterate, plus a new Languages transformer.
  • Adds offline/core tests validating deterministic defaults, version gating for unsupported operations, and 2026 payload/response schema shaping.
  • Updates AnalyzeText default API version to 2024-11-01 and documents Translator migration guidance.
File Description
docs/​Quick Examples/​transformers/​cognitive/​_Translator.md Documents Translator API 3.0 default and opt-in 2026-06-06 behavior/compatibility constraints.
cognitive/​src/​main/​scala/​com/​microsoft/​azure/​synapse/​ml/​services/​translate/​TextTranslator.scala Implements version-aware Translator request building, response schema selection, and adds Languages transformer.
cognitive/​src/​main/​scala/​com/​microsoft/​azure/​synapse/​ml/​services/​translate/​TranslatorSchemas.scala Adds 2026 response wrapper schemas and language schema modeling.
cognitive/​src/​main/​scala/​com/​microsoft/​azure/​synapse/​ml/​services/​language/​AnalyzeText.scala Updates AnalyzeText default API version to 2024-11-01.
cognitive/​src/​test/​scala/​com/​microsoft/​azure/​synapse/​ml/​services/​translate/​TextTranslatorCoreSuite.scala Adds deterministic/default/version-gating tests and 2026 request/response schema tests.
cognitive/​src/​test/​scala/​com/​microsoft/​azure/​synapse/​ml/​services/​translate/​TranslatorSuite.scala Adds fuzzing suite coverage for the new Languages transformer.
cognitive/​src/​test/​scala/​com/​microsoft/​azure/​synapse/​ml/​services/​language/​AnalyzeTextCoreOfflineSuite.scala Verifies AnalyzeText default API version selection.
Suppressed comments (1)

cognitive/src/main/scala/com/microsoft/azure/synapse/ml/services/translate/TextTranslator.scala:317

  • v2026Payload builds targets and inputs with JsString(language) / JsString(textValue) without filtering nulls. If toLanguage or text comes from an array column containing nulls, this will throw at request-build time. Filter out null/blank entries (and fail fast if no valid targets remain).
    val targets = getValue(row, toLanguage).map { language =>
      JsObject(Map("language" -> JsString(language)) ++
        targetScript.map("script" -> _) ++
        deploymentName.map("deploymentName" -> _) ++
        fallback.map("allowFallback" -> _) ++
        action.map("profanityAction" -> _) ++
        marker.map("profanityMarker" -> _))
    }
    val inputs = texts.map { textValue =>
      JsObject(Map("text" -> JsString(textValue), "targets" -> JsArray(targets.toVector)) ++
        sourceLanguage.map("language" -> _) ++
        sourceScript.map("script" -> _) ++
        sourceTextType.filterNot(_ == JsString("Plain")).map("textType" -> _))
    }

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@ranadeepsingh Rana Singh (ranadeepsingh) changed the title feat: support Translator Text API 2026-06-06 feat: update Translator and AnalyzeText API support Sep 4, 2026
AB#2693

## Summary
Filter null text entries before building Translator request bodies, filter null and blank inputs for the 2026 API, reject 2026 requests without a valid target language, and make supported-version errors deterministic.

## Prompting Intent
Review every unresolved and suppressed PR finding, address valid feedback without changing supported public contracts, add regression coverage, and keep the PR metadata aligned with both Translator and AnalyzeText changes.

## Linked Sources
- Requirements: microsoft#2693
- Requirements: microsoft#2694
- Null request-body review: microsoft#2696 (comment)
- Deterministic error review: microsoft#2696 (comment)
- Suppressed null-target review: microsoft#2696 (review)

## Rationale
Filtering invalid array entries at request construction prevents null-related exceptions while preserving valid text exactly. The v3 path keeps its established payload contract, while the 2026 path applies the stricter non-blank requirements of its nested input and target schema. Sorting supported versions avoids unstable error text across Scala and JVM implementations.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 7a122689-457b-4d0d-b387-2fac644ee89b
Copilot AI review requested due to automatic review settings September 4, 2026 19:19
@ranadeepsingh

Copy link
Copy Markdown
Collaborator Author

Addressed the suppressed null/blank-array finding in 2698459. Translator 2026 requests now filter null/blank text and target entries and reject rows with no valid target language; targeted regression tests cover mixed and all-invalid arrays.

@ranadeepsingh

Copy link
Copy Markdown
Collaborator Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

The implementation appears consistent with the stated compatibility goals and is backed by deterministic offline tests; the remaining review note is a minor determinism improvement to an error message.

Review tier: Lite
Findings: None

Issues resolved since last review (2)
Severity Finding
Low severity cognitive/​src/​main/​scala/​com/​microsoft/​azure/​synapse/​ml/​services/​translate/​TextTranslator.scalasupportedApiVersions is built from a Set.mkString, which is not guaranteed to be stable across… View resolved comment
Medium severity cognitive/​src/​main/​scala/​com/​microsoft/​azure/​synapse/​ml/​services/​translate/​TextTranslator.scalaTextAsOnlyEntity always constructs inputs using JsString(s) even when running against API… View resolved comment
Suppressed comments (1)

Previously missed (1) — in code that hasn't changed since the last review.

cognitive/src/main/scala/com/microsoft/azure/synapse/ml/services/translate/TextTranslator.scala:718

  • validateScope builds the allowed scopes as a Set and then interpolates allowed.mkString(", ") into the error message. Iteration order for Set is not guaranteed, so this can make the exception message non-deterministic across Scala/JVM versions (similar to the earlier supportedApiVersions ordering fix). Use an ordered collection for message formatting (or sort before mkString) while still validating membership efficiently.

AB#2693

## Summary
Sort the allowed Translator Languages scopes before including them in validation errors and cover both API-version-specific messages with deterministic assertions.

## Prompting Intent
Re-audit automated review feedback on the latest PR head, including suppressed findings, and address every valid issue before declaring the review complete.

## Linked Sources
- Requirements: microsoft#2693
- Pull request review: microsoft#2696 (review)

## Rationale
Languages scope membership remains set-based for efficient validation, while sorting only at message formatting preserves behavior and guarantees stable diagnostics across Scala and JVM implementations.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 7a122689-457b-4d0d-b387-2fac644ee89b
@ranadeepsingh

Copy link
Copy Markdown
Collaborator Author

Addressed the latest suppressed review finding in d13d373. Languages.validateScope now sorts allowed scopes before formatting validation errors, and both v3 and 2026 messages have deterministic regression assertions.

@ranadeepsingh

Copy link
Copy Markdown
Collaborator Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

@ranadeepsingh

Copy link
Copy Markdown
Collaborator Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🔵 Needs a closer look

Translate’s 2026 payload builder rejects v3-only params based on whether they are set rather than whether they are meaningfully enabled, which can cause unnecessary failures for neutral/default values.

Review tier: Lite
Findings: None

Suppressed comments (1)

Previously missed (1) — in code that hasn't changed since the last review.

cognitive/src/main/scala/com/microsoft/azure/synapse/ml/services/translate/TextTranslator.scala:292

  • In the 2026 payload path, this check rejects includeAlignment/includeSentenceLength/suggestedFrom whenever the params are set, even if they’re set to their neutral defaults (e.g., setIncludeAlignment(false)). That can cause an unnecessary failure during migration/config standardization. Prefer rejecting only when a non-default value is actually requested (true / non-blank).

AB#2693

## Summary
Allow explicitly configured neutral values for v3-only Translate controls when using API `2026-06-06`, while continuing to reject enabled alignment, sentence-length, or suggested-source behavior.

## Prompting Intent
Continue auditing current-head automated review feedback, including suppressed findings, and resolve compatibility issues before finalizing the pull request.

## Linked Sources
- Requirements: microsoft#2693
- Pull request review: microsoft#2696 (review)

## Rationale
Checking resolved parameter values rather than only whether a parameter was explicitly set preserves migration and configuration-standardization workflows. Neutral false or blank values do not request removed API behavior, while true or non-blank values still fail before network execution.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 7a122689-457b-4d0d-b387-2fac644ee89b
@ranadeepsingh

Copy link
Copy Markdown
Collaborator Author

Addressed the latest suppressed compatibility finding in f8329dd. Translator 2026 now rejects v3-only controls only when they request non-default behavior; explicitly set false and blank values remain migration-safe, with regression coverage.

@ranadeepsingh

Copy link
Copy Markdown
Collaborator Author

/azp run

1 similar comment
@ranadeepsingh

Copy link
Copy Markdown
Collaborator Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

1 similar comment
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🔵 Needs a closer look

It introduces version-dependent request/response schemas and a new public transformer in externally-facing Azure service integrations, which warrants final human validation.

Review tier: Lite
Findings: None

@ranadeepsingh
Rana Singh (ranadeepsingh) merged commit 8c71438 into microsoft:master Sep 4, 2026
78 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update AnalyzeText default API version from 2022-05-01 Add support for Translator Text API 2026-06-06

3 participants