Skip to main content
LlamaIndex

DashScopeCloudRetriever

通过 LlamaIndex 使用百炼云端知识库检索

DashScopeCloudRetriever 允许在 LlamaIndex 中直接检索阿里云百炼云端知识库中的内容。

使用示例

from llama_index.indices.managed.dashscope import DashScopeCloudRetriever

retriever = DashScopeCloudRetriever(
    api_key="your-api-key",
    workspace_id="your-workspace-id",
    index_id="your-index-id"
)

nodes = retriever.retrieve("如何使用百炼?")
for node in nodes:
    print(node.text)

参数说明

参数类型必填描述
api_keystring百炼 API Key
workspace_idstring业务空间 ID
index_idstring知识库索引 ID
top_kinteger返回的最大结果数,默认 5
Managed Agent API
RAG API
Connector API
Memory API