- Categories:
String & Binary Functions (Large Language Model)
EXTRACT_ANSWER (SNOWFLAKE.CORTEX)¶
Fully qualified name: SNOWFLAKE.CORTEX.EXTRACT_ANSWER
Extracts an answer to a given question from a text document. The document may be a plain-English document or a string representation of a semi-structured (JSON) data object.
Syntax¶
SNOWFLAKE.CORTEX.EXTRACT_ANSWER(
<source_document>, <question>)
Arguments¶
source_document
A string containing the plain-text or JSON document that contains the answer to the question.
question
A string containing the question to be answered.
Returns¶
A string containing an answer to the given question.
Access Control¶
Users must use a role that has been granted the SNOWFLAKE.CORTEX_USER database role. See Required Privileges for more information on granting this privilege.
Example¶
In this example, review_content
is a column from the reviews
table:. To extract an answer from each row
of the table:
SELECT SNOWFLAKE.CORTEX.EXTRACT_ANSWER(review_content,
'What dishes does this review mention?')
FROM reviews LIMIT 10;
Legal Notices¶
Snowflake Cortex LLM Functions are powered by machine learning technology, including Meta’s LLaMA 2 and Google’s Gemma 7B models.
The foundation LLaMA 2 model is licensed under the LLaMA 2 Community License and is Copyright (c) Meta Platforms, Inc. All Rights Reserved. Your use of any LLM Functions based on the LLama 2 model is subject to Meta’s Acceptable Use Policy.
The foundation Gemma 7B model is licensed under the Gemma Terms of Use, and use of it is subject to the Gemma Prohibited Use Policy.
Machine learning technology and results provided may be inaccurate, inappropriate, or biased. Decisions based on machine learning outputs, including those built into automatic pipelines, should have human oversight and review processes to ensure model-generated content is accurate.
LLM function queries are treated like any other SQL query and may be considered metadata.
For further information, see Snowflake AI Trust and Safety FAQ.