0% found this document useful (0 votes)
96 views

chatGPT Streamlit in Snowflake

This document discusses building a Streamlit application using Streamlit in Snowflake to chat with ChatGPT. It describes setting up the necessary Snowflake and Streamlit objects, the 5W1H method for structuring prompts, creating a UDF to call the OpenAI API, and building the Streamlit app to collect user input and display ChatGPT responses.

Uploaded by

Avinash Reddy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
96 views

chatGPT Streamlit in Snowflake

This document discusses building a Streamlit application using Streamlit in Snowflake to chat with ChatGPT. It describes setting up the necessary Snowflake and Streamlit objects, the 5W1H method for structuring prompts, creating a UDF to call the OpenAI API, and building the Streamlit app to collect user input and display ChatGPT responses.

Uploaded by

Avinash Reddy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Daan Bakboord

Ask ChatGPT Anything


Using the Open AI API & Streamlit in Snowflake
Ask ChatGPT Anything
Using the Open AI API & Streamlit

Streamlit Application
using Streamlit in Snowflake to chat with ChatGPT. Building ChatGPT prompts
using the 5W1H Method.

ChatGPT
OpenAI API
5W1H Method
Streamlit in Snowflake
Setup Streamlit
Streamlit Snowflake objects
Streamlit Application objects
Streamlit Application
5W1H Method

Who?
Understanding "who" can help in tailoring the language and complexity of
the response.
What?
Specifying "what" ensures that the AI provides the type and format of
information you desire.
Where?
Defining "where" can help in receiving region or context-specific answers.
Why?
Knowing "why" can help in determining the depth and angle of the AI's
response.
When?
Framing "when" can help narrow down the context of the information
provided.
How?
Clarifying "how" can guide the AI in structuring its answer in the most
useful way.
Streamlit in Snowflake objects

Create Streamlit User


Create Streamlit Role
Create Streamlit Warehouse
Create Streamlit Database
Create Streamlit Schema
Create Streamlit Stage
Grants on Streamlit Snowflake objects
e.g. Grant STREAMLIT on Schema
Setup OpenAI (External Network
Integration)
Generate OpenAI API Key
Add Environment Variable
OPENAI_API_KEY

Create the Get OpenAI Response UDF


Create a network rule
Create a secret
Create an external access integration
Create the UDF
Building the Streamlit Application
Import required packages
Streamlit
Snowpark
OpenAI model Engine
Page configuration
Sidebar configuration (optional)
Create Main Application
Collecting user input according to the 5W1H Method
Sending user input to ChatGPT function
Submit the prompt_output to the 'Get OpenAI Output'-UDF
Return the chat response
Display the ChatGPT response
Setup Streamlit in Snowflake
Create Streamlit App
Snowsight UI
Snowsight SQL
Upload files to Stage
Streamlit Application file
Environment.yml
Want to discuss further?

Daan Bakboord
contact@daanalytics.nl
+31636571553

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy