From 596113a0f0a93d8f7cc0e730147813f6cbf7f3e8 Mon Sep 17 00:00:00 2001 From: Max Inno Date: Mon, 3 Aug 2026 06:40:10 +0300 Subject: [PATCH] feat(ai): add support for styleGuideIds in AI Translation methods --- .../ai/tests/test_ai_resources.py | 64 +++++++++++++++++++ crowdin_api/api_resources/ai/types.py | 1 + 2 files changed, 65 insertions(+) diff --git a/crowdin_api/api_resources/ai/tests/test_ai_resources.py b/crowdin_api/api_resources/ai/tests/test_ai_resources.py index 83da9a2..b6ae4a6 100644 --- a/crowdin_api/api_resources/ai/tests/test_ai_resources.py +++ b/crowdin_api/api_resources/ai/tests/test_ai_resources.py @@ -1129,6 +1129,38 @@ def test_get_ai_file_translations_path(self, in_params, path, base_absolut_url): "targetLanguageId": "uk", }, ), + ( + AiFileTranslationRequest( + storageId=1, + targetLanguageId="uk", + sourceLanguageId="en", + type="txt", + parserVersion=1, + tmIds=[123], + glossaryIds=[456], + styleGuideIds=[654], + aiPromptId=789, + aiProviderId=12, + aiModelId="gpt-4.1", + instructions=["Keep a formal tone"], + attachmentIds=[123], + ), + { + "storageId": 1, + "targetLanguageId": "uk", + "sourceLanguageId": "en", + "type": "txt", + "parserVersion": 1, + "tmIds": [123], + "glossaryIds": [456], + "styleGuideIds": [654], + "aiPromptId": 789, + "aiProviderId": 12, + "aiModelId": "gpt-4.1", + "instructions": ["Keep a formal tone"], + "attachmentIds": [123], + }, + ), ), ) @mock.patch("crowdin_api.requester.APIRequester.request") @@ -2449,6 +2481,38 @@ def test_get_ai_file_translations_path(self, in_params, path, base_absolut_url): "targetLanguageId": "uk", }, ), + ( + AiFileTranslationRequest( + storageId=1, + targetLanguageId="uk", + sourceLanguageId="en", + type="txt", + parserVersion=1, + tmIds=[123], + glossaryIds=[456], + styleGuideIds=[654], + aiPromptId=789, + aiProviderId=12, + aiModelId="gpt-4.1", + instructions=["Keep a formal tone"], + attachmentIds=[123], + ), + { + "storageId": 1, + "targetLanguageId": "uk", + "sourceLanguageId": "en", + "type": "txt", + "parserVersion": 1, + "tmIds": [123], + "glossaryIds": [456], + "styleGuideIds": [654], + "aiPromptId": 789, + "aiProviderId": 12, + "aiModelId": "gpt-4.1", + "instructions": ["Keep a formal tone"], + "attachmentIds": [123], + }, + ), ), ) @mock.patch("crowdin_api.requester.APIRequester.request") diff --git a/crowdin_api/api_resources/ai/types.py b/crowdin_api/api_resources/ai/types.py index 513c04e..826884f 100644 --- a/crowdin_api/api_resources/ai/types.py +++ b/crowdin_api/api_resources/ai/types.py @@ -297,6 +297,7 @@ class AiFileTranslationRequest(TypedDict): parserVersion: Optional[int] tmIds: Optional[Iterable[int]] glossaryIds: Optional[Iterable[int]] + styleGuideIds: Optional[Iterable[int]] aiPromptId: Optional[int] aiProviderId: Optional[int] aiModelId: Optional[str]