Kasmo

Cortex Analyst: Simplifying Data Insights for Better Business Outcomes

cortex analyst

Introduction

In today’s data-driven world, business decisions hinge on the ability to extract actionable insights from vast troves of data. However, not everyone has the technical prowess to write complex SQL queries or understand intricate database schemas. This is where Cortex Analyst—a fully-managed, large language model (LLM)-powered feature within Snowflake Cortex—comes into play. Cortex Analyst enables business users to interact with their data using natural language, receiving accurate, real-time answers without needing to write a single line of code.

cortex analyst

What is Cortex Analyst? 

Cortex Analyst is designed to simplify the way businesses interact with their structured data in Snowflake. It allows users to ask questions in natural language, which are then translated into SQL queries by the LLM, providing instant answers from the data stored in Snowflake. This feature is not just a basic text-to-SQL converter; it’s a sophisticated system that understands the nuances of business language and processes, making it an invaluable tool for self-service analytics. 

Key Features of Cortex Analyst

Natural Language Querying 

It lets non-technical users ask questions using everyday language, transforming complex queries into SQL without manual intervention. 

Seamless Integration 

Available as a REST API, it can be easily integrated into existing business applications such as Streamlit apps, Slack, Teams, and custom chat interfaces, allowing for a smooth user experience. 

State-of-the-Art LLMs 

Powered by the latest Meta Llama and Mistral models, it runs securely within Snowflake Cortex. For users who need even more power, Azure-hosted OpenAI GPT models can be optionally enabled for enhanced performance. 

Semantic Model for Accuracy 

Unlike generic AI solutions, it uses a semantic model—a YAML file that describes your data in business terms—ensuring that the AI understands the context and nuances of your queries.

Security and Governance 

It integrates seamlessly with Snowflake’s robust security framework. All SQL queries generated by Cortex Analyst adhere to Snowflake’s role-based access control (RBAC) policies, ensuring that data access is tightly controlled and governed. Additionally, Cortex Analyst does not train on customer data, and all processing stays within Snowflake’s secure environment, unless you explicitly opt to use Azure OpenAI models. 

cortex analyst

Getting Started with Cortex Analyst 

Cortex Analyst is designed to be user-friendly, but it’s also powerful enough to handle complex queries. Here’s a quick guide to get you started: 

Step 1: Create a Semantic Model 

A semantic model bridges the gap between business terminology and database definitions. This model is defined in a YAML file, which includes additional semantic details about your dataset, making it easier for Cortex Analyst to interpret and answer queries accurately. Start with a list of questions your business users might ask, then define the necessary dataset in your semantic model. 

Step 2: Upload the Semantic Model 

You can upload the YAML file to a Snowflake stage or pass it as a string in your API requests. Ensure that the roles granted access to this stage also have SELECT access to the underlying tables referenced in the semantic model. 

Step 3: Deploy the Streamlit Application 

With the semantic model in place, you’re ready to deploy the Streamlit application. 

  1. Run the Streamlit App: Use the following command to launch the Streamlit application:

streamlit run app.py 

2. Interact with Your Data: The app will enable users to ask natural-language questions about the time-series revenue data. Cortex Analyst interprets these questions, generates SQL queries, executes them, and displays the results. 

cortex analyst

Workflow for answering a question 

Conclusion 

Cortex Analyst is a game-changer for businesses looking to empower their teams with self-service analytics. By leveraging the power of LLMs and Snowflake’s robust data platform, it makes it easier than ever to extract valuable insights from structured data. Whether you’re a business user seeking quick answers or a developer looking to integrate powerful analytics into your applications, Cortex Analyst offers a flexible, secure, and highly accurate solution. 

cortex analyst

Interested to learn more, talk to our experts