langchain.document_transformers.doctran_text_qa.DoctranQATransformer

class langchain.document_transformers.doctran_text_qa.DoctranQATransformer(openai_api_key: Optional[str] = None, openai_api_model: Optional[str] = None)[source]

Extract QA from text documents using doctran.

Parameters

openai_api_key – OpenAI API key. Can also be specified via environment variable OPENAI_API_KEY.

Example

from langchain.document_transformers import DoctranQATransformer

# Pass in openai_api_key or set env var OPENAI_API_KEY
qa_transformer = DoctranQATransformer()
transformed_document = await qa_transformer.atransform_documents(documents)

Methods

__init__([openai_api_key, openai_api_model])

atransform_documents(documents, **kwargs)

Extracts QA from text documents using doctran.

transform_documents(documents, **kwargs)

Transform a list of documents.

__init__(openai_api_key: Optional[str] = None, openai_api_model: Optional[str] = None) None[source]
async atransform_documents(documents: Sequence[Document], **kwargs: Any) Sequence[Document][source]

Extracts QA from text documents using doctran.

transform_documents(documents: Sequence[Document], **kwargs: Any) Sequence[Document][source]

Transform a list of documents.

Parameters

documents – A sequence of Documents to be transformed.

Returns

A list of transformed Documents.

Examples using DoctranQATransformer