Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated Snowflake LLMs and deprecated Streamlit function in current quickstart #1843

Open
wants to merge 18 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ Now that Fivetran landed the structured dataset into tables in Snowflake, it's t
/** Create the vector table from the wine review single field table **/
CREATE or REPLACE TABLE vineyard_data_vectors AS
SELECT winery_or_vineyard, winery_information,
snowflake.cortex.EMBED_TEXT_768('e5-base-v2', winery_information) as WINERY_EMBEDDING
snowflake.cortex.EMBED_TEXT_1024('snowflake-arctic-embed-l-v2.0', winery_information) as WINERY_EMBEDDING
FROM vineyard_data_single_string;


Expand Down Expand Up @@ -281,15 +281,17 @@ import time

# Change this list as needed to add/remove model capabilities.
MODELS = [
"gemma-7b",
"llama3.2-3b",
"claude-3-5-sonnet",
"mistral-large2",
"llama3.1-8b",
"llama3.1-405b",
"llama3.1-70b",
"mistral-7b",
"jamba-1.5-large",
"mixtral-8x7b",
"reka-flash",
"jamba-instruct",
"snowflake-arctic",
"llama3.1-70b",
"mistral-large2",
"llama3.1-405b"
"gemma-7b"
]

# Change this value to control the number of tokens you allow the user to change to control RAG context. In
Expand Down Expand Up @@ -320,7 +322,7 @@ def build_layout():
with and powered by Fivetran, Snowflake, Streamlit, and Cortex** and I use a custom, structured dataset!""")
st.caption("""Let me help plan your trip to California wine country. Using the dataset you just moved into the Snowflake Data
Cloud with Fivetran, I'll assist you with winery and vineyard information and provide visit recommendations from numerous
models available in Snowflake Cortex (including Snowflake Arctic). You can even pick the model you want to use or try out
models available in Snowflake Cortex (including Claude 3.5 Sonnet). You can even pick the model you want to use or try out
all the models. The dataset includes over **700 wineries and vineyards** across all CA wine-producing regions including the
North Coast, Central Coast, Central Valley, South Coast and various AVAs sub-AVAs. Let's get started!""")
user_question_placeholder = "Message your personal CA Wine Country Visit Assistant..."
Expand All @@ -330,7 +332,7 @@ def build_layout():
if st.button('Reset conversation', key='reset_conversation_button'):
st.session_state.conversation_state = []
st.session_state.reset_key += 1
st.experimental_rerun()
st.rerun()
processing_placeholder = st.empty()
question = st.text_input("", placeholder=user_question_placeholder, key=f"text_input_{st.session_state.reset_key}",
label_visibility="collapsed")
Expand All @@ -344,7 +346,7 @@ def build_layout():
st.selectbox("Select number of context chunks:", CHUNK_NUMBER, key="num_retrieved_chunks", help="""Adjust based on the
expected number of records/chunks of your data to be sent with the prompt before Cortext calls the LLM.""", index=1)
st.sidebar.caption("""I use **Snowflake Cortex** which provides instant access to industry-leading large language models (LLMs),
including **Snowflake Arctic**, trained by researchers at companies like Mistral, Meta, Google, Reka, and Snowflake.\n\nCortex
including Claude, Llama, and Snowflake Arctic that have been trained by researchers at companies like Anthropic, Meta, Mistral, Google, Reka, and Snowflake.\n\nCortex
also offers models that Snowflake has fine-tuned for specific use cases. Since these LLMs are fully hosted and managed by
Snowflake, using them requires no setup. My data stays within Snowflake, giving me the performance, scalability, and governance
you expect.""")
Expand Down Expand Up @@ -372,7 +374,7 @@ def build_prompt (question):
context_cmd = f"""
with context_cte as
(select winery_or_vineyard, winery_information as winery_chunk, vector_cosine_similarity(winery_embedding,
snowflake.cortex.embed_text_768('e5-base-v2', ?)) as v_sim
snowflake.cortex.embed_text_1024('snowflake-arctic-embed-l-v2.0', ?)) as v_sim
from vineyard_data_vectors
having v_sim > 0
order by v_sim desc
Expand Down