@azure-rest/ai-translation-text 1.0.3-alpha.20251209.1 → 2.0.0-alpha.20251217.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (133) hide show
  1. package/CHANGELOG.md +9 -2
  2. package/README.md +26 -173
  3. package/dist/browser/clientDefinitions.d.ts +2 -20
  4. package/dist/browser/clientDefinitions.d.ts.map +1 -1
  5. package/dist/browser/clientDefinitions.js.map +1 -1
  6. package/dist/browser/customClient.js +2 -2
  7. package/dist/browser/customClient.js.map +1 -1
  8. package/dist/browser/index.d.ts +0 -1
  9. package/dist/browser/index.d.ts.map +1 -1
  10. package/dist/browser/index.js +0 -1
  11. package/dist/browser/index.js.map +1 -1
  12. package/dist/browser/isUnexpected.d.ts +1 -4
  13. package/dist/browser/isUnexpected.d.ts.map +1 -1
  14. package/dist/browser/isUnexpected.js +0 -3
  15. package/dist/browser/isUnexpected.js.map +1 -1
  16. package/dist/browser/models.d.ts +96 -7
  17. package/dist/browser/models.d.ts.map +1 -1
  18. package/dist/browser/models.js.map +1 -1
  19. package/dist/browser/outputModels.d.ts +31 -209
  20. package/dist/browser/outputModels.d.ts.map +1 -1
  21. package/dist/browser/outputModels.js.map +1 -1
  22. package/dist/browser/parameters.d.ts +4 -160
  23. package/dist/browser/parameters.d.ts.map +1 -1
  24. package/dist/browser/parameters.js.map +1 -1
  25. package/dist/browser/responses.d.ts +5 -62
  26. package/dist/browser/responses.d.ts.map +1 -1
  27. package/dist/browser/responses.js.map +1 -1
  28. package/dist/browser/textTranslationClient.d.ts.map +1 -1
  29. package/dist/browser/textTranslationClient.js +3 -3
  30. package/dist/browser/textTranslationClient.js.map +1 -1
  31. package/dist/commonjs/clientDefinitions.d.ts +2 -20
  32. package/dist/commonjs/clientDefinitions.d.ts.map +1 -1
  33. package/dist/commonjs/clientDefinitions.js.map +1 -1
  34. package/dist/commonjs/customClient.js +2 -2
  35. package/dist/commonjs/customClient.js.map +1 -1
  36. package/dist/commonjs/index.d.ts +0 -1
  37. package/dist/commonjs/index.d.ts.map +1 -1
  38. package/dist/commonjs/index.js +0 -1
  39. package/dist/commonjs/index.js.map +1 -1
  40. package/dist/commonjs/isUnexpected.d.ts +1 -4
  41. package/dist/commonjs/isUnexpected.d.ts.map +1 -1
  42. package/dist/commonjs/isUnexpected.js +0 -3
  43. package/dist/commonjs/isUnexpected.js.map +1 -1
  44. package/dist/commonjs/models.d.ts +96 -7
  45. package/dist/commonjs/models.d.ts.map +1 -1
  46. package/dist/commonjs/models.js.map +1 -1
  47. package/dist/commonjs/outputModels.d.ts +31 -209
  48. package/dist/commonjs/outputModels.d.ts.map +1 -1
  49. package/dist/commonjs/outputModels.js.map +1 -1
  50. package/dist/commonjs/parameters.d.ts +4 -160
  51. package/dist/commonjs/parameters.d.ts.map +1 -1
  52. package/dist/commonjs/parameters.js.map +1 -1
  53. package/dist/commonjs/responses.d.ts +5 -62
  54. package/dist/commonjs/responses.d.ts.map +1 -1
  55. package/dist/commonjs/responses.js.map +1 -1
  56. package/dist/commonjs/textTranslationClient.d.ts.map +1 -1
  57. package/dist/commonjs/textTranslationClient.js +3 -3
  58. package/dist/commonjs/textTranslationClient.js.map +1 -1
  59. package/dist/commonjs/tsdoc-metadata.json +1 -1
  60. package/dist/esm/clientDefinitions.d.ts +2 -20
  61. package/dist/esm/clientDefinitions.d.ts.map +1 -1
  62. package/dist/esm/clientDefinitions.js.map +1 -1
  63. package/dist/esm/customClient.js +2 -2
  64. package/dist/esm/customClient.js.map +1 -1
  65. package/dist/esm/index.d.ts +0 -1
  66. package/dist/esm/index.d.ts.map +1 -1
  67. package/dist/esm/index.js +0 -1
  68. package/dist/esm/index.js.map +1 -1
  69. package/dist/esm/isUnexpected.d.ts +1 -4
  70. package/dist/esm/isUnexpected.d.ts.map +1 -1
  71. package/dist/esm/isUnexpected.js +0 -3
  72. package/dist/esm/isUnexpected.js.map +1 -1
  73. package/dist/esm/models.d.ts +96 -7
  74. package/dist/esm/models.d.ts.map +1 -1
  75. package/dist/esm/models.js.map +1 -1
  76. package/dist/esm/outputModels.d.ts +31 -209
  77. package/dist/esm/outputModels.d.ts.map +1 -1
  78. package/dist/esm/outputModels.js.map +1 -1
  79. package/dist/esm/parameters.d.ts +4 -160
  80. package/dist/esm/parameters.d.ts.map +1 -1
  81. package/dist/esm/parameters.js.map +1 -1
  82. package/dist/esm/responses.d.ts +5 -62
  83. package/dist/esm/responses.d.ts.map +1 -1
  84. package/dist/esm/responses.js.map +1 -1
  85. package/dist/esm/textTranslationClient.d.ts.map +1 -1
  86. package/dist/esm/textTranslationClient.js +3 -3
  87. package/dist/esm/textTranslationClient.js.map +1 -1
  88. package/dist/react-native/clientDefinitions.d.ts +2 -20
  89. package/dist/react-native/clientDefinitions.d.ts.map +1 -1
  90. package/dist/react-native/clientDefinitions.js.map +1 -1
  91. package/dist/react-native/customClient.js +2 -2
  92. package/dist/react-native/customClient.js.map +1 -1
  93. package/dist/react-native/index.d.ts +0 -1
  94. package/dist/react-native/index.d.ts.map +1 -1
  95. package/dist/react-native/index.js +0 -1
  96. package/dist/react-native/index.js.map +1 -1
  97. package/dist/react-native/isUnexpected.d.ts +1 -4
  98. package/dist/react-native/isUnexpected.d.ts.map +1 -1
  99. package/dist/react-native/isUnexpected.js +0 -3
  100. package/dist/react-native/isUnexpected.js.map +1 -1
  101. package/dist/react-native/models.d.ts +96 -7
  102. package/dist/react-native/models.d.ts.map +1 -1
  103. package/dist/react-native/models.js.map +1 -1
  104. package/dist/react-native/outputModels.d.ts +31 -209
  105. package/dist/react-native/outputModels.d.ts.map +1 -1
  106. package/dist/react-native/outputModels.js.map +1 -1
  107. package/dist/react-native/parameters.d.ts +4 -160
  108. package/dist/react-native/parameters.d.ts.map +1 -1
  109. package/dist/react-native/parameters.js.map +1 -1
  110. package/dist/react-native/responses.d.ts +5 -62
  111. package/dist/react-native/responses.d.ts.map +1 -1
  112. package/dist/react-native/responses.js.map +1 -1
  113. package/dist/react-native/textTranslationClient.d.ts.map +1 -1
  114. package/dist/react-native/textTranslationClient.js +3 -3
  115. package/dist/react-native/textTranslationClient.js.map +1 -1
  116. package/package.json +3 -3
  117. package/review/ai-translation-text-node.api.md +66 -334
  118. package/dist/browser/serializeHelper.d.ts +0 -2
  119. package/dist/browser/serializeHelper.d.ts.map +0 -1
  120. package/dist/browser/serializeHelper.js +0 -13
  121. package/dist/browser/serializeHelper.js.map +0 -1
  122. package/dist/commonjs/serializeHelper.d.ts +0 -2
  123. package/dist/commonjs/serializeHelper.d.ts.map +0 -1
  124. package/dist/commonjs/serializeHelper.js +0 -16
  125. package/dist/commonjs/serializeHelper.js.map +0 -1
  126. package/dist/esm/serializeHelper.d.ts +0 -2
  127. package/dist/esm/serializeHelper.d.ts.map +0 -1
  128. package/dist/esm/serializeHelper.js +0 -13
  129. package/dist/esm/serializeHelper.js.map +0 -1
  130. package/dist/react-native/serializeHelper.d.ts +0 -2
  131. package/dist/react-native/serializeHelper.d.ts.map +0 -1
  132. package/dist/react-native/serializeHelper.js +0 -13
  133. package/dist/react-native/serializeHelper.js.map +0 -1
@@ -1,8 +1,5 @@
1
- import type { GetSupportedLanguages200Response, GetSupportedLanguagesDefaultResponse, Translate200Response, TranslateDefaultResponse, Transliterate200Response, TransliterateDefaultResponse, FindSentenceBoundaries200Response, FindSentenceBoundariesDefaultResponse, LookupDictionaryEntries200Response, LookupDictionaryEntriesDefaultResponse, LookupDictionaryExamples200Response, LookupDictionaryExamplesDefaultResponse } from "./responses.js";
1
+ import type { GetSupportedLanguages200Response, GetSupportedLanguagesDefaultResponse, Translate200Response, TranslateDefaultResponse, Transliterate200Response, TransliterateDefaultResponse } from "./responses.js";
2
2
  export declare function isUnexpected(response: GetSupportedLanguages200Response | GetSupportedLanguagesDefaultResponse): response is GetSupportedLanguagesDefaultResponse;
3
3
  export declare function isUnexpected(response: Translate200Response | TranslateDefaultResponse): response is TranslateDefaultResponse;
4
4
  export declare function isUnexpected(response: Transliterate200Response | TransliterateDefaultResponse): response is TransliterateDefaultResponse;
5
- export declare function isUnexpected(response: FindSentenceBoundaries200Response | FindSentenceBoundariesDefaultResponse): response is FindSentenceBoundariesDefaultResponse;
6
- export declare function isUnexpected(response: LookupDictionaryEntries200Response | LookupDictionaryEntriesDefaultResponse): response is LookupDictionaryEntriesDefaultResponse;
7
- export declare function isUnexpected(response: LookupDictionaryExamples200Response | LookupDictionaryExamplesDefaultResponse): response is LookupDictionaryExamplesDefaultResponse;
8
5
  //# sourceMappingURL=isUnexpected.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"isUnexpected.d.ts","sourceRoot":"","sources":["../../src/isUnexpected.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,gCAAgC,EAChC,oCAAoC,EACpC,oBAAoB,EACpB,wBAAwB,EACxB,wBAAwB,EACxB,4BAA4B,EAC5B,iCAAiC,EACjC,qCAAqC,EACrC,kCAAkC,EAClC,sCAAsC,EACtC,mCAAmC,EACnC,uCAAuC,EACxC,MAAM,gBAAgB,CAAC;AAWxB,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,gCAAgC,GAAG,oCAAoC,GAChF,QAAQ,IAAI,oCAAoC,CAAC;AACpD,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,oBAAoB,GAAG,wBAAwB,GACxD,QAAQ,IAAI,wBAAwB,CAAC;AACxC,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,wBAAwB,GAAG,4BAA4B,GAChE,QAAQ,IAAI,4BAA4B,CAAC;AAC5C,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,iCAAiC,GAAG,qCAAqC,GAClF,QAAQ,IAAI,qCAAqC,CAAC;AACrD,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,kCAAkC,GAAG,sCAAsC,GACpF,QAAQ,IAAI,sCAAsC,CAAC;AACtD,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,mCAAmC,GAAG,uCAAuC,GACtF,QAAQ,IAAI,uCAAuC,CAAC"}
1
+ {"version":3,"file":"isUnexpected.d.ts","sourceRoot":"","sources":["../../src/isUnexpected.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,gCAAgC,EAChC,oCAAoC,EACpC,oBAAoB,EACpB,wBAAwB,EACxB,wBAAwB,EACxB,4BAA4B,EAC7B,MAAM,gBAAgB,CAAC;AAQxB,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,gCAAgC,GAAG,oCAAoC,GAChF,QAAQ,IAAI,oCAAoC,CAAC;AACpD,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,oBAAoB,GAAG,wBAAwB,GACxD,QAAQ,IAAI,wBAAwB,CAAC;AACxC,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,wBAAwB,GAAG,4BAA4B,GAChE,QAAQ,IAAI,4BAA4B,CAAC"}
@@ -4,9 +4,6 @@ const responseMap = {
4
4
  "GET /languages": ["200"],
5
5
  "POST /translate": ["200"],
6
6
  "POST /transliterate": ["200"],
7
- "POST /breaksentence": ["200"],
8
- "POST /dictionary/lookup": ["200"],
9
- "POST /dictionary/examples": ["200"],
10
7
  };
11
8
  export function isUnexpected(response) {
12
9
  const lroOriginal = response.headers["x-ms-original-url"];
@@ -1 +1 @@
1
- {"version":3,"file":"isUnexpected.js","sourceRoot":"","sources":["../../src/isUnexpected.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAiBlC,MAAM,WAAW,GAA6B;IAC5C,gBAAgB,EAAE,CAAC,KAAK,CAAC;IACzB,iBAAiB,EAAE,CAAC,KAAK,CAAC;IAC1B,qBAAqB,EAAE,CAAC,KAAK,CAAC;IAC9B,qBAAqB,EAAE,CAAC,KAAK,CAAC;IAC9B,yBAAyB,EAAE,CAAC,KAAK,CAAC;IAClC,2BAA2B,EAAE,CAAC,KAAK,CAAC;CACrC,CAAC;AAoBF,MAAM,UAAU,YAAY,CAC1B,QAY2C;IAQ3C,MAAM,WAAW,GAAG,QAAQ,CAAC,OAAO,CAAC,mBAAmB,CAAC,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AAS,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACtC,OAAO,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;AACjC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type {\n GetSupportedLanguages200Response,\n GetSupportedLanguagesDefaultResponse,\n Translate200Response,\n TranslateDefaultResponse,\n Transliterate200Response,\n TransliterateDefaultResponse,\n FindSentenceBoundaries200Response,\n FindSentenceBoundariesDefaultResponse,\n LookupDictionaryEntries200Response,\n LookupDictionaryEntriesDefaultResponse,\n LookupDictionaryExamples200Response,\n LookupDictionaryExamplesDefaultResponse,\n} from \"./responses.js\";\n\nconst responseMap: Record<string, string[]> = {\n \"GET /languages\": [\"200\"],\n \"POST /translate\": [\"200\"],\n \"POST /transliterate\": [\"200\"],\n \"POST /breaksentence\": [\"200\"],\n \"POST /dictionary/lookup\": [\"200\"],\n \"POST /dictionary/examples\": [\"200\"],\n};\n\nexport function isUnexpected(\n response: GetSupportedLanguages200Response | GetSupportedLanguagesDefaultResponse,\n): response is GetSupportedLanguagesDefaultResponse;\nexport function isUnexpected(\n response: Translate200Response | TranslateDefaultResponse,\n): response is TranslateDefaultResponse;\nexport function isUnexpected(\n response: Transliterate200Response | TransliterateDefaultResponse,\n): response is TransliterateDefaultResponse;\nexport function isUnexpected(\n response: FindSentenceBoundaries200Response | FindSentenceBoundariesDefaultResponse,\n): response is FindSentenceBoundariesDefaultResponse;\nexport function isUnexpected(\n response: LookupDictionaryEntries200Response | LookupDictionaryEntriesDefaultResponse,\n): response is LookupDictionaryEntriesDefaultResponse;\nexport function isUnexpected(\n response: LookupDictionaryExamples200Response | LookupDictionaryExamplesDefaultResponse,\n): response is LookupDictionaryExamplesDefaultResponse;\nexport function isUnexpected(\n response:\n | GetSupportedLanguages200Response\n | GetSupportedLanguagesDefaultResponse\n | Translate200Response\n | TranslateDefaultResponse\n | Transliterate200Response\n | TransliterateDefaultResponse\n | FindSentenceBoundaries200Response\n | FindSentenceBoundariesDefaultResponse\n | LookupDictionaryEntries200Response\n | LookupDictionaryEntriesDefaultResponse\n | LookupDictionaryExamples200Response\n | LookupDictionaryExamplesDefaultResponse,\n): response is\n | GetSupportedLanguagesDefaultResponse\n | TranslateDefaultResponse\n | TransliterateDefaultResponse\n | FindSentenceBoundariesDefaultResponse\n | LookupDictionaryEntriesDefaultResponse\n | LookupDictionaryExamplesDefaultResponse {\n const lroOriginal = response.headers[\"x-ms-original-url\"];\n const url = new URL(lroOriginal ?? response.request.url);\n const method = response.request.method;\n let pathDetails = responseMap[`${method} ${url.pathname}`];\n if (!pathDetails) {\n pathDetails = getParametrizedPathSuccess(method, url.pathname);\n }\n return !pathDetails.includes(response.status);\n}\n\nfunction getParametrizedPathSuccess(method: string, path: string): string[] {\n const pathParts = path.split(\"/\");\n\n // Traverse list to match the longest candidate\n // matchedLen: the length of candidate path\n // matchedValue: the matched status code array\n let matchedLen = -1,\n matchedValue: string[] = [];\n\n // Iterate the responseMap to find a match\n for (const [key, value] of Object.entries(responseMap)) {\n // Extracting the path from the map key which is in format\n // GET /path/foo\n if (!key.startsWith(method)) {\n continue;\n }\n const candidatePath = getPathFromMapKey(key);\n // Get each part of the url path\n const candidateParts = candidatePath.split(\"/\");\n\n // track if we have found a match to return the values found.\n let found = true;\n for (let i = candidateParts.length - 1, j = pathParts.length - 1; i >= 1 && j >= 1; i--, j--) {\n if (candidateParts[i]?.startsWith(\"{\") && candidateParts[i]?.indexOf(\"}\") !== -1) {\n const start = candidateParts[i]!.indexOf(\"}\") + 1,\n end = candidateParts[i]?.length;\n // If the current part of the candidate is a \"template\" part\n // Try to use the suffix of pattern to match the path\n // {guid} ==> $\n // {guid}:export ==> :export$\n const isMatched = new RegExp(`${candidateParts[i]?.slice(start, end)}`).test(\n pathParts[j] || \"\",\n );\n\n if (!isMatched) {\n found = false;\n break;\n }\n continue;\n }\n\n // If the candidate part is not a template and\n // the parts don't match mark the candidate as not found\n // to move on with the next candidate path.\n if (candidateParts[i] !== pathParts[j]) {\n found = false;\n break;\n }\n }\n\n // We finished evaluating the current candidate parts\n // Update the matched value if and only if we found the longer pattern\n if (found && candidatePath.length > matchedLen) {\n matchedLen = candidatePath.length;\n matchedValue = value;\n }\n }\n\n return matchedValue;\n}\n\nfunction getPathFromMapKey(mapKey: string): string {\n const pathStart = mapKey.indexOf(\"/\");\n return mapKey.slice(pathStart);\n}\n"]}
1
+ {"version":3,"file":"isUnexpected.js","sourceRoot":"","sources":["../../src/isUnexpected.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAWlC,MAAM,WAAW,GAA6B;IAC5C,gBAAgB,EAAE,CAAC,KAAK,CAAC;IACzB,iBAAiB,EAAE,CAAC,KAAK,CAAC;IAC1B,qBAAqB,EAAE,CAAC,KAAK,CAAC;CAC/B,CAAC;AAWF,MAAM,UAAU,YAAY,CAC1B,QAMgC;IAKhC,MAAM,WAAW,GAAG,QAAQ,CAAC,OAAO,CAAC,mBAAmB,CAAC,CAAC;IAC1D,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,WAAW,IAAI,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACzD,MAAM,MAAM,GAAG,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC;IACvC,IAAI,WAAW,GAAG,WAAW,CAAC,GAAG,MAAM,IAAI,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC;IAC3D,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,WAAW,GAAG,0BAA0B,CAAC,MAAM,EAAE,GAAG,CAAC,QAAQ,CAAC,CAAC;IACjE,CAAC;IACD,OAAO,CAAC,WAAW,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;AAChD,CAAC;AAED,SAAS,0BAA0B,CAAC,MAAc,EAAE,IAAY;IAC9D,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAElC,+CAA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AC,CAAC,IAAI,CAC1E,SAAS,CAAC,CAAC,CAAC,IAAI,EAAE,CACnB,CAAC;gBAEF,IAAI,CAAC,SAAS,EAAE,CAAC;oBACf,KAAK,GAAG,KAAK,CAAC;oBACd,MAAM;gBACR,CAAC;gBACD,SAAS;YACX,CAAC;YAED,8CAA8C;YAC9C,wDAAwD;YACxD,2CAA2C;YAC3C,IAAI,cAAc,CAAC,CAAC,CAAC,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC;gBACvC,KAAK,GAAG,KAAK,CAAC;gBACd,MAAM;YACR,CAAC;QACH,CAAC;QAED,qDAAqD;QACrD,sEAAsE;QACtE,IAAI,KAAK,IAAI,aAAa,CAAC,MAAM,GAAG,UAAU,EAAE,CAAC;YAC/C,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC;YAClC,YAAY,GAAG,KAAK,CAAC;QACvB,CAAC;IACH,CAAC;IAED,OAAO,YAAY,CAAC;AACtB,CAAC;AAED,SAAS,iBAAiB,CAAC,MAAc;IACvC,MAAM,SAAS,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACtC,OAAO,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;AACjC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type {\n GetSupportedLanguages200Response,\n GetSupportedLanguagesDefaultResponse,\n Translate200Response,\n TranslateDefaultResponse,\n Transliterate200Response,\n TransliterateDefaultResponse,\n} from \"./responses.js\";\n\nconst responseMap: Record<string, string[]> = {\n \"GET /languages\": [\"200\"],\n \"POST /translate\": [\"200\"],\n \"POST /transliterate\": [\"200\"],\n};\n\nexport function isUnexpected(\n response: GetSupportedLanguages200Response | GetSupportedLanguagesDefaultResponse,\n): response is GetSupportedLanguagesDefaultResponse;\nexport function isUnexpected(\n response: Translate200Response | TranslateDefaultResponse,\n): response is TranslateDefaultResponse;\nexport function isUnexpected(\n response: Transliterate200Response | TransliterateDefaultResponse,\n): response is TransliterateDefaultResponse;\nexport function isUnexpected(\n response:\n | GetSupportedLanguages200Response\n | GetSupportedLanguagesDefaultResponse\n | Translate200Response\n | TranslateDefaultResponse\n | Transliterate200Response\n | TransliterateDefaultResponse,\n): response is\n | GetSupportedLanguagesDefaultResponse\n | TranslateDefaultResponse\n | TransliterateDefaultResponse {\n const lroOriginal = response.headers[\"x-ms-original-url\"];\n const url = new URL(lroOriginal ?? response.request.url);\n const method = response.request.method;\n let pathDetails = responseMap[`${method} ${url.pathname}`];\n if (!pathDetails) {\n pathDetails = getParametrizedPathSuccess(method, url.pathname);\n }\n return !pathDetails.includes(response.status);\n}\n\nfunction getParametrizedPathSuccess(method: string, path: string): string[] {\n const pathParts = path.split(\"/\");\n\n // Traverse list to match the longest candidate\n // matchedLen: the length of candidate path\n // matchedValue: the matched status code array\n let matchedLen = -1,\n matchedValue: string[] = [];\n\n // Iterate the responseMap to find a match\n for (const [key, value] of Object.entries(responseMap)) {\n // Extracting the path from the map key which is in format\n // GET /path/foo\n if (!key.startsWith(method)) {\n continue;\n }\n const candidatePath = getPathFromMapKey(key);\n // Get each part of the url path\n const candidateParts = candidatePath.split(\"/\");\n\n // track if we have found a match to return the values found.\n let found = true;\n for (let i = candidateParts.length - 1, j = pathParts.length - 1; i >= 1 && j >= 1; i--, j--) {\n if (candidateParts[i]?.startsWith(\"{\") && candidateParts[i]?.indexOf(\"}\") !== -1) {\n const start = candidateParts[i]!.indexOf(\"}\") + 1,\n end = candidateParts[i]?.length;\n // If the current part of the candidate is a \"template\" part\n // Try to use the suffix of pattern to match the path\n // {guid} ==> $\n // {guid}:export ==> :export$\n const isMatched = new RegExp(`${candidateParts[i]?.slice(start, end)}`).test(\n pathParts[j] || \"\",\n );\n\n if (!isMatched) {\n found = false;\n break;\n }\n continue;\n }\n\n // If the candidate part is not a template and\n // the parts don't match mark the candidate as not found\n // to move on with the next candidate path.\n if (candidateParts[i] !== pathParts[j]) {\n found = false;\n break;\n }\n }\n\n // We finished evaluating the current candidate parts\n // Update the matched value if and only if we found the longer pattern\n if (found && candidatePath.length > matchedLen) {\n matchedLen = candidatePath.length;\n matchedValue = value;\n }\n }\n\n return matchedValue;\n}\n\nfunction getPathFromMapKey(mapKey: string): string {\n const pathStart = mapKey.indexOf(\"/\");\n return mapKey.slice(pathStart);\n}\n"]}
@@ -1,16 +1,105 @@
1
+ /** Request data for translate. */
2
+ export interface TranslateBody {
3
+ /** Array of the input text elements to translate. */
4
+ inputs: Array<TranslateInputItem>;
5
+ }
1
6
  /** Element containing the text for translation. */
2
- export interface InputTextItem {
7
+ export interface TranslateInputItem {
3
8
  /** Text to translate. */
4
9
  text: string;
10
+ /** Specifies the script of the input text. */
11
+ script?: string;
12
+ /**
13
+ * Specifies the language of the input text. Find which languages are available to translate by
14
+ * looking up supported languages using the translation scope. If the language parameter isn't
15
+ * specified, automatic language detection is applied to determine the source language.
16
+ *
17
+ * You must use the language parameter rather than autodetection when using the dynamic dictionary feature.
18
+ * Note: the dynamic dictionary feature is case-sensitive.
19
+ */
20
+ language?: string;
21
+ /**
22
+ * Defines whether the text being translated is plain text or HTML text. Any HTML needs to be a well-formed,
23
+ * complete element. Possible values are: plain (default) or html.
24
+ *
25
+ * Possible values: "Plain", "Html"
26
+ */
27
+ textType?: TextType;
28
+ /** Translation target parameters. */
29
+ targets: Array<TranslationTarget>;
5
30
  }
6
- /** Element containing the text with translation. */
7
- export interface DictionaryExampleTextItem extends InputTextItem {
31
+ /** Target language and translation configuration parameters. */
32
+ export interface TranslationTarget {
8
33
  /**
9
- * A string specifying the translated text previously returned by the Dictionary lookup operation.
10
- * This should be the value from the normalizedTarget field in the translations list of the Dictionary
11
- * lookup response. The service will return examples for the specific source-target word-pair.
34
+ * Specifies the language of the output text. The target language must be one of the supported languages included
35
+ * in the translation scope. It's possible to translate to multiple languages simultaneously by including
36
+ * multiple string values in the targetsLanguage array.
12
37
  */
13
- translation: string;
38
+ language: string;
39
+ /** Specifies the script of the translated text. */
40
+ script?: string;
41
+ /**
42
+ * Specifies how profanities should be treated in translations.
43
+ * Possible values are: NoAction (default), Marked or Deleted.
44
+ */
45
+ profanityAction?: ProfanityAction;
46
+ /**
47
+ * Specifies how profanities should be marked in translations.
48
+ * Possible values are: Asterisk (default) or Tag.
49
+ */
50
+ profanityMarker?: ProfanityMarker;
51
+ /**
52
+ * Default is 'general', which uses NMT system.
53
+ * 'abc-inc-gpt-4o', and 'abc-inc-gpt-4o-mini' are examples of deployment names which use GPT-4o uses or
54
+ * GPT-4o-mini model. 'gpt-4o' uses GPT-4o model.
55
+ *
56
+ * `<custom model id>` uses the custom NMT model tuned by customer.
57
+ * 'best' system determines which is the best model to use for the request. This intelligence could be introduced
58
+ * in future. Customer should have deployed it in their resource.
59
+ *
60
+ */
61
+ deploymentName?: string;
62
+ /**
63
+ * In the case where a custom system is being used, specifies that the service is allowed to fall back to a
64
+ * general system when a custom system doesn't exist.
65
+ * In the case where a Large Language Model is being used, specifies that the service is allowed to fall
66
+ * back to a Small Language Model if an error occurs.
67
+ * Possible values are: true (default) or false.
68
+ *
69
+ * allowFallback=false specifies that the translation should only use systems trained for the category specified
70
+ * by the request. If a translation for language X to language Y requires chaining through a pivot language E,
71
+ * then all the systems in the chain (X → E and E → Y) will need to be custom and have the same category.
72
+ * If no system is found with the specific category, the request will return a 400 status code. allowFallback=true
73
+ * specifies that the service is allowed to fall back to a general system when a custom system doesn't exist.
74
+ */
75
+ allowFallback?: boolean;
76
+ /** Defines complexity of LLM prompts to provide high accuracy translation. */
77
+ grade?: string;
78
+ /** Desired tone of target translation. */
79
+ tone?: string;
80
+ /** Desired gender of target translation. */
81
+ gender?: string;
82
+ /** Reference dataset ID having sentence pair to generate adaptive customized translation. */
83
+ adaptiveDatasetId?: string;
84
+ /** Reference text pairs to generate adaptive customized translation. */
85
+ referenceTextPairs?: Array<ReferenceTextPair>;
86
+ }
87
+ /** Reference text pair to generate adaptive customized translation. */
88
+ export interface ReferenceTextPair {
89
+ /** Source reference sentence. */
90
+ source: string;
91
+ /** Target reference sentence. */
92
+ target: string;
93
+ }
94
+ /** Request data for transliterate. */
95
+ export interface TransliterateBody {
96
+ /** Array of the input text elements to transliterate. */
97
+ inputs: Array<InputTextItem>;
98
+ }
99
+ /** Element containing the text for translation. */
100
+ export interface InputTextItem {
101
+ /** Text to translate. */
102
+ text: string;
14
103
  }
15
104
  /** Alias for TextType */
16
105
  export type TextType = string;
@@ -1 +1 @@
1
- {"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../../src/models.ts"],"names":[],"mappings":"AAGA,mDAAmD;AACnD,MAAM,WAAW,aAAa;IAC5B,yBAAyB;IACzB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,oDAAoD;AACpD,MAAM,WAAW,yBAA0B,SAAQ,aAAa;IAC9D;;;;OAIG;IACH,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,yBAAyB;AACzB,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC;AAC9B,mCAAmC;AACnC,MAAM,MAAM,eAAe,GAAG,UAAU,GAAG,QAAQ,GAAG,SAAS,CAAC;AAChE,mCAAmC;AACnC,MAAM,MAAM,eAAe,GAAG,UAAU,GAAG,KAAK,CAAC"}
1
+ {"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../../src/models.ts"],"names":[],"mappings":"AAGA,kCAAkC;AAClC,MAAM,WAAW,aAAa;IAC5B,qDAAqD;IACrD,MAAM,EAAE,KAAK,CAAC,kBAAkB,CAAC,CAAC;CACnC;AAED,mDAAmD;AACnD,MAAM,WAAW,kBAAkB;IACjC,yBAAyB;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,8CAA8C;IAC9C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;;;;OAOG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,qCAAqC;IACrC,OAAO,EAAE,KAAK,CAAC,iBAAiB,CAAC,CAAC;CACnC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../../src/models.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/** Element containing the text for translation. */\nexport interface InputTextItem {\n /** Text to translate. */\n text: string;\n}\n\n/** Element containing the text with translation. */\nexport interface DictionaryExampleTextItem extends InputTextItem {\n /**\n * A string specifying the translated text previously returned by the Dictionary lookup operation.\n * This should be the value from the normalizedTarget field in the translations list of the Dictionary\n * lookup response. The service will return examples for the specific source-target word-pair.\n */\n translation: string;\n}\n\n/** Alias for TextType */\nexport type TextType = string;\n/** Translator profanity actions */\nexport type ProfanityAction = \"NoAction\" | \"Marked\" | \"Deleted\";\n/** Translator profanity markers */\nexport type ProfanityMarker = \"Asterisk\" | \"Tag\";\n"]}
1
+ {"version":3,"file":"models.js","sourceRoot":"","sources":["../../src/models.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/** Request data for translate. */\nexport interface TranslateBody {\n /** Array of the input text elements to translate. */\n inputs: Array<TranslateInputItem>;\n}\n\n/** Element containing the text for translation. */\nexport interface TranslateInputItem {\n /** Text to translate. */\n text: string;\n /** Specifies the script of the input text. */\n script?: string;\n /**\n * Specifies the language of the input text. Find which languages are available to translate by\n * looking up supported languages using the translation scope. If the language parameter isn't\n * specified, automatic language detection is applied to determine the source language.\n *\n * You must use the language parameter rather than autodetection when using the dynamic dictionary feature.\n * Note: the dynamic dictionary feature is case-sensitive.\n */\n language?: string;\n /**\n * Defines whether the text being translated is plain text or HTML text. Any HTML needs to be a well-formed,\n * complete element. Possible values are: plain (default) or html.\n *\n * Possible values: \"Plain\", \"Html\"\n */\n textType?: TextType;\n /** Translation target parameters. */\n targets: Array<TranslationTarget>;\n}\n\n/** Target language and translation configuration parameters. */\nexport interface TranslationTarget {\n /**\n * Specifies the language of the output text. The target language must be one of the supported languages included\n * in the translation scope. It's possible to translate to multiple languages simultaneously by including\n * multiple string values in the targetsLanguage array.\n */\n language: string;\n /** Specifies the script of the translated text. */\n script?: string;\n /**\n * Specifies how profanities should be treated in translations.\n * Possible values are: NoAction (default), Marked or Deleted.\n */\n profanityAction?: ProfanityAction;\n /**\n * Specifies how profanities should be marked in translations.\n * Possible values are: Asterisk (default) or Tag.\n */\n profanityMarker?: ProfanityMarker;\n /**\n * Default is 'general', which uses NMT system.\n * 'abc-inc-gpt-4o', and 'abc-inc-gpt-4o-mini' are examples of deployment names which use GPT-4o uses or\n * GPT-4o-mini model. 'gpt-4o' uses GPT-4o model.\n *\n * `<custom model id>` uses the custom NMT model tuned by customer.\n * 'best' system determines which is the best model to use for the request. This intelligence could be introduced\n * in future. Customer should have deployed it in their resource.\n *\n */\n deploymentName?: string;\n /**\n * In the case where a custom system is being used, specifies that the service is allowed to fall back to a\n * general system when a custom system doesn't exist.\n * In the case where a Large Language Model is being used, specifies that the service is allowed to fall\n * back to a Small Language Model if an error occurs.\n * Possible values are: true (default) or false.\n *\n * allowFallback=false specifies that the translation should only use systems trained for the category specified\n * by the request. If a translation for language X to language Y requires chaining through a pivot language E,\n * then all the systems in the chain (X → E and E → Y) will need to be custom and have the same category.\n * If no system is found with the specific category, the request will return a 400 status code. allowFallback=true\n * specifies that the service is allowed to fall back to a general system when a custom system doesn't exist.\n */\n allowFallback?: boolean;\n /** Defines complexity of LLM prompts to provide high accuracy translation. */\n grade?: string;\n /** Desired tone of target translation. */\n tone?: string;\n /** Desired gender of target translation. */\n gender?: string;\n /** Reference dataset ID having sentence pair to generate adaptive customized translation. */\n adaptiveDatasetId?: string;\n /** Reference text pairs to generate adaptive customized translation. */\n referenceTextPairs?: Array<ReferenceTextPair>;\n}\n\n/** Reference text pair to generate adaptive customized translation. */\nexport interface ReferenceTextPair {\n /** Source reference sentence. */\n source: string;\n /** Target reference sentence. */\n target: string;\n}\n\n/** Request data for transliterate. */\nexport interface TransliterateBody {\n /** Array of the input text elements to transliterate. */\n inputs: Array<InputTextItem>;\n}\n\n/** Element containing the text for translation. */\nexport interface InputTextItem {\n /** Text to translate. */\n text: string;\n}\n\n/** Alias for TextType */\nexport type TextType = string;\n/** Translator profanity actions */\nexport type ProfanityAction = \"NoAction\" | \"Marked\" | \"Deleted\";\n/** Translator profanity markers */\nexport type ProfanityMarker = \"Asterisk\" | \"Tag\";\n"]}
@@ -1,11 +1,11 @@
1
1
  /** Response for the languages API. */
2
2
  export interface GetSupportedLanguagesResultOutput {
3
3
  /** Languages that support translate API. */
4
- translation?: Record<string, TranslationLanguageOutput>;
4
+ readonly translation?: Record<string, TranslationLanguageOutput>;
5
5
  /** Languages that support transliteration API. */
6
- transliteration?: Record<string, TransliterationLanguageOutput>;
7
- /** Languages that support dictionary API. */
8
- dictionary?: Record<string, SourceDictionaryLanguageOutput>;
6
+ readonly transliteration?: Record<string, TransliterationLanguageOutput>;
7
+ /** LLM models supported. */
8
+ readonly models?: string[];
9
9
  }
10
10
  /**
11
11
  * The value of the translation property is a dictionary of (key, value) pairs. Each key is a BCP 47 language tag.
@@ -18,6 +18,8 @@ export interface TranslationLanguageOutput {
18
18
  nativeName: string;
19
19
  /** Directionality, which is rtl for right-to-left languages or ltr for left-to-right languages. */
20
20
  dir: LanguageDirectionalityOutput;
21
+ /** LLM models supported for translation. */
22
+ readonly models: string[];
21
23
  }
22
24
  /**
23
25
  * The value of the transliteration property is a dictionary of (key, value) pairs.
@@ -30,7 +32,7 @@ export interface TransliterationLanguageOutput {
30
32
  /** Display name of the language in the locale native for this language. */
31
33
  nativeName: string;
32
34
  /** List of scripts to convert from. */
33
- scripts: Array<TransliterableScriptOutput>;
35
+ readonly scripts: Array<TransliterableScriptOutput>;
34
36
  }
35
37
  /** Script definition with list of script into which given script can be translitered. */
36
38
  export interface TransliterableScriptOutput extends LanguageScriptOutput {
@@ -48,28 +50,6 @@ export interface LanguageScriptOutput {
48
50
  /** Directionality, which is rtl for right-to-left languages or ltr for left-to-right languages. */
49
51
  dir: LanguageDirectionalityOutput;
50
52
  }
51
- /** Properties ot the source dictionary language */
52
- export interface SourceDictionaryLanguageOutput {
53
- /** Display name of the language in the locale requested via Accept-Language header. */
54
- name: string;
55
- /** Display name of the language in the locale native for this language. */
56
- nativeName: string;
57
- /** Directionality, which is rtl for right-to-left languages or ltr for left-to-right languages. */
58
- dir: LanguageDirectionalityOutput;
59
- /** List of languages with alterative translations and examples for the query expressed in the source language. */
60
- translations: Array<TargetDictionaryLanguageOutput>;
61
- }
62
- /** Properties of the target dictionary language */
63
- export interface TargetDictionaryLanguageOutput {
64
- /** Display name of the language in the locale requested via Accept-Language header. */
65
- name: string;
66
- /** Display name of the language in the locale native for this language. */
67
- nativeName: string;
68
- /** Directionality, which is rtl for right-to-left languages or ltr for left-to-right languages. */
69
- dir: LanguageDirectionalityOutput;
70
- /** Language code identifying the target language. */
71
- code: string;
72
- }
73
53
  /** Representation of the Error Response from Translator Service. */
74
54
  export interface ErrorResponseOutput {
75
55
  /** Error details. */
@@ -77,11 +57,16 @@ export interface ErrorResponseOutput {
77
57
  }
78
58
  /** Error details as returned by Translator Service. */
79
59
  export interface ErrorDetailsOutput {
80
- /** Number identifier of the error. */
81
- code: number;
60
+ /** String identifier of the error. */
61
+ code: string;
82
62
  /** Human readable error description. */
83
63
  message: string;
84
64
  }
65
+ /** Response for the translation API. */
66
+ export interface TranslationResultOutput {
67
+ /** Array of the translated text elements. */
68
+ readonly value: Array<TranslatedTextItemOutput>;
69
+ }
85
70
  /** Element containing the translated text */
86
71
  export interface TranslatedTextItemOutput {
87
72
  /** The detectedLanguage property is only present in the result object when language auto-detection is requested. */
@@ -90,14 +75,7 @@ export interface TranslatedTextItemOutput {
90
75
  * An array of translation results. The size of the array matches the number of target
91
76
  * languages specified through the to query parameter.
92
77
  */
93
- translations: Array<TranslationTextOutput>;
94
- /**
95
- * Input text in the default script of the source language. sourceText property is present only when
96
- * the input is expressed in a script that's not the usual script for the language. For example,
97
- * if the input were Arabic written in Latin script, then sourceText.text would be the same Arabic text
98
- * converted into Arab script.
99
- */
100
- sourceText?: SourceTextOutput;
78
+ readonly translations: Array<TranslationTextOutput>;
101
79
  }
102
80
  /** An object describing the detected language. */
103
81
  export interface DetectedLanguageOutput {
@@ -112,15 +90,24 @@ export interface DetectedLanguageOutput {
112
90
  /** Translation result */
113
91
  export interface TranslationTextOutput {
114
92
  /** A string representing the language code of the target language. */
115
- to: string;
93
+ language: string;
94
+ /** An integer indicating the number of characters in the source text string */
95
+ sourceCharacters?: number;
96
+ /** An integer indicating the number of tokens used in generating the translated text */
97
+ instructionTokens?: number;
98
+ /** An integer indicating the number of tokens used in the source sentence */
99
+ sourceTokens?: number;
100
+ /** An integer indicating the number of tokens used in the translation response */
101
+ responseTokens?: number;
102
+ /** An integer indicating the number of tokens used in the target sentence */
103
+ targetTokens?: number;
116
104
  /** A string giving the translated text. */
117
105
  text: string;
118
- /** An object giving the translated text in the script specified by the toScript parameter. */
119
- transliteration?: TransliteratedTextOutput;
120
- /** Alignment information. */
121
- alignment?: TranslatedTextAlignmentOutput;
122
- /** Sentence boundaries in the input and output texts. */
123
- sentLen?: SentenceBoundariesOutput;
106
+ }
107
+ /** Response for the transliteration API. */
108
+ export interface TransliterateResultOutput {
109
+ /** Array of transliterated texts */
110
+ readonly value: Array<TransliteratedTextOutput>;
124
111
  }
125
112
  /** Transliterated text element. */
126
113
  export interface TransliteratedTextOutput {
@@ -129,171 +116,6 @@ export interface TransliteratedTextOutput {
129
116
  /** A string specifying the script used in the output. */
130
117
  script: string;
131
118
  }
132
- /** Alignment information object. */
133
- export interface TranslatedTextAlignmentOutput {
134
- /**
135
- * Maps input text to translated text. The alignment information is only provided when the request
136
- * parameter includeAlignment is true. Alignment is returned as a string value of the following
137
- * format: [[SourceTextStartIndex]:[SourceTextEndIndex]–[TgtTextStartIndex]:[TgtTextEndIndex]].
138
- * The colon separates start and end index, the dash separates the languages, and space separates the words.
139
- * One word may align with zero, one, or multiple words in the other language, and the aligned words may
140
- * be non-contiguous. When no alignment information is available, the alignment element will be empty.
141
- */
142
- proj: string;
143
- }
144
- /** An object returning sentence boundaries in the input and output texts. */
145
- export interface SentenceBoundariesOutput {
146
- /**
147
- * An integer array representing the lengths of the sentences in the input text.
148
- * The length of the array is the number of sentences, and the values are the length of each sentence.
149
- */
150
- srcSentLen: number[];
151
- /**
152
- * An integer array representing the lengths of the sentences in the translated text.
153
- * The length of the array is the number of sentences, and the values are the length of each sentence.
154
- */
155
- transSentLen: number[];
156
- }
157
- /** Input text in the default script of the source language. */
158
- export interface SourceTextOutput {
159
- /** Input text in the default script of the source language. */
160
- text: string;
161
- }
162
- /** Item containing break sentence result. */
163
- export interface BreakSentenceItemOutput {
164
- /** The detectedLanguage property is only present in the result object when language auto-detection is requested. */
165
- detectedLanguage?: DetectedLanguageOutput;
166
- /**
167
- * An integer array representing the lengths of the sentences in the input text.
168
- * The length of the array is the number of sentences, and the values are the length of each sentence.
169
- */
170
- sentLen: number[];
171
- }
172
- /** Dictionary Lookup Element */
173
- export interface DictionaryLookupItemOutput {
174
- /**
175
- * A string giving the normalized form of the source term.
176
- * For example, if the request is "JOHN", the normalized form will be "john".
177
- * The content of this field becomes the input to lookup examples.
178
- */
179
- normalizedSource: string;
180
- /**
181
- * A string giving the source term in a form best suited for end-user display.
182
- * For example, if the input is "JOHN", the display form will reflect the usual
183
- * spelling of the name: "John".
184
- */
185
- displaySource: string;
186
- /** A list of translations for the source term. */
187
- translations: Array<DictionaryTranslationOutput>;
188
- }
189
- /** Translation source term. */
190
- export interface DictionaryTranslationOutput {
191
- /**
192
- * A string giving the normalized form of this term in the target language.
193
- * This value should be used as input to lookup examples.
194
- */
195
- normalizedTarget: string;
196
- /**
197
- * A string giving the term in the target language and in a form best suited
198
- * for end-user display. Generally, this will only differ from the normalizedTarget
199
- * in terms of capitalization. For example, a proper noun like "Juan" will have
200
- * normalizedTarget = "juan" and displayTarget = "Juan".
201
- */
202
- displayTarget: string;
203
- /** A string associating this term with a part-of-speech tag. */
204
- posTag: string;
205
- /**
206
- * A value between 0.0 and 1.0 which represents the "confidence"
207
- * (or perhaps more accurately, "probability in the training data") of that translation pair.
208
- * The sum of confidence scores for one source word may or may not sum to 1.0.
209
- */
210
- confidence: number;
211
- /**
212
- * A string giving the word to display as a prefix of the translation. Currently,
213
- * this is the gendered determiner of nouns, in languages that have gendered determiners.
214
- * For example, the prefix of the Spanish word "mosca" is "la", since "mosca" is a feminine noun in Spanish.
215
- * This is only dependent on the translation, and not on the source.
216
- * If there is no prefix, it will be the empty string.
217
- */
218
- prefixWord: string;
219
- /**
220
- * A list of "back translations" of the target. For example, source words that the target can translate to.
221
- * The list is guaranteed to contain the source word that was requested (e.g., if the source word being
222
- * looked up is "fly", then it is guaranteed that "fly" will be in the backTranslations list).
223
- * However, it is not guaranteed to be in the first position, and often will not be.
224
- */
225
- backTranslations: Array<BackTranslationOutput>;
226
- }
227
- /** Back Translation */
228
- export interface BackTranslationOutput {
229
- /**
230
- * A string giving the normalized form of the source term that is a back-translation of the target.
231
- * This value should be used as input to lookup examples.
232
- */
233
- normalizedText: string;
234
- /**
235
- * A string giving the source term that is a back-translation of the target in a form best
236
- * suited for end-user display.
237
- */
238
- displayText: string;
239
- /**
240
- * An integer representing the number of examples that are available for this translation pair.
241
- * Actual examples must be retrieved with a separate call to lookup examples. The number is mostly
242
- * intended to facilitate display in a UX. For example, a user interface may add a hyperlink
243
- * to the back-translation if the number of examples is greater than zero and show the back-translation
244
- * as plain text if there are no examples. Note that the actual number of examples returned
245
- * by a call to lookup examples may be less than numExamples, because additional filtering may be
246
- * applied on the fly to remove "bad" examples.
247
- */
248
- numExamples: number;
249
- /**
250
- * An integer representing the frequency of this translation pair in the data. The main purpose of this
251
- * field is to provide a user interface with a means to sort back-translations so the most frequent terms are first.
252
- */
253
- frequencyCount: number;
254
- }
255
- /** Dictionary Example element */
256
- export interface DictionaryExampleItemOutput {
257
- /**
258
- * A string giving the normalized form of the source term. Generally, this should be identical
259
- * to the value of the Text field at the matching list index in the body of the request.
260
- */
261
- normalizedSource: string;
262
- /**
263
- * A string giving the normalized form of the target term. Generally, this should be identical
264
- * to the value of the Translation field at the matching list index in the body of the request.
265
- */
266
- normalizedTarget: string;
267
- /** A list of examples for the (source term, target term) pair. */
268
- examples: Array<DictionaryExampleOutput>;
269
- }
270
- /** Dictionary Example */
271
- export interface DictionaryExampleOutput {
272
- /**
273
- * The string to concatenate before the value of sourceTerm to form a complete example.
274
- * Do not add a space character, since it is already there when it should be.
275
- * This value may be an empty string.
276
- */
277
- sourcePrefix: string;
278
- /**
279
- * A string equal to the actual term looked up. The string is added with sourcePrefix
280
- * and sourceSuffix to form the complete example. Its value is separated so it can be
281
- * marked in a user interface, e.g., by bolding it.
282
- */
283
- sourceTerm: string;
284
- /**
285
- * The string to concatenate after the value of sourceTerm to form a complete example.
286
- * Do not add a space character, since it is already there when it should be.
287
- * This value may be an empty string.
288
- */
289
- sourceSuffix: string;
290
- /** A string similar to sourcePrefix but for the target. */
291
- targetPrefix: string;
292
- /** A string similar to sourceTerm but for the target. */
293
- targetTerm: string;
294
- /** A string similar to sourceSuffix but for the target. */
295
- targetSuffix: string;
296
- }
297
119
  /** Language Directionality */
298
120
  export type LanguageDirectionalityOutput = "ltr" | "rtl";
299
121
  //# sourceMappingURL=outputModels.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"outputModels.d.ts","sourceRoot":"","sources":["../../src/outputModels.ts"],"names":[],"mappings":"AAGA,sCAAsC;AACtC,MAAM,WAAW,iCAAiC;IAChD,4CAA4C;IAC5C,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,yBAAyB,CAAC,CAAC;IACxD,kDAAkD;IAClD,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,6BAA6B,CAAC,CAAC;IAChE,6CAA6C;IAC7C,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,8BAA8B,CAAC,CAAC;CAC7D;AAED;;;GAGG;AACH,MAAM,WAAW,yBAAyB;IACxC,uF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F,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,6EAA6E;IAC7E,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,2CAA2C;IAC3C,IAAI,EAAE,MAAM,CAAC;CACd;AAED,4CAA4C;AAC5C,MAAM,WAAW,yBAAyB;IACxC,oCAAoC;IACpC,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC,wBAAwB,CAAC,CAAC;CACjD;AAED,mCAAmC;AACnC,MAAM,WAAW,wBAAwB;IACvC,wFAAwF;IACxF,IAAI,EAAE,MAAM,CAAC;IACb,yDAAyD;IACzD,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,8BAA8B;AAC9B,MAAM,MAAM,4BAA4B,GAAG,KAAK,GAAG,KAAK,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"outputModels.js","sourceRoot":"","sources":["../../src/outputModels.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/** Response for the languages API. */\nexport interface GetSupportedLanguagesResultOutput {\n /** Languages that support translate API. */\n translation?: Record<string, TranslationLanguageOutput>;\n /** Languages that support transliteration API. */\n transliteration?: Record<string, TransliterationLanguageOutput>;\n /** Languages that support dictionary API. */\n dictionary?: Record<string, SourceDictionaryLanguageOutput>;\n}\n\n/**\n * The value of the translation property is a dictionary of (key, value) pairs. Each key is a BCP 47 language tag.\n * A key identifies a language for which text can be translated to or translated from.\n */\nexport interface TranslationLanguageOutput {\n /** Display name of the language in the locale requested via Accept-Language header. */\n name: string;\n /** Display name of the language in the locale native for this language. */\n nativeName: string;\n /** Directionality, which is rtl for right-to-left languages or ltr for left-to-right languages. */\n dir: LanguageDirectionalityOutput;\n}\n\n/**\n * The value of the transliteration property is a dictionary of (key, value) pairs.\n * Each key is a BCP 47 language tag. A key identifies a language for which text can be converted from one script\n * to another script.\n */\nexport interface TransliterationLanguageOutput {\n /** Display name of the language in the locale requested via Accept-Language header. */\n name: string;\n /** Display name of the language in the locale native for this language. */\n nativeName: string;\n /** List of scripts to convert from. */\n scripts: Array<TransliterableScriptOutput>;\n}\n\n/** Script definition with list of script into which given script can be translitered. */\nexport interface TransliterableScriptOutput extends LanguageScriptOutput {\n /** List of scripts available to convert text to. */\n toScripts: Array<LanguageScriptOutput>;\n}\n\n/** Common properties of language script */\nexport interface LanguageScriptOutput {\n /** Code identifying the script. */\n code: string;\n /** Display name of the script in the locale requested via Accept-Language header. */\n name: string;\n /** Display name of the language in the locale native for the language. */\n nativeName: string;\n /** Directionality, which is rtl for right-to-left languages or ltr for left-to-right languages. */\n dir: LanguageDirectionalityOutput;\n}\n\n/** Properties ot the source dictionary language */\nexport interface SourceDictionaryLanguageOutput {\n /** Display name of the language in the locale requested via Accept-Language header. */\n name: string;\n /** Display name of the language in the locale native for this language. */\n nativeName: string;\n /** Directionality, which is rtl for right-to-left languages or ltr for left-to-right languages. */\n dir: LanguageDirectionalityOutput;\n /** List of languages with alterative translations and examples for the query expressed in the source language. */\n translations: Array<TargetDictionaryLanguageOutput>;\n}\n\n/** Properties of the target dictionary language */\nexport interface TargetDictionaryLanguageOutput {\n /** Display name of the language in the locale requested via Accept-Language header. */\n name: string;\n /** Display name of the language in the locale native for this language. */\n nativeName: string;\n /** Directionality, which is rtl for right-to-left languages or ltr for left-to-right languages. */\n dir: LanguageDirectionalityOutput;\n /** Language code identifying the target language. */\n code: string;\n}\n\n/** Representation of the Error Response from Translator Service. */\nexport interface ErrorResponseOutput {\n /** Error details. */\n error: ErrorDetailsOutput;\n}\n\n/** Error details as returned by Translator Service. */\nexport interface ErrorDetailsOutput {\n /** Number identifier of the error. */\n code: number;\n /** Human readable error description. */\n message: string;\n}\n\n/** Element containing the translated text */\nexport interface TranslatedTextItemOutput {\n /** The detectedLanguage property is only present in the result object when language auto-detection is requested. */\n detectedLanguage?: DetectedLanguageOutput;\n /**\n * An array of translation results. The size of the array matches the number of target\n * languages specified through the to query parameter.\n */\n translations: Array<TranslationTextOutput>;\n /**\n * Input text in the default script of the source language. sourceText property is present only when\n * the input is expressed in a script that's not the usual script for the language. For example,\n * if the input were Arabic written in Latin script, then sourceText.text would be the same Arabic text\n * converted into Arab script.\n */\n sourceText?: SourceTextOutput;\n}\n\n/** An object describing the detected language. */\nexport interface DetectedLanguageOutput {\n /** A string representing the code of the detected language. */\n language: string;\n /**\n * A float value indicating the confidence in the result.\n * The score is between zero and one and a low score indicates a low confidence.\n */\n score: number;\n}\n\n/** Translation result */\nexport interface TranslationTextOutput {\n /** A string representing the language code of the target language. */\n to: string;\n /** A string giving the translated text. */\n text: string;\n /** An object giving the translated text in the script specified by the toScript parameter. */\n transliteration?: TransliteratedTextOutput;\n /** Alignment information. */\n alignment?: TranslatedTextAlignmentOutput;\n /** Sentence boundaries in the input and output texts. */\n sentLen?: SentenceBoundariesOutput;\n}\n\n/** Transliterated text element. */\nexport interface TransliteratedTextOutput {\n /** A string which is the result of converting the input string to the output script. */\n text: string;\n /** A string specifying the script used in the output. */\n script: string;\n}\n\n/** Alignment information object. */\nexport interface TranslatedTextAlignmentOutput {\n /**\n * Maps input text to translated text. The alignment information is only provided when the request\n * parameter includeAlignment is true. Alignment is returned as a string value of the following\n * format: [[SourceTextStartIndex]:[SourceTextEndIndex]–[TgtTextStartIndex]:[TgtTextEndIndex]].\n * The colon separates start and end index, the dash separates the languages, and space separates the words.\n * One word may align with zero, one, or multiple words in the other language, and the aligned words may\n * be non-contiguous. When no alignment information is available, the alignment element will be empty.\n */\n proj: string;\n}\n\n/** An object returning sentence boundaries in the input and output texts. */\nexport interface SentenceBoundariesOutput {\n /**\n * An integer array representing the lengths of the sentences in the input text.\n * The length of the array is the number of sentences, and the values are the length of each sentence.\n */\n srcSentLen: number[];\n /**\n * An integer array representing the lengths of the sentences in the translated text.\n * The length of the array is the number of sentences, and the values are the length of each sentence.\n */\n transSentLen: number[];\n}\n\n/** Input text in the default script of the source language. */\nexport interface SourceTextOutput {\n /** Input text in the default script of the source language. */\n text: string;\n}\n\n/** Item containing break sentence result. */\nexport interface BreakSentenceItemOutput {\n /** The detectedLanguage property is only present in the result object when language auto-detection is requested. */\n detectedLanguage?: DetectedLanguageOutput;\n /**\n * An integer array representing the lengths of the sentences in the input text.\n * The length of the array is the number of sentences, and the values are the length of each sentence.\n */\n sentLen: number[];\n}\n\n/** Dictionary Lookup Element */\nexport interface DictionaryLookupItemOutput {\n /**\n * A string giving the normalized form of the source term.\n * For example, if the request is \"JOHN\", the normalized form will be \"john\".\n * The content of this field becomes the input to lookup examples.\n */\n normalizedSource: string;\n /**\n * A string giving the source term in a form best suited for end-user display.\n * For example, if the input is \"JOHN\", the display form will reflect the usual\n * spelling of the name: \"John\".\n */\n displaySource: string;\n /** A list of translations for the source term. */\n translations: Array<DictionaryTranslationOutput>;\n}\n\n/** Translation source term. */\nexport interface DictionaryTranslationOutput {\n /**\n * A string giving the normalized form of this term in the target language.\n * This value should be used as input to lookup examples.\n */\n normalizedTarget: string;\n /**\n * A string giving the term in the target language and in a form best suited\n * for end-user display. Generally, this will only differ from the normalizedTarget\n * in terms of capitalization. For example, a proper noun like \"Juan\" will have\n * normalizedTarget = \"juan\" and displayTarget = \"Juan\".\n */\n displayTarget: string;\n /** A string associating this term with a part-of-speech tag. */\n posTag: string;\n /**\n * A value between 0.0 and 1.0 which represents the \"confidence\"\n * (or perhaps more accurately, \"probability in the training data\") of that translation pair.\n * The sum of confidence scores for one source word may or may not sum to 1.0.\n */\n confidence: number;\n /**\n * A string giving the word to display as a prefix of the translation. Currently,\n * this is the gendered determiner of nouns, in languages that have gendered determiners.\n * For example, the prefix of the Spanish word \"mosca\" is \"la\", since \"mosca\" is a feminine noun in Spanish.\n * This is only dependent on the translation, and not on the source.\n * If there is no prefix, it will be the empty string.\n */\n prefixWord: string;\n /**\n * A list of \"back translations\" of the target. For example, source words that the target can translate to.\n * The list is guaranteed to contain the source word that was requested (e.g., if the source word being\n * looked up is \"fly\", then it is guaranteed that \"fly\" will be in the backTranslations list).\n * However, it is not guaranteed to be in the first position, and often will not be.\n */\n backTranslations: Array<BackTranslationOutput>;\n}\n\n/** Back Translation */\nexport interface BackTranslationOutput {\n /**\n * A string giving the normalized form of the source term that is a back-translation of the target.\n * This value should be used as input to lookup examples.\n */\n normalizedText: string;\n /**\n * A string giving the source term that is a back-translation of the target in a form best\n * suited for end-user display.\n */\n displayText: string;\n /**\n * An integer representing the number of examples that are available for this translation pair.\n * Actual examples must be retrieved with a separate call to lookup examples. The number is mostly\n * intended to facilitate display in a UX. For example, a user interface may add a hyperlink\n * to the back-translation if the number of examples is greater than zero and show the back-translation\n * as plain text if there are no examples. Note that the actual number of examples returned\n * by a call to lookup examples may be less than numExamples, because additional filtering may be\n * applied on the fly to remove \"bad\" examples.\n */\n numExamples: number;\n /**\n * An integer representing the frequency of this translation pair in the data. The main purpose of this\n * field is to provide a user interface with a means to sort back-translations so the most frequent terms are first.\n */\n frequencyCount: number;\n}\n\n/** Dictionary Example element */\nexport interface DictionaryExampleItemOutput {\n /**\n * A string giving the normalized form of the source term. Generally, this should be identical\n * to the value of the Text field at the matching list index in the body of the request.\n */\n normalizedSource: string;\n /**\n * A string giving the normalized form of the target term. Generally, this should be identical\n * to the value of the Translation field at the matching list index in the body of the request.\n */\n normalizedTarget: string;\n /** A list of examples for the (source term, target term) pair. */\n examples: Array<DictionaryExampleOutput>;\n}\n\n/** Dictionary Example */\nexport interface DictionaryExampleOutput {\n /**\n * The string to concatenate before the value of sourceTerm to form a complete example.\n * Do not add a space character, since it is already there when it should be.\n * This value may be an empty string.\n */\n sourcePrefix: string;\n /**\n * A string equal to the actual term looked up. The string is added with sourcePrefix\n * and sourceSuffix to form the complete example. Its value is separated so it can be\n * marked in a user interface, e.g., by bolding it.\n */\n sourceTerm: string;\n /**\n * The string to concatenate after the value of sourceTerm to form a complete example.\n * Do not add a space character, since it is already there when it should be.\n * This value may be an empty string.\n */\n sourceSuffix: string;\n /** A string similar to sourcePrefix but for the target. */\n targetPrefix: string;\n /** A string similar to sourceTerm but for the target. */\n targetTerm: string;\n /** A string similar to sourceSuffix but for the target. */\n targetSuffix: string;\n}\n\n/** Language Directionality */\nexport type LanguageDirectionalityOutput = \"ltr\" | \"rtl\";\n"]}
1
+ {"version":3,"file":"outputModels.js","sourceRoot":"","sources":["../../src/outputModels.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/** Response for the languages API. */\nexport interface GetSupportedLanguagesResultOutput {\n /** Languages that support translate API. */\n readonly translation?: Record<string, TranslationLanguageOutput>;\n /** Languages that support transliteration API. */\n readonly transliteration?: Record<string, TransliterationLanguageOutput>;\n /** LLM models supported. */\n readonly models?: string[];\n}\n\n/**\n * The value of the translation property is a dictionary of (key, value) pairs. Each key is a BCP 47 language tag.\n * A key identifies a language for which text can be translated to or translated from.\n */\nexport interface TranslationLanguageOutput {\n /** Display name of the language in the locale requested via Accept-Language header. */\n name: string;\n /** Display name of the language in the locale native for this language. */\n nativeName: string;\n /** Directionality, which is rtl for right-to-left languages or ltr for left-to-right languages. */\n dir: LanguageDirectionalityOutput;\n /** LLM models supported for translation. */\n readonly models: string[];\n}\n\n/**\n * The value of the transliteration property is a dictionary of (key, value) pairs.\n * Each key is a BCP 47 language tag. A key identifies a language for which text can be converted from one script\n * to another script.\n */\nexport interface TransliterationLanguageOutput {\n /** Display name of the language in the locale requested via Accept-Language header. */\n name: string;\n /** Display name of the language in the locale native for this language. */\n nativeName: string;\n /** List of scripts to convert from. */\n readonly scripts: Array<TransliterableScriptOutput>;\n}\n\n/** Script definition with list of script into which given script can be translitered. */\nexport interface TransliterableScriptOutput extends LanguageScriptOutput {\n /** List of scripts available to convert text to. */\n toScripts: Array<LanguageScriptOutput>;\n}\n\n/** Common properties of language script */\nexport interface LanguageScriptOutput {\n /** Code identifying the script. */\n code: string;\n /** Display name of the script in the locale requested via Accept-Language header. */\n name: string;\n /** Display name of the language in the locale native for the language. */\n nativeName: string;\n /** Directionality, which is rtl for right-to-left languages or ltr for left-to-right languages. */\n dir: LanguageDirectionalityOutput;\n}\n\n/** Representation of the Error Response from Translator Service. */\nexport interface ErrorResponseOutput {\n /** Error details. */\n error: ErrorDetailsOutput;\n}\n\n/** Error details as returned by Translator Service. */\nexport interface ErrorDetailsOutput {\n /** String identifier of the error. */\n code: string;\n /** Human readable error description. */\n message: string;\n}\n\n/** Response for the translation API. */\nexport interface TranslationResultOutput {\n /** Array of the translated text elements. */\n readonly value: Array<TranslatedTextItemOutput>;\n}\n\n/** Element containing the translated text */\nexport interface TranslatedTextItemOutput {\n /** The detectedLanguage property is only present in the result object when language auto-detection is requested. */\n detectedLanguage?: DetectedLanguageOutput;\n /**\n * An array of translation results. The size of the array matches the number of target\n * languages specified through the to query parameter.\n */\n readonly translations: Array<TranslationTextOutput>;\n}\n\n/** An object describing the detected language. */\nexport interface DetectedLanguageOutput {\n /** A string representing the code of the detected language. */\n language: string;\n /**\n * A float value indicating the confidence in the result.\n * The score is between zero and one and a low score indicates a low confidence.\n */\n score: number;\n}\n\n/** Translation result */\nexport interface TranslationTextOutput {\n /** A string representing the language code of the target language. */\n language: string;\n /** An integer indicating the number of characters in the source text string */\n sourceCharacters?: number;\n /** An integer indicating the number of tokens used in generating the translated text */\n instructionTokens?: number;\n /** An integer indicating the number of tokens used in the source sentence */\n sourceTokens?: number;\n /** An integer indicating the number of tokens used in the translation response */\n responseTokens?: number;\n /** An integer indicating the number of tokens used in the target sentence */\n targetTokens?: number;\n /** A string giving the translated text. */\n text: string;\n}\n\n/** Response for the transliteration API. */\nexport interface TransliterateResultOutput {\n /** Array of transliterated texts */\n readonly value: Array<TransliteratedTextOutput>;\n}\n\n/** Transliterated text element. */\nexport interface TransliteratedTextOutput {\n /** A string which is the result of converting the input string to the output script. */\n text: string;\n /** A string specifying the script used in the output. */\n script: string;\n}\n\n/** Language Directionality */\nexport type LanguageDirectionalityOutput = \"ltr\" | \"rtl\";\n"]}