langchain_community.document_loaders.doc_intelligence
.AzureAIDocumentIntelligenceLoader¶
- class langchain_community.document_loaders.doc_intelligence.AzureAIDocumentIntelligenceLoader(api_endpoint: str, api_key: str, file_path: Optional[str] = None, url_path: Optional[str] = None, api_version: Optional[str] = None, api_model: str = 'prebuilt-layout', mode: str = 'markdown', *, analysis_features: Optional[List[str]] = None)[source]¶
使用Azure文档智能加载PDF。
使用Azure文档智能(以前称为表单识别器)初始化文件处理对象。
此构造函数初始化一个AzureAIDocumentIntelligenceParser对象,用于使用Azure文档智能API解析文件。load方法生成的文档的内容表示由mode参数确定。
- api_endpoint: str
用于构建DocumentIntelligenceClient的API端点。
- api_key: str
用于构建DocumentIntelligenceClient的API密钥。
- file_pathOptional[str]
需要加载的文件路径。 必须指定file_path或url_path之一。
- url_pathOptional[str]
需要加载的文件的URL。 必须指定file_path或url_path之一。
- api_version: Optional[str]
DocumentIntelligenceClient的API版本。设置为None以使用`azure-ai-documentintelligence`包中的默认值。
- api_model: str
唯一的文档模型名称。默认值为”prebuilt-layout”。 请注意,覆盖此默认值可能导致不受支持的行为。
- mode: Optional[str]
生成的文档的内容表示类型。 使用”single”、”page”或”markdown”之一。默认值为”markdown”。
- analysis_features: Optional[List[str]]
可选分析特性列表,每个特性应作为符合`azure-ai-documentintelligence`包中的枚举`DocumentAnalysisFeature`的str传递。默认值为None。
>>> obj = AzureAIDocumentIntelligenceLoader( ... file_path="path/to/file", ... api_endpoint="https://endpoint.azure.com", ... api_key="APIKEY", ... api_version="2023-10-31-preview", ... api_model="prebuilt-layout", ... mode="markdown" ... )
Methods
__init__
(api_endpoint, api_key[, file_path, ...])使用Azure文档智能(以前称为表单识别器)初始化文件处理对象。
一个用于文档的惰性加载器。
aload
()将数据加载到文档对象中。
将给定路径作为页面进行延迟加载。
load
()将数据加载到文档对象中。
load_and_split
([text_splitter])加载文档并分割成块。块作为文档返回。
- Parameters
api_endpoint (str) –
api_key (str) –
file_path (Optional[str]) –
url_path (Optional[str]) –
api_version (Optional[str]) –
api_model (str) –
mode (str) –
analysis_features (Optional[List[str]]) –
- Return type
None
- __init__(api_endpoint: str, api_key: str, file_path: Optional[str] = None, url_path: Optional[str] = None, api_version: Optional[str] = None, api_model: str = 'prebuilt-layout', mode: str = 'markdown', *, analysis_features: Optional[List[str]] = None) None [source]¶
使用Azure文档智能(以前称为表单识别器)初始化文件处理对象。
此构造函数初始化一个AzureAIDocumentIntelligenceParser对象,用于使用Azure文档智能API解析文件。load方法生成的文档的内容表示由mode参数确定。
- api_endpoint: str
用于构建DocumentIntelligenceClient的API端点。
- api_key: str
用于构建DocumentIntelligenceClient的API密钥。
- file_pathOptional[str]
需要加载的文件路径。 必须指定file_path或url_path之一。
- url_pathOptional[str]
需要加载的文件的URL。 必须指定file_path或url_path之一。
- api_version: Optional[str]
DocumentIntelligenceClient的API版本。设置为None以使用`azure-ai-documentintelligence`包中的默认值。
- api_model: str
唯一的文档模型名称。默认值为”prebuilt-layout”。 请注意,覆盖此默认值可能导致不受支持的行为。
- mode: Optional[str]
生成的文档的内容表示类型。 使用”single”、”page”或”markdown”之一。默认值为”markdown”。
- analysis_features: Optional[List[str]]
可选分析特性列表,每个特性应作为符合`azure-ai-documentintelligence`包中的枚举`DocumentAnalysisFeature`的str传递。默认值为None。
>>> obj = AzureAIDocumentIntelligenceLoader( ... file_path="path/to/file", ... api_endpoint="https://endpoint.azure.com", ... api_key="APIKEY", ... api_version="2023-10-31-preview", ... api_model="prebuilt-layout", ... mode="markdown" ... )
- Parameters
api_endpoint (str) –
api_key (str) –
file_path (Optional[str]) –
url_path (Optional[str]) –
api_version (Optional[str]) –
api_model (str) –
mode (str) –
analysis_features (Optional[List[str]]) –
- Return type
None
- load_and_split(text_splitter: Optional[TextSplitter] = None) List[Document] ¶
加载文档并分割成块。块作为文档返回。
不要覆盖此方法。应该被视为已弃用!
- 参数:
- text_splitter: 用于分割文档的TextSplitter实例。
默认为RecursiveCharacterTextSplitter。
- 返回:
文档列表。
- Parameters
text_splitter (Optional[TextSplitter]) –
- Return type
List[Document]