DoctranTextTranslator#
- class langchain_community.document_transformers.doctran_text_translate.DoctranTextTranslator(openai_api_key: str | None = None, language: str = 'english', openai_api_model: str | None = None)[source]#
Translate text documents using doctran.
- Parameters:
openai_api_key (Optional[str]) – OpenAI API key. Can also be specified via environment variable
OPENAI_API_KEY.
language (str) – The language to translate to.
openai_api_model (Optional[str])
Example
from langchain_community.document_transformers import DoctranTextTranslator
# Pass in openai_api_key or set env var OPENAI_API_KEY qa_translator = DoctranTextTranslator(language=”spanish”) translated_document = await qa_translator.atransform_documents(documents)
Methods
__init__
([openai_api_key, language, ...])atransform_documents
(documents, **kwargs)Translates text documents using doctran.
transform_documents
(documents, **kwargs)Translates text documents using doctran.
- __init__(openai_api_key: str | None = None, language: str = 'english', openai_api_model: str | None = None) None [source]#
- Parameters:
openai_api_key (str | None)
language (str)
openai_api_model (str | None)
- Return type:
None
Examples using DoctranTextTranslator