CLI#
注意:本节正在进行中。
Guardrails CLI#
出于测试目的,Guardrails 工具包提供了一个命令行聊天工具,可用于与 LLM 交互。
nemoguardrails chat --config examples/ [--verbose] [--verbose-llm-calls]
选项#
--config
:应使用的配置。可以是文件夹或 .co/.yml 文件。--verbose
:在 verbose 模式下,还会显示详细的调试信息。--verbose-llm-calls
:在 verbose LLM calls 模式下,调试信息包括发送到 LLM 的完整提示和完成。
您现在应该能够调用 nemoguardrails
CLI。
> nemoguardrails --help
Usage: nemoguardrails [OPTIONS] COMMAND [ARGS]...
Options:
--install-completion [bash|zsh|fish|powershell|pwsh]
Install completion for the specified shell.
--show-completion [bash|zsh|fish|powershell|pwsh]
Show completion for the specified shell, to
copy it or customize the installation.
--help Show this message and exit.
Commands:
actions-server Starts a NeMo Guardrails actions server.
chat Starts an interactive chat session.
convert Convert a Colang 1.0 directory to Colang 2.0 format.
evaluate Run an evaluation task.
server Starts a NeMo Guardrails server.
您还可以使用 --help
标志来了解有关每个 nemoguardrails
命令的更多信息
actions-server#
> nemoguardrails actions-server --help
Usage: nemoguardrails actions-server [OPTIONS]
Starts a NeMo Guardrails actions server.
Options:
--port INTEGER The port that the server should listen on. [default: 8001]
--help Show this message and exit.
chat#
> nemoguardrails chat --help
Usage: nemoguardrails chat [OPTIONS]
Starts an interactive chat session.
--config TEXT Path to a directory containing configuration
files to use. Can also point to a single
configuration file.
[default: config]
--verbose --no-verbose If the chat should be verbose and output
detailed logging information.
[default: no-verbose]
--verbose-no-llm --no-verbose-no-llm If the chat should be verbose and exclude the
prompts and responses for the LLM calls.
[default: no-verbose-no-llm]
--verbose-simplify --no-verbose-simplify Simplify further the verbose output.
[default: no-verbose-simplify]
--debug-level TEXT Enable debug mode which prints rich
information about the flows execution.
Available levels: WARNING, INFO, DEBUG
--streaming --no-streaming If the chat should use the streaming mode, if
possible.
[default: no-streaming]
--server-url TEXT If specified, the chat CLI will interact with
a server, rather than load the config. In this
case, the --config-id must also be specified.
[default: None]
--config-id TEXT The config_id to be used when interacting with
the server.
[default: None]
--help Show this message and exit.
server#
> nemoguardrails server --help
Usage: nemoguardrails server [OPTIONS]
Starts a NeMo Guardrails server.
Options:
--port INTEGER The port that the server should listen on. [default: 8000]
--config TEXT Path to a directory containing multiple configuration sub-folders.
--verbose --no-verbose: If the server should be verbose and output detailed logs including prompts. [default: no-verbose]
--disable-chat-ui --no-disable-chat-ui Weather the ChatUI should be disabled [default: no-disable-chat-ui]
--auto-reload --no-auto-reload Enable auto reload option. [default: no-auto-reload]
--prefix TEXT A prefix that should be added to all server paths. Should start with '/'.
--help Show this message and exit.
evaluate#
> nemoguardrails evaluate --help
Usage: nemoguardrails evaluate [OPTIONS] COMMAND [ARGS]...
Options:
--help: Show this message and exit.
Commands:
fact-checking: Evaluate the performance of the fact-checking rails defined in a Guardrails application.
hallucination: Evaluate the performance of the hallucination rails defined in a Guardrails application.
moderation: Evaluate the performance of the moderation rails defined in a Guardrails application.
topical: Evaluates the performance of the topical rails defined in a Guardrails application. Computes accuracy for canonical form detection, next step generation, and next bot message generation. Only a single Guardrails application can be specified in the config option.
convert#
> nemoguardrails convert --help
Usage: nemoguardrails convert [OPTIONS] PATH
Convert a Colang 1.0 directory to Colang 2.0.
Arguments:
path TEXT The path to the file or directory to migrate. [default: None] [required]
Options:
--verbose --no-verbose If the migration should be verbose and output detailed logs. [default: no-verbose]
--validate --no-validate If the migration should validate the output using Colang Parser. [default: no-validate]
--use-active-decorator --no-use-active-decorator If the migration should use the active decorator. [default: use-active-decorator]
--help Show this message and exit.