Skip to content

[ACL-949] Add show_billed_characters parameter to OpenAPI spec #24

New issue

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

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

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Sep 13, 2024
17 changes: 16 additions & 1 deletion openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@
"context": {
"$ref": "#/components/schemas/Context"
},
"show_billed_characters": {
"$ref": "#/components/schemas/ShowBilledCharacters"
},
"split_sentences": {
"$ref": "#/components/schemas/SplitSentencesOption"
},
Expand Down Expand Up @@ -184,6 +187,9 @@
"context": {
"$ref": "#/components/schemas/Context"
},
"show_billed_characters": {
"$ref": "#/components/schemas/ShowBilledCharacters"
},
"split_sentences": {
"$ref": "#/components/schemas/SplitSentencesOption"
},
Expand Down Expand Up @@ -252,6 +258,10 @@
"text": {
"description": "The translated text.",
"type": "string"
},
"billed_characters": {
"description": "Optional. Number of characters counted by DeepL for billing purposes.",
"type": "integer"
}
}
}
Expand All @@ -264,7 +274,8 @@
"translations": [
{
"detected_source_language": "EN",
"text": "Hallo, Welt!"
"text": "Hallo, Welt!",
"billed_characters": 42
}
]
}
Expand Down Expand Up @@ -1661,6 +1672,10 @@
}
},
"schemas": {
"ShowBilledCharacters": {
"description": "When true, the response will include an additional key-value pair with the key billed_characters and a \nvalue that is an integer showing the number of characters from the request that will be counted by DeepL \nfor billing purposes.",
"type": "boolean"
},
"Context": {
"description": "The `context` parameter makes it possible to include additional context that can influence a translation but is not translated itself. \nThis additional context can potentially improve translation quality when translating short, low-context source texts such \nas product names on an e-commerce website, article headlines on a news website, or UI elements.\n\n\nFor example...\n - When translating a product name, you might pass the product description as context. \n - When translating a news article headline, you might pass the first few sentences or a summary of the article as context.\n\n\nFor best results, we recommend sending a few complete sentences of context in the same language as the source text. \nThere is no size limit for the `context` parameter itself, but the request body size limit of 128 KiB still applies to \nall text translation requests. \n\n\nIf you send a request with multiple `text` parameters, the `context` parameter will be applied to each one. \n\n\nCharacters included in the `context` parameter will not be counted toward billing (i.e. there is no additional \ncost for using the `context` parameter, and only characters sent in the text parameter(s) will be counted toward \nbilling for text translation even when the `context` parameter is included in a request).",
"type": "string"
Expand Down
14 changes: 14 additions & 0 deletions openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,8 @@ paths:
$ref: '#/components/schemas/TargetLanguageText'
context:
$ref: '#/components/schemas/Context'
show_billed_characters:
$ref: '#/components/schemas/ShowBilledCharacters'
split_sentences:
$ref: '#/components/schemas/SplitSentencesOption'
preserve_formatting:
Expand Down Expand Up @@ -212,6 +214,8 @@ paths:
$ref: '#/components/schemas/TargetLanguageText'
context:
$ref: '#/components/schemas/Context'
show_billed_characters:
$ref: '#/components/schemas/ShowBilledCharacters'
split_sentences:
$ref: '#/components/schemas/SplitSentencesOption'
preserve_formatting:
Expand Down Expand Up @@ -262,12 +266,16 @@ paths:
text:
description: The translated text.
type: string
billed_characters:
description: Optional. Number of characters counted by DeepL for billing purposes.
type: integer
examples:
Basic:
value:
translations:
- detected_source_language: EN
text: Hallo, Welt!
billed_characters: 42
Glossary:
value:
translations:
Expand Down Expand Up @@ -1272,6 +1280,12 @@ components:
name: Authorization
in: header
schemas:
ShowBilledCharacters:
description: |-
When true, the response will include an additional key-value pair with the key billed_characters and a
value that is an integer showing the number of characters from the request that will be counted by DeepL
for billing purposes.
type: boolean
Context:
description: |-
The `context` parameter makes it possible to include additional context that can influence a translation but is not translated itself.
Expand Down
16 changes: 15 additions & 1 deletion openapi_gitbook.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ paths:
$ref: '#/components/schemas/TargetLanguageText'
context:
$ref: '#/components/schemas/Context'
show_billed_characters:
$ref: '#/components/schemas/ShowBilledCharacters'
split_sentences:
$ref: '#/components/schemas/SplitSentencesOption'
preserve_formatting:
Expand Down Expand Up @@ -150,6 +152,8 @@ paths:
$ref: '#/components/schemas/TargetLanguageText'
context:
$ref: '#/components/schemas/Context'
show_billed_characters:
$ref: '#/components/schemas/ShowBilledCharacters'
split_sentences:
$ref: '#/components/schemas/SplitSentencesOption'
preserve_formatting:
Expand Down Expand Up @@ -214,6 +218,10 @@ paths:
description: The translated text.
type: string
example: Hallo, Welt!
billed_characters:
description: Optional. Number of characters counted by DeepL for billing purposes.
type: integer
example: 42
400:
$ref: '#/components/responses/BadRequest'
403:
Expand Down Expand Up @@ -1321,7 +1329,13 @@ components:

Characters included in the `context` parameter will not be counted toward billing.
type: string
example: This is context.
example: This is context.
ShowBilledCharacters:
description: |-
When true, the response will include an additional key-value pair with the key billed_characters and a
value that is an integer showing the number of characters from the request that will be counted by DeepL
for billing purposes.
type: boolean
OutlineDetectionOptionStr:
description: |-
Disable the automatic detection of XML structure by setting the `outline_detection` parameter
Expand Down