snow cortex summarize¶
总结给定的英语输入文本。
语法¶
snow cortex summarize
<text>
--file <file>
--connection <connection>
--host <host>
--port <port>
--account <account>
--user <user>
--password <password>
--authenticator <authenticator>
--private-key-file <private_key_file>
--token-file-path <token_file_path>
--database <database>
--schema <schema>
--role <role>
--warehouse <warehouse>
--temporary-connection
--mfa-passcode <mfa_passcode>
--enable-diag
--diag-log-path <diag_log_path>
--diag-allowlist-path <diag_allowlist_path>
--format <format>
--verbose
--debug
--silent
实参¶
text
包含应据此生成摘要的英文文本的字符串。不能与 --file 选项结合使用。
选项¶
--file FILE
包含应据此生成摘要的英文文本的文件。不能与 TEXT 实参结合使用。
--connection, -c, --environment TEXT
连接名称,如您在
config.toml
文件中所定义。默认值:default
。--host TEXT
连接的主机地址。替换为连接指定的值。
--port INTEGER
连接的端口。替换为连接指定的值。
--account, --accountname TEXT
分配给 Snowflake 账户的名称。替换为连接指定的值。
--user, --username TEXT
连接到 Snowflake 的用户名。替换为连接指定的值。
--password TEXT
Snowflake 密码。替换为连接指定的值。
--authenticator TEXT
Snowflake 身份验证器。替换为连接指定的值。
--private-key-file, --private-key-path TEXT
Snowflake 私钥文件路径。替换为连接指定的值。
--token-file-path TEXT
连接到 Snowflake 时应使用的带有 OAuth 令牌的文件路径。
--database, --dbname TEXT
要使用的数据库。替换为连接指定的值。
--schema, --schemaname TEXT
要使用的数据库架构。替换为连接指定的值。
--role, --rolename TEXT
要使用的角色。替换为连接指定的值。
--warehouse TEXT
要使用的仓库。替换为连接指定的值。
--temporary-connection, -x
使用用命令行参数定义的连接,而不是在配置中定义的连接。默认值:False。
--mfa-passcode TEXT
用于多重身份验证的令牌 (MFA)。
--enable-diag
运行 Python 连接器诊断测试。默认值:False。
--diag-log-path TEXT
诊断报告路径。默认:<temporary_directory>。
--diag-allowlist-path TEXT
可选允许列表的诊断报告路径。
--format [TABLE|JSON]
指定输出格式。默认:TABLE。
--verbose, -v
显示日志级别
info
及更高级别的日志条目。默认值:False。--debug
显示日志级别
debug
及更高级别的日志条目;调试日志包含其他信息。默认值:False。--silent
关闭到控制台的中间输出。默认值:False。
--help
显示此命令的帮助文本。
使用说明¶
无。
示例¶
汇总命令行提供的文本。
snow cortex summarize "John has a car. John's car is blue. John's car is old and John is thinking about buying a new car. There are a lot of cars to choose from and John cannot sleep because it's an important decision for John."
John has an old blue car and is considering buying a new one due to the many options available, causing him sleepless nights.
汇总存储在文件中的文本。
对于此示例,假设文件
about_cortex.txt
包含以下内容:Snowflake Cortex gives you instant access to industry-leading large language models (LLMs) trained by researchers at companies like Mistral, Reka, Meta, and Google, including Snowflake Arctic, an open enterprise-grade model developed by Snowflake. Since these LLMs are fully hosted and managed by Snowflake, using them requires no setup. Your data stays within Snowflake, giving you the performance, scalability, and governance you expect. Snowflake Cortex features are provided as SQL functions and are also available in Python. The available functions are summarized below. COMPLETE: Given a prompt, returns a response that completes the prompt. This function accepts either a single prompt or a conversation with multiple prompts and responses. EMBED_TEXT_768: Given a piece of text, returns a vector embedding that represents that text. EXTRACT_ANSWER: Given a question and unstructured data, returns the answer to the question if it can be found in the data. SENTIMENT: Returns a sentiment score, from -1 to 1, representing the detected positive or negative sentiment of the given text. SUMMARIZE: Returns a summary of the given text. TRANSLATE: Translates given text from any supported language to any other.
输入文件名,执行 snow cortex 命令,如下所示:
snow cortex summarize --file about_cortex.txt
Snowflake Cortex offers instant access to industry-leading language models, including Snowflake Arctic, with SQL functions for completing prompts (COMPLETE), text embedding (EMBED\_TEXT\_768), extracting answers (EXTRACT\_ANSWER), sentiment analysis (SENTIMENT), summarizing text (SUMMARIZE), and translating text (TRANSLATE).