UiPath Documentation
uipath-cli
latest
false
重要 :
请注意,此内容已使用机器翻译进行了本地化。 新发布内容的本地化可能需要 1-2 周的时间才能完成。

UiPath CLI 用户指南

UIP 智能体上下文

uip agent context管理智能体项目的上下文资源,即智能体在运行时查阅的 RAG(检索增强生成)索引绑定。每个上下文都是对索引的命名引用,以及检索模式和评分参数。该命令直接写入磁盘上的智能体项目(纯本地 — 无需登录)。

大纲

uip agent context add    <name> --index <indexName>
                                [--retrieval-mode <mode>] [--threshold <n>] [--result-count <n>]
                                [--path <dir>]
uip agent context list                                    [--path <dir>]
uip agent context remove <name>                           [--path <dir>]
uip agent context add    <name> --index <indexName>
                                [--retrieval-mode <mode>] [--threshold <n>] [--result-count <n>]
                                [--path <dir>]
uip agent context list                                    [--path <dir>]
uip agent context remove <name>                           [--path <dir>]

所有uip agent context子命令均采用全局选项--output--output-filter--log-level--log-file )。退出代码遵循标准合同

uip 智能体上下文添加

将 RAG 上下文资源添加到智能体。

参数

  • <name> (必填) — 上下文资源名称。用于稍后删除 ( context remove <name> )。

选项

标记默认必填用途
--index <indexName>要从中检索的索引名称。
--retrieval-mode <mode>semantic检索模式。以下组织之一: semanticstructureddeepragbatchtransform
--threshold <n>0检索分数阈值(数字)。低于此截止值的值将被丢弃。
--result-count <n>3每个查询要检索的结果数 (整数)。
--path <path>.智能体项目目录的路径。

如果向--threshold--result-count输入无效的数字,则会失败,并出现验证错误。

示例

# Semantic RAG with defaults (threshold 0, 3 results)
uip agent context add KnowledgeBase --index docs-index --path ./my-agent

# Tighter recall: higher threshold, more results
uip agent context add KnowledgeBase \
  --index docs-index \
  --retrieval-mode semantic \
  --threshold 0.7 \
  --result-count 5

# Structured retrieval over a different index
uip agent context add Tickets \
  --index ticket-index \
  --retrieval-mode structured
# Semantic RAG with defaults (threshold 0, 3 results)
uip agent context add KnowledgeBase --index docs-index --path ./my-agent

# Tighter recall: higher threshold, more results
uip agent context add KnowledgeBase \
  --index docs-index \
  --retrieval-mode semantic \
  --threshold 0.7 \
  --result-count 5

# Structured retrieval over a different index
uip agent context add Tickets \
  --index ticket-index \
  --retrieval-mode structured

数据形状(--输出 json)

{
  "Code": "AgentContextAdd",
  "Data": {
    "Status": "Context added",
    "Name": "KnowledgeBase",
    "Index": "docs-index",
    "Mode": "semantic",
    "Id": "a1b2c3d4-0000-0000-0000-000000000010"
  }
}
{
  "Code": "AgentContextAdd",
  "Data": {
    "Status": "Context added",
    "Name": "KnowledgeBase",
    "Index": "docs-index",
    "Mode": "semantic",
    "Id": "a1b2c3d4-0000-0000-0000-000000000010"
  }
}

Id是标记到资源中的生成 UUID。使用Name或带有Idcontext remove

uip 智能体上下文列表

枚举智能体上配置的上下文资源。

选项

标记默认用途
--path <path>.智能体项目目录的路径。

示例

uip agent context list --path ./my-agent
uip agent context list --path ./my-agent

数据形状(--输出 json)

{
  "Code": "AgentContextList",
  "Data": [
    {
      "Name": "KnowledgeBase",
      "Index": "docs-index",
      "Mode": "semantic",
      "Id": "a1b2c3d4-0000-0000-0000-000000000010"
    }
  ]
}
{
  "Code": "AgentContextList",
  "Data": [
    {
      "Name": "KnowledgeBase",
      "Index": "docs-index",
      "Mode": "semantic",
      "Id": "a1b2c3d4-0000-0000-0000-000000000010"
    }
  ]
}

空项目会返回Data: { "Message": "No contexts configured" }

移除 UIP 智能体上下文

删除上下文资源。

参数

  • <name> (必填) — 上下文名称ID。

选项

标记默认用途
--path <path>.智能体项目目录的路径。

示例

uip agent context remove KnowledgeBase --path ./my-agent
uip agent context remove KnowledgeBase --path ./my-agent

数据形状(--输出 json)

{
  "Code": "AgentContextRemove",
  "Data": {
    "Status": "Context removed",
    "Name": "KnowledgeBase"
  }
}
{
  "Code": "AgentContextRemove",
  "Data": {
    "Status": "Context removed",
    "Name": "KnowledgeBase"
  }
}

缺少上下文将失败,显示Context "<name>" not found和退出代码1

另请参阅

此页面有帮助吗?

连接

需要帮助? 支持

想要了解详细内容? UiPath Academy

有问题? UiPath 论坛

保持更新