Skip to content

Commit 4ef5c12

Browse files
Merge pull request #25 from DeepLcom/add-model-type
/translate: Add model_type and model_type_used parameters
2 parents 1895887 + ea8fbfb commit 4ef5c12

File tree

4 files changed

+84
-12
lines changed

4 files changed

+84
-12
lines changed

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,14 @@ number is used only for corrections to the OpenAPI specification, for example:
1010
typos, schema fixes, or adding examples.
1111

1212

13+
### [2.17.0] - 2024-11-15
14+
### Added
15+
* `/translate`: add `model_type` request parameter to request the model type
16+
(`quality_optimized`, `latency_optimized`, or `prefer_latency_optimized`) to
17+
use for translation, and the `model_type_used` response parameter indicating
18+
the model type that used.
19+
20+
1321
## [2.16.0] - 2024-07-25
1422
### Added
1523
* Add supported target language variant for text translation: Chinese
@@ -156,6 +164,7 @@ typos, schema fixes, or adding examples.
156164
Initial release of the OpenAPI specification.
157165

158166

167+
[2.17.0]: https://github.com/DeepLcom/openapi/compare/v2.16.0...v2.17.0
159168
[2.16.0]: https://github.com/DeepLcom/openapi/compare/v2.15.0...v2.16.0
160169
[2.15.0]: https://github.com/DeepLcom/openapi/compare/v2.14.1...v2.15.0
161170
[2.14.1]: https://github.com/DeepLcom/openapi/compare/v2.14.0...v2.14.1

openapi.json

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"name": "DeepL - Contact us",
99
"url": "https://www.deepl.com/contact-us"
1010
},
11-
"version": "2.16.0"
11+
"version": "2.17.0"
1212
},
1313
"externalDocs": {
1414
"description": "DeepL Pro - Plans and pricing",
@@ -63,9 +63,8 @@
6363
],
6464
"properties": {
6565
"text": {
66-
"description": "Text to be translated. Only UTF-8-encoded plain text is supported. The parameter may be specified\nmultiple times and translations are returned in the same order as they are requested. Each of the\nparameter values may contain multiple sentences. Up to 50 texts can be sent for translation in one\nrequest.",
66+
"description": "Text to be translated. Only UTF-8-encoded plain text is supported. The parameter may be specified\nmultiple times and translations are returned in the same order as they are requested. Each of the\nparameter values may contain multiple sentences.",
6767
"type": "array",
68-
"maxItems": 50,
6968
"items": {
7069
"type": "string",
7170
"example": "Hello, World!"
@@ -92,6 +91,9 @@
9291
"formality": {
9392
"$ref": "#/components/schemas/Formality"
9493
},
94+
"model_type": {
95+
"$ref": "#/components/schemas/ModelType"
96+
},
9597
"glossary_id": {
9698
"allOf": [
9799
{
@@ -199,6 +201,9 @@
199201
"formality": {
200202
"$ref": "#/components/schemas/Formality"
201203
},
204+
"model_type": {
205+
"$ref": "#/components/schemas/ModelType"
206+
},
202207
"glossary_id": {
203208
"allOf": [
204209
{
@@ -262,6 +267,11 @@
262267
"billed_characters": {
263268
"description": "Number of characters counted by DeepL for billing purposes. Only present if the show_billed_characters parameter is set to true.",
264269
"type": "integer"
270+
},
271+
"model_type_used": {
272+
"description": "Indicates the translation model used. Only present if model_type parameter is included in the request.",
273+
"type": "string",
274+
"example": "quality_optimized"
265275
}
266276
}
267277
}
@@ -1748,6 +1758,15 @@
17481758
],
17491759
"default": "default"
17501760
},
1761+
"ModelType": {
1762+
"type": "string",
1763+
"description": "Specifies which DeepL model should be used for translation.\n\nPossible values are:\n* `latency_optimized` (default) - uses lower latency \u201cclassic\u201d translation models, which support all language pairs; \n default value \n* `quality_optimized` - uses higher latency, improved quality \u201cnext-gen\u201d translation models, which support only a\n subset of language pairs; if a language pair that is not supported by next-gen models is included in the\n request, it will fail. Consider using prefer_quality_optimized instead. \n* `prefer_quality_optimized` - prioritizes use of higher latency, improved quality \u201cnext-gen\u201d translation models,\n which support only a subset of DeepL languages; if a request includes a language pair not supported by \n next-gen models, the request will fall back to latency_optimized classic models.",
1764+
"enum": [
1765+
"quality_optimized",
1766+
"prefer_quality_optimized",
1767+
"latency_optimized"
1768+
]
1769+
},
17511770
"GlossaryId": {
17521771
"type": "string",
17531772
"description": "A unique ID assigned to a glossary.",

openapi.yaml

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ info:
77
contact:
88
name: DeepL - Contact us
99
url: https://www.deepl.com/contact-us
10-
version: 2.16.0
10+
version: 2.17.0
1111
externalDocs:
1212
description: DeepL Pro - Plans and pricing
1313
url: https://www.deepl.com/pro#developer?cta=header-prices/
@@ -125,10 +125,8 @@ paths:
125125
description: |-
126126
Text to be translated. Only UTF-8-encoded plain text is supported. The parameter may be specified
127127
multiple times and translations are returned in the same order as they are requested. Each of the
128-
parameter values may contain multiple sentences. Up to 50 texts can be sent for translation in one
129-
request.
128+
parameter values may contain multiple sentences.
130129
type: array
131-
maxItems: 50
132130
items:
133131
type: string
134132
example: Hello, World!
@@ -146,6 +144,8 @@ paths:
146144
$ref: '#/components/schemas/PreserveFormattingOption'
147145
formality:
148146
$ref: '#/components/schemas/Formality'
147+
model_type:
148+
$ref: '#/components/schemas/ModelType'
149149
glossary_id:
150150
allOf:
151151
- $ref: '#/components/schemas/GlossaryId'
@@ -222,6 +222,8 @@ paths:
222222
$ref: '#/components/schemas/PreserveFormattingOptionStr'
223223
formality:
224224
$ref: '#/components/schemas/Formality'
225+
model_type:
226+
$ref: '#/components/schemas/ModelType'
225227
glossary_id:
226228
allOf:
227229
- $ref: '#/components/schemas/GlossaryId'
@@ -270,6 +272,11 @@ paths:
270272
description: Number of characters counted by DeepL for billing purposes.
271273
Only present if the show_billed_characters parameter is set to true.
272274
type: integer
275+
model_type_used:
276+
description: Indicates the translation model used. Only present if model_type parameter
277+
is included in the request.
278+
type: string
279+
example: quality_optimized
273280
examples:
274281
Basic:
275282
value:
@@ -1386,6 +1393,25 @@ components:
13861393
- prefer_more
13871394
- prefer_less
13881395
default: default
1396+
ModelType:
1397+
type: string
1398+
description: |-
1399+
Specifies which DeepL model should be used for translation.
1400+
1401+
Possible values are:
1402+
* `latency_optimized` (default) - uses lower latency “classic” translation models, which support all language pairs;
1403+
default value
1404+
* `quality_optimized` - uses higher latency, improved quality “next-gen” translation models, which support only a
1405+
subset of language pairs; if a language pair that is not supported by next-gen models is included in the
1406+
request, it will fail. Consider using prefer_quality_optimized instead.
1407+
* `prefer_quality_optimized` - prioritizes use of higher latency, improved quality “next-gen” translation models,
1408+
which support only a subset of DeepL languages; if a request includes a language pair not supported by
1409+
next-gen models, the request will fall back to latency_optimized classic models.
1410+
1411+
enum:
1412+
- quality_optimized
1413+
- prefer_quality_optimized
1414+
- latency_optimized
13891415
GlossaryId:
13901416
type: string
13911417
description: A unique ID assigned to a glossary.

openapi_gitbook.yaml

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ info:
99
contact:
1010
name: DeepL - Contact us
1111
url: https://www.deepl.com/contact-us
12-
version: 2.16.0
12+
version: 2.17.0
1313
externalDocs:
1414
description: DeepL Pro - Plans and pricing
1515
url: https://www.deepl.com/pro#developer?cta=header-prices/
@@ -83,9 +83,9 @@ paths:
8383
text:
8484
description: |-
8585
Text to be translated. Only UTF-8-encoded plain text is supported. The parameter may be specified
86-
up to 50 times in a single request. Translations are returned in the same order as they are requested.
86+
many times in a single request, within the request size limit (128KiB). Translations are returned
87+
in the same order as they are requested.
8788
type: array
88-
maxItems: 50
8989
items:
9090
type: string
9191
example: Hello, World!
@@ -103,6 +103,8 @@ paths:
103103
$ref: '#/components/schemas/PreserveFormattingOption'
104104
formality:
105105
$ref: '#/components/schemas/Formality'
106+
model_type:
107+
$ref: '#/components/schemas/ModelType'
106108
glossary_id:
107109
description: |-
108110
Specify the glossary to use for the translation. **Important:** This requires the `source_lang`
@@ -140,8 +142,9 @@ paths:
140142
- target_lang
141143
properties:
142144
text:
143-
description: Text to be translated. Only UTF-8-encoded plain text is supported. The parameter may be specified
144-
up to 50 times in a single request. Translations are returned in the same order as they are requested.
145+
description: Text to be translated. Only UTF-8-encoded plain text is supported. The parameter may be
146+
specified many times in a single request, within the request size limit (128KiB). Translations are
147+
returned in the same order as they are requested.
145148
type: array
146149
items:
147150
type: string
@@ -160,6 +163,8 @@ paths:
160163
$ref: '#/components/schemas/PreserveFormattingOptionStr'
161164
formality:
162165
$ref: '#/components/schemas/Formality'
166+
model_type:
167+
$ref: '#/components/schemas/ModelType'
163168
glossary_id:
164169
description: |-
165170
Specify the glossary to use for the translation. **Important:** This requires the `source_lang`
@@ -223,6 +228,12 @@ paths:
223228
Only present if the show_billed_characters parameter is set to true.
224229
type: integer
225230
example: 42
231+
model_type_used:
232+
description: Indicates the translation model used. Only present if model_type parameter
233+
is included in the request.
234+
type: string
235+
example: quality_optimized
236+
226237
400:
227238
$ref: '#/components/responses/BadRequest'
228239
403:
@@ -1244,6 +1255,13 @@ components:
12441255
- prefer_less
12451256
default: default
12461257
example: prefer_more
1258+
ModelType:
1259+
type: string
1260+
description: Specifies which DeepL model should be used for translation.
1261+
enum:
1262+
- quality_optimized
1263+
- prefer_quality_optimized
1264+
- latency_optimized
12471265
GlossaryId:
12481266
type: string
12491267
description: A unique ID assigned to a glossary.

0 commit comments

Comments
 (0)