Snowflake Cortex-Driven Toolbox

Having access to LLMs in Snowflake is a game changer, and using them on a daily basis has become normal. Having LLM-driven tools within reach helps me be more productive and efficient, especially when working with complex code and a short timeline.

My Toolbox

I created this toolbox to have a ready-to-go chatbot and to have some dedicated sections for Code Formatting and Code Explanation within my reach. This toolbox is a simple Streamlit-in-Snowflake application that leverages the Snowpark-ML-Python library for access to the Cortex function Complete . This toolbox consists of three workflows: a simple Chatbot, a Code explanation tool, and a Code Re-Formatting tool. All of these workflows leverage Cortext.Complete LLM function with variations on the prompts.

Packages needed:
- streamlit
- snowflake-ml-python
- snowflake-snowpark-python

Chatbot

Here you can simply ask questions. You can create your own prompts and be as specific as needed using the st.chat_input widget.

Explain

This is where you can obtain a detailed explanation of your code, including Explanation, Breakdown and Output.

Format

This workflow is intended to provide Formatting to almost any script. Before submitting your prompt, you can specify either to Auto-Detect language or to specify a language for more accurate formatting.

The Code

Here is the code for this app. I hope you can implement it and make it you own. You can also access the GitHub GIST directly here.

⚠️ I am using reka-flash LLM which might not be available in all regions. Please change the model constant to an LLM available in your region.

--

--

Carlos D Serrano
Snowflake Builders Blog: Data Engineers, App Developers, AI/ML, & Data Science

Sr. Solution Innovation Architect @ Snowflake • Streamlit • DataOps • Hispanic Data Community Leader • 🇵🇷 ▶️ 🇺🇸