Format documents from Snowflake Cortex Search for RAG usage.
This function extracts content from Cortex Search documents and formats them into a single string suitable for use as context in RAG applications.
Bind MCP tools to a ChatSnowflake instance.
This function filters MCP tools for compatibility, converts them to LangChain Tools, and binds them to the provided LLM using bind_tools().
Convert an MCP tool to a LangChain Tool.
Filter MCP tools based on compatibility and patterns.
Create a Snowflake session from environment variables.
Expected environment variables:
Create a Snowflake session from a connection string in environment variables.
Reads connection string from SNOWFLAKE_CONNECTION_STRING environment variable. Supports environment variable substitution using ${VARIABLE_NAME} syntax.
Required environment variable:
Example connection string with environment variable substitution: SNOWFLAKE_CONNECTION_STRING="snowflake://${SNOWFLAKE_USER}:${SNOWFLAKE_PASSWORD}@${SNOWFLAKE_ACCOUNT}/${SNOWFLAKE_DATABASE}/${SNOWFLAKE_SCHEMA}?warehouse=${SNOWFLAKE_WAREHOUSE}"
Create a Snowflake session using Personal Access Token (PAT) from environment variables.
Reads all credentials from environment variables:
Create a Snowflake session using RSA key pair authentication from environment variables.
Reads all credentials from environment variables:
Get a default Snowflake session with smart fallback strategy.
Tries to create a session in the following priority order:
All methods read from the same SNOWFLAKE_* environment variables.
Centralized Snowflake session creation and management.
Centralized error handling for Snowflake integrations.
Centralized validation utilities for Snowflake integrations.
Input schema for creating Cortex Agents.
Input schema for updating Cortex Agents.
Enhanced input schema for agent execution with all parameters.
Input schema for agent feedback submission following official API specification.
Output schema for feedback operations following official API response.
Snowflake Cortex Agent integration with thread management and feedback.
This class provides access to Snowflake's Cortex Agents REST API, enabling managed orchestration of multiple tools with conversation management.
Input schema for updating threads.
Snowflake chat model integration using Cortex LLM functions.
This class provides access to Snowflake's Cortex Complete function with models like llama3.1-70b, mistral-large2, claude-3-5-sonnet, and more.
Wrapper to make MCP tools compatible with LangChain's tool interface.
This wrapper handles the conversion between LangChain's tool calling format and MCP's tool execution format, ensuring seamless integration.
Snowflake Cortex Search retriever using REST API exclusively.
This retriever integrates with Snowflake's Cortex Search service exclusively through the REST API. Cortex Search is a managed service that provides enterprise-grade semantic search capabilities.
Note: This retriever uses Cortex Search, which is different from Search Preview. Cortex Search only supports REST API access, not SQL functions.
Generate text completions using Snowflake Cortex COMPLETE function.
Analyze sentiment using Snowflake Cortex SENTIMENT function.
Summarize text using Snowflake Cortex SUMMARIZE function.
Translate text using Snowflake Cortex TRANSLATE function.
Snowflake Cortex Analyst integration for Text2SQL.
Cortex Analyst is Snowflake's AI-powered tool that converts natural language questions into SQL queries and executes them against your Snowflake data.
Execute SQL queries on Snowflake.
This tool allows execution of SQL queries against a Snowflake database and returns the results in a formatted manner.
MCP Integration for langchain-snowflake
Provides utilities to integrate Model Context Protocol (MCP) tools with ChatSnowflake's bind_tools() functionality.
Document formatters for Snowflake-specific data structures.
This module provides utilities for formatting documents retrieved from various Snowflake services for optimal use in RAG (Retrieval-Augmented Generation) chains.
Snowflake retrievers using Cortex Search.
Snowflake Cortex Agents integration.
This module provides integration with Snowflake's Cortex Agents REST API, enabling managed orchestration of multiple tools and conversation management.
Key Features:
Snowflake tools for LangChain integration.
This module provides specialized tools for integrating with Snowflake's Cortex AI functions and database querying capabilities.
The tools are now organized into logical modules:
Snowflake chat models package.
This package provides a modular implementation of the ChatSnowflake class following LangChain partner package best practices.