Giter Site home page Giter Site logo

snowflake-na-cortex's Introduction

snowflake-na-cortex

Demo on how to use cortex LLM function with native apps to build Gen AI apps

Steps

This demo has the steps to use cortex LLM functions in a Native App and code_schema.load_data SP is using the cortex llm functions. Run the below commands from SQL Worksheet.

use role accountadmin;


GRANT CREATE APPLICATION PACKAGE ON ACCOUNT TO ROLE SPCS_PSE_ROLE;
GRANT CREATE APPLICATION ON ACCOUNT TO ROLE SPCS_PSE_ROLE;
GRANT CREATE INTEGRATION ON ACCOUNT TO ROLE SPCS_PSE_ROLE;

USE ROLE SPCS_PSE_ROLE;

-- drop INTEGRATION tutorial_integration;

CREATE SECURITY INTEGRATION IF NOT EXISTS streamlit_integration
  TYPE=oauth
  OAUTH_CLIENT=snowservices_ingress
  ENABLED=true;

  show INTEGRATIONs;


-- drop application package pr_streamlit_package;

CREATE APPLICATION PACKAGE pr_cortex_na_package;

USE DATABASE pr_cortex_na_package;

-- Upload all the files required for the native app in following folder
LIST @pr_call_centre_analytics_db.public.na_stage/streamlit/v01/;

-- Below screenshot has the files uploaded

alt text

show application packages like 'pr%';

-- Check the package version after uploading the files
 SHOW VERSIONS IN APPLICATION PACKAGE pr_cortex_na_package;

-- Adding version to the package
ALTER APPLICATION PACKAGE pr_cortex_na_package
  ADD VERSION "v1_0"
  USING @pr_call_centre_analytics_db.public.na_stage/streamlit/v01;

-- Creating App from the package
CREATE APPLICATION pr_call_centre_analytics_app
  FROM APPLICATION PACKAGE pr_cortex_na_package
  USING VERSION "v1_0";

DESC APPLICATION pr_call_centre_analytics_app;

-- Grant the below permission to the app. This is required to use cortex LLM functions
GRANT IMPORTED PRIVILEGES ON DATABASE SNOWFLAKE TO APPLICATION pr_call_centre_analytics_app

Invoked the SP to copy data and load data into required tables in the app

-- There should be no files
 ls @pr_call_centre_analytics_app.app_public.data_stage;

 -- Loads the data in required tables. This fuctions uses the cortex LLM fucntions
 CALL pr_call_centre_analytics_app.code_schema.load_data();

Validating the loaded tables

SELECT * FROM  pr_call_centre_analytics_app.app_public.All_Claims_raw;

SELECT * FROM pr_call_centre_analytics_app.app_public.TRANSCRIPT_INFO_EXTRACTED_QA;

SELECT * FROM  pr_call_centre_analytics_app.app_public.AUDIO_CLAIMS_EXTRACTED_INFO;

alt text

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.