本文以文档切片服务-001(ops-document-split-001)为例介绍AI搜索开放平台Python SDK的快速入门。
使用示例
请求体body最大不能超过8MB。
from alibabacloud_tea_openapi.models import Config
from alibabacloud_searchplat20240529.client import Client
from alibabacloud_searchplat20240529.models import GetDocumentSplitRequest
if __name__ == '__main__':
config = Config(
bearer_token='OS-****',
endpoint='****.platform-cn-shanghai.opensearch.aliyuncs.com',
protocol='http'
)
client = Client(config=config)
request = GetDocumentSplitRequest().from_map({"document": {"content": "test123", "content_type": "text"},
"strategy": {"max_chunk_size": 300, "need_sentence": False}})
response = client.get_document_split("default", "ops-document-split-001", request)
print(response)
文档内容是否对您有帮助?