langchain.document_transformers.google_translate.GoogleTranslateTransformer

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

Translate text documents using Google Cloud Translation.

Parameters
  • project_id – Google Cloud Project ID.

  • location – (Optional) Translate model location.

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

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

  • api_endpoint – (Optional) Regional endpoint to use.

Methods

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

param project_id

Google Cloud Project ID.

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: Optional[str] = None, glossary_id: Optional[str] = None, api_endpoint: Optional[str] = None) None[source]
Parameters
  • project_id – Google Cloud Project ID.

  • location – (Optional) Translate model location.

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

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

  • api_endpoint – (Optional) Regional endpoint to use.

async atransform_documents(documents: Sequence[Document], **kwargs: Any) Sequence[Document]

Asynchronously transform a list of documents.

Parameters

documents – A sequence of Documents to be transformed.

Returns

A list of transformed Documents.

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

Examples using GoogleTranslateTransformer