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