Trying the Langchain notebook integration and will keep building this up. In this example we will be using Two quickstarty add langchain integration
-
Integrarating langchain at Step 4 Stremlit App
Step 1 - Lets create the conda env
conda create -n snowflake-langchain python=3.10
conda activate snowflake-langchain
Step 2
pip install -r requirements.txt
step 3
cp connect.json snow_connect.json
cp connect.json langchain_cs.json
step 4
snow_connect.json-- Parameters please update your id/password
{
"account": "xxxx",
"user": "xxxx",
"password": "xxxx",
"role": "ACCOUNTADMIN",
"warehouse": "cortex_search_tutorial_wh",
"database": "cortex_search_tutorial_db",
"schema": "public",
"client_session_keep_alive": "True"
}
if you don't have WH configured
CREATE OR REPLACE WAREHOUSE cortex_search_tutorial_wh WITH
WAREHOUSE_SIZE='X-SMALL'
AUTO_SUSPEND = 120
AUTO_RESUME = TRUE
INITIALLY_SUSPENDED=TRUE;```
langchain_cs.json-- Parameters please update youer id/password
{
"account": "xxxx",
"user": "xxxx",
"password": "xxxx",
"role": "ACCOUNTADMIN",
"warehouse": "cortex_search_tutorial_wh",
"database": "CC_QUICKSTART_CORTEX_SEARCH_DOCS",
"schema": "DATA",
"client_session_keep_alive": "True"
}
step 5 Run For Quickstart-Cortex Search Stremlit app
USe this Sreamlit App on your local env with langchain
step 6 to run For Quickstart-Cortex RAG LLM
USe this Sreamlit App on your local env with langchain
Optional - Connecting Cortex https://pypi.org/project/langchain-snowflake/ from local env
## In your directory
touch .env
### In env file
LANGCHAIN_API_KEY="XXXXXX"
LANGCHAIN_PROJECT="Cortex-langchainintegration"
SNOWFLAKE_ACCOUNT=XXXXX
SNOWFLAKE_USERNAME=XXXX
SNOWFLAKE_PASSWORD=XXXXX
SNOWFLAKE_DATABASE=XXXXX
SNOWFLAKE_SCHEMA=XXXXX
SNOWFLAKE_WAREHOUSE=XXXXX
SNOWFLAKE_ROLE=XXXXX