llama-index readers alibabacloud_aisearch integration
Project description
LlamaIndex Readers Integration: Alibabacloud_Aisearch
Installation
pip install llama-index-readers-alibabacloud-aisearch
Usage
Supported file types: ppt/pptx, doc/docx, pdf, images and so on. For further details, please visit:
You can specify the endpoint
and aisearch_api_key
in the constructor, or set the environment variables AISEARCH_ENDPOINT
and AISEARCH_API_KEY
.
Read local files
from llama_index.readers.alibabacloud_aisearch import (
AlibabaCloudAISearchDocumentReader,
AlibabaCloudAISearchImageReader,
)
from llama_index.core import SimpleDirectoryReader
document_reader = AlibabaCloudAISearchDocumentReader()
image_reader = AlibabaCloudAISearchImageReader()
file_extractor = {}
for suffix in (".pdf", ".docx", ".doc", ".ppt", ".pptx"):
file_extractor[suffix] = document_reader
for suffix in (".jpg", ".jpeg", ".png", ".bmp", ".tiff"):
file_extractor[suffix] = image_reader
documents = SimpleDirectoryReader(
"./data", file_extractor=file_extractor
).load_data(show_progress=True)
print(documents)
Read remote files
from llama_index.readers.alibabacloud_aisearch import (
AlibabaCloudAISearchImageReader,
)
image_reader = AlibabaCloudAISearchImageReader(
service_id="ops-image-analyze-ocr-001"
)
image_urls = [
"https://img.alicdn.com/imgextra/i1/O1CN01WksnF41hlhBFsXDNB_!!6000000004318-0-tps-1000-1400.jpg",
]
# The file_type is automatically determined based on the file extension.
# If it cannot be identified, manual specification of the file_type is required.
documents = image_reader.load_data(file_path=image_urls, file_type="jpg")
print(documents)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file llama_index_readers_alibabacloud_aisearch-0.2.0.tar.gz
.
File metadata
- Download URL: llama_index_readers_alibabacloud_aisearch-0.2.0.tar.gz
- Upload date:
- Size: 4.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.11.10 Darwin/22.3.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0cfe6a45abd50192fb661a20007ae969e4bff63d5904496d40c214209c161a32 |
|
MD5 | f3c396ac305db74e9299b267f7b31ae6 |
|
BLAKE2b-256 | 7b0a6bcb58dffe42c9c435d7c75309daf8e9dde42fb2e54f3488b63780bca544 |
File details
Details for the file llama_index_readers_alibabacloud_aisearch-0.2.0-py3-none-any.whl
.
File metadata
- Download URL: llama_index_readers_alibabacloud_aisearch-0.2.0-py3-none-any.whl
- Upload date:
- Size: 4.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.11.10 Darwin/22.3.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 34ecc858971cd4d17b7c690d7e1a3b26870ad57f6e6e2ed6a9d24e862798da7b |
|
MD5 | 44c4b741d6e4bf96081ddf7b8f0c8ad4 |
|
BLAKE2b-256 | b39fa4f37ab69b686bb1f5994c112872ee1ae1869dfa7491067195cd8e362394 |