gen_ai_hub.orchestration_v2.models.translation module

Translation module configuration models.

class gen_ai_hub.orchestration_v2.models.translation.TranslationType(*values)

Bases: str, Enum

Enumerates supported translation types.

SAP_DOCUMENT_TRANSLATION = 'sap_document_translation'
class gen_ai_hub.orchestration_v2.models.translation.TranslationConfig(*, source_language: str | None = None, target_language: str)

Bases: ABCBaseModel

Configuration for sap_document_translation translation provider.

Parameters:
  • source_language – Language of the text to be translated. Example: de-DE

  • target_language – Language to which the text should be translated. Example: en-US

source_language: str | None
target_language: str
model_config: ClassVar[ConfigDict] = {'extra': 'forbid', 'frozen': False}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class gen_ai_hub.orchestration_v2.models.translation.SAPDocumentTranslation(*, type: TranslationType = TranslationType.SAP_DOCUMENT_TRANSLATION, config: TranslationConfig)

Bases: ABCBaseModel

Configuration for translation module.

Parameters:
  • type – The type of translation module (e.g., ‘sap_document_translation’).

  • config – Configuration object for the translation module.

type_: TranslationType
config: TranslationConfig
model_config: ClassVar[ConfigDict] = {'extra': 'forbid', 'frozen': False}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class gen_ai_hub.orchestration_v2.models.translation.SAPDocumentTranslationApplyToSelector(*, category: Literal['placeholders', 'template_roles'], items: list[str], source_language: str)

Bases: ABCBaseModel

This selector allows you to define the scope of translation, such as specific placeholders or messages with specific roles. For example, {“category”: “placeholders”,

“items”: [“user_input”], “source_language”: “de-DE”} targets the value of “user_input” in placeholder_values specified in the request payload; and considers the value to be in German.

category: Literal['placeholders', 'template_roles']
items: list[str]
source_language: str
model_config: ClassVar[ConfigDict] = {'extra': 'forbid', 'frozen': False}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class gen_ai_hub.orchestration_v2.models.translation.InputTranslationConfig(*, source_language: str | None = None, target_language: str, apply_to: list[SAPDocumentTranslationApplyToSelector] | None = None)

Bases: TranslationConfig

Configuration for input translation.

Parameters:
  • source_language – Language of the text to be translated. Example: de-DE

  • target_language – Language to which the text should be translated. Example: en-US

  • apply_to – List of selectors that define the scope of translation.

apply_to: list[SAPDocumentTranslationApplyToSelector] | None
model_config: ClassVar[ConfigDict] = {'extra': 'forbid', 'frozen': False}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

source_language: str | None
target_language: str
class gen_ai_hub.orchestration_v2.models.translation.OutputTranslationConfig(*, source_language: str | None = None, target_language: str | SAPDocumentTranslationApplyToSelector)

Bases: TranslationConfig

target_language: str | SAPDocumentTranslationApplyToSelector
model_config: ClassVar[ConfigDict] = {'extra': 'forbid', 'frozen': False}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

source_language: str | None
class gen_ai_hub.orchestration_v2.models.translation.SAPDocumentTranslationInput(*, type: TranslationType = TranslationType.SAP_DOCUMENT_TRANSLATION, config: InputTranslationConfig | TranslationConfig, translate_messages_history: bool | None = None)

Bases: SAPDocumentTranslation

Configuration for input translation

Parameters:
  • type – The type of translation module (e.g., ‘sap_document_translation’).

  • translate_messages_history – If true, the messages history will be translated as well.

  • config – Configuration object for the translation module.

translate_messages_history: bool | None
config: InputTranslationConfig | TranslationConfig
model_config: ClassVar[ConfigDict] = {'extra': 'forbid', 'frozen': False}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

type_: TranslationType
class gen_ai_hub.orchestration_v2.models.translation.SAPDocumentTranslationOutput(*, type: TranslationType = TranslationType.SAP_DOCUMENT_TRANSLATION, config: OutputTranslationConfig | TranslationConfig)

Bases: SAPDocumentTranslation

Configuration for output translation

Parameters:
  • type – The type of translation module (e.g., ‘sap_document_translation’).

  • config – Configuration object for the translation module.

config: OutputTranslationConfig | TranslationConfig
model_config: ClassVar[ConfigDict] = {'extra': 'forbid', 'frozen': False}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

type_: TranslationType
class gen_ai_hub.orchestration_v2.models.translation.TranslationModuleConfig(*, input: SAPDocumentTranslationInput | SAPDocumentTranslation | None = None, output: SAPDocumentTranslationOutput | SAPDocumentTranslation | None = None)

Bases: ABCBaseModel

Configuration for translation module

Parameters:
  • input – Configuration for input translation

  • output – Configuration for output translation

input: SAPDocumentTranslationInput | SAPDocumentTranslation | None
output: SAPDocumentTranslationOutput | SAPDocumentTranslation | None
model_config: ClassVar[ConfigDict] = {'extra': 'forbid', 'frozen': False}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].