GoogleTranslateTransformer#

class langchain_community.document_transformers.google_translate.GoogleTranslateTransformer(project_id: str, *, location: str = 'global', model_id: str | None = None, glossary_id: str | None = None, api_endpoint: str | None = None)[source]#

Deprecated since version 0.0.32: Use :class:`~langchain_google_community.DocAIParser` instead.

Translate text documents using Google Cloud Translation.

Parameters:
  • project_id (str) – Google Cloud Project ID.

  • location (str) – (Optional) Translate model location.

  • model_id (str | None) – (Optional) Translate model ID to use.

  • glossary_id (str | None) – (Optional) Translate glossary ID to use.

  • api_endpoint (str | None) – (Optional) Regional endpoint to use.

Methods

__init__(project_id,Β *[,Β location,Β ...])

atransform_documents(documents,Β **kwargs)

Asynchronously transform a list of documents.

transform_documents(documents,Β **kwargs)

Translate text documents using Google Translate.

__init__(project_id: str, *, location: str = 'global', model_id: str | None = None, glossary_id: str | None = None, api_endpoint: str | None = None) β†’ None[source]#
Parameters:
  • project_id (str) – Google Cloud Project ID.

  • location (str) – (Optional) Translate model location.

  • model_id (str | None) – (Optional) Translate model ID to use.

  • glossary_id (str | None) – (Optional) Translate glossary ID to use.

  • api_endpoint (str | None) – (Optional) Regional endpoint to use.

Return type:

None

async atransform_documents(documents: Sequence[Document], **kwargs: Any) β†’ Sequence[Document]#

Asynchronously transform a list of documents.

Parameters:
  • documents (Sequence[Document]) – A sequence of Documents to be transformed.

  • kwargs (Any)

Returns:

A sequence of transformed Documents.

Return type:

Sequence[Document]

transform_documents(documents: Sequence[Document], **kwargs: Any) β†’ Sequence[Document][source]#

Translate text documents using Google Translate.

Parameters:
  • source_language_code – ISO 639 language code of the input document.

  • target_language_code – ISO 639 language code of the output document. For supported languages, refer to: https://cloud.google.com/translate/docs/languages

  • mime_type – (Optional) Media Type of input text. Options: text/plain, text/html

  • documents (Sequence[Document])

  • kwargs (Any)

Return type:

Sequence[Document]