banner

Welcome to the Powered by Tasty Bytes - Enhance Customer Experience Streamlit App Quickstart!

This application supports Tasty Bytes management by analyzing both customer reviews and food truck inspections, streamlining communication with truck owners to improve the overall customer experience. By leveraging Cortex functions, it conducts sentiment analysis to assist in drafting emails for owners. Moreover, it includes built-in analytics for users to interact with review data and generate plots using LLM capabilities. Additionally, the integration of Document AI enhances its analytical prowess by extracting insights from handwritten, unstructured inspection documents.

What You'll Learn

What You'll Need

What You'll Build

Step 1 - Accessing hosted Setup SQL in GitHub

setup.sql

Step 2 - Run the contents of setup.sql

Open a new Snowsight worksheet and run all commands from setup.sql.

Step 3 - Load Streamlit Files

stage-location

pages-folder

streamlit-files

Step 4 - Create the Streamlit App

Run the code below in a Snowsight worksheet to build the Streamlit app.

USE ROLE sysadmin;

CREATE OR REPLACE STREAMLIT tasty_bytes_enhancing_customer_experience.app.enhancing_customer_experience_app
ROOT_LOCATION = '@tasty_bytes_enhancing_customer_experience.app.enhance_customer_experience_app'
MAIN_FILE = 'Dashboard.py'
QUERY_WAREHOUSE = 'tasty_bytes_enhancing_customer_experience_wh';

GRANT USAGE ON STREAMLIT tasty_bytes_enhancing_customer_experience.app.enhancing_customer_experience_app TO ROLE enhancing_customer_expereience_role;

Step 5 - Open the Streamlit App

This application consists of two sections. The dashboard presents reviews and inspection details for each truck, while the analytics section offers the ability to generate plots based on review data.

truck-overview

truck-inspections

truck-email

sentiment-graph

Cortex Complete

Cortex complete generates a response (completion) to a prompt using your choice of supported language model. In the Enhancing Customer Experience App, we use Cortex Complete to generate emails and build custom analytics graphs. You can read more documentation here.

Generate Email Responses

We generate emails to truck owners using Cortex Complete. We pass the prompt and model (mistral-large) to Cortex complete to automatically generate an email based on inspection issues at their truck.

prompt =f"""[INST]### Write me survey report email to the franchise owner summarizing the issues mentioned in following 
            aggregated customer reviews and inspections with three concise bullet points under 50 words each such that each bullet 
            point also has a heading along with recommendations to remedy those issues. Negative Reviews Category:
            {negative_review_categories}. Inspection Reports Category: {negative_inspection_categories}[/INST]"""
email_suggestion = Complete('mistral-large', prompt.replace("'", "''"))

Create Analytics Graphs

We again use Cortex Complete to create custom analytics graphs. We later use code to build analytics based on our own Tasty Bytes data.

prompt = f'You are a python developer that writes code using altair and streamlit to visualize data. \
            Your data input is a pandas dataframe that you can access with df. \
            The pandas dataframe has the following columns: {column_specifications}.\
            {prompt}\
            If you are asked to return a list, create a dataframe and use st.dataframe() to display the dataframe.'
code = Complete('mistral-large', prompt.replace("'", "''"))

DocumentAI

Unstructured inspection documents are used in the app. We have previously used DocumentAI to structure the contents of inspection reports and use that data for insights. Check out the Extracting Insights from Unstructured Data with Document AI Quickstart for details on that process.

Congratulations, you have built an application in Streamlit using Cortex LLMs to enhance Tasty Bytes customer experience. This powerful application helps Tasty Bytes owners quickly understand truck metrics, including unstructured inspection data. We also used Cortex LLMs to generate emails to truck owners based on that unstructured data.

If you want to learn more about Enhancing Customer Experience with Tasty Bytes, check out the quickstarts in the resources section.

What You Learned

Related Resources