Skip to main content

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


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)

Uploaded Source

Built Distribution

fourthdimension-2.0.3a1-py3-none-any.whl (13.1 MB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page