DoctranQATransformer#

class langchain_community.document_transformers.doctran_text_qa.DoctranQATransformer(openai_api_key: str | None = None, openai_api_model: str | None = None)[source]#

Extract QA from text documents using doctran.

Parameters:
  • openai_api_key (str | None) – OpenAI API key. Can also be specified via environment variable OPENAI_API_KEY.

  • openai_api_model (str | None)

Example

from langchain_community.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)

Asynchronously transform a list of documents.

transform_documents(documents,Β **kwargs)

Extracts QA from text documents using doctran.

__init__(openai_api_key: str | None = None, openai_api_model: str | None = None) β†’ None[source]#
Parameters:
  • openai_api_key (str | None)

  • openai_api_model (str | None)

Return type:

None

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

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]#

Extracts QA from text documents using doctran.

Parameters:
  • documents (Sequence[Document])

  • kwargs (Any)

Return type:

Sequence[Document]

Examples using DoctranQATransformer