fourthdimension
Project description
使用示例
FourthDimension支持批量导入一个文件目录下的所有文档,“path/”是存放文档的文件目录名称。
from fourthdimension import fd_client
myKbName = "myKbName"
fd_client.createKB(myKbName)
result = fd_client.importDocuments(myKbName, "path/", fd_client.Summarizing)
if result.getCode() != 0:
print("导入失败,错误信息:" + result.getMsg())
else:
print("导入成功。")
FdResult<List<Chunk>result = fd_client.query(myKbName, "my question")
if result.getCode() != 0:
print("查询失败,错误信息:" + result.getMsg())
else:
print(result.getData())
# 添加文档
result = fd_client.addDocument(myKbName, "/path/source_file_name", "/path/target_file_name", fd_client.SUMMARIZING)
# 修改文档
result = fd_client.updateDocument(myKbName, "/path/source_file_name", "/path/target_file_name", fd_client.SUMMARIZING)
# 删除文档
result = fd_client.deleteDocument(myKbName, "/path/target_file_name")
# 删除知识库
result = fd_client.deleteKB(myKbName)
result = fd_client.ruminate(myKbName, fd_client.SUMMARIZING)
if result.getCode() != 0:
print("反刍失败,错误信息:" + result.getMsg())
else:
print("反刍成功。")
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
fourthdimension-2.0.3a1.tar.gz
(13.1 MB
view hashes)
Built Distribution
Close
Hashes for fourthdimension-2.0.3a1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a440827cc878536b69725a8c0f09fc4f0b4b8decf2cfc69e2fcfad3b97d8aeac |
|
MD5 | 89faeb400b316c8fbd571907b49a64bf |
|
BLAKE2b-256 | 9f94e955bad016c90f8eaa6759e0497a20ad11ead8117421d6a2aeb47d9b1d8a |