"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Setup\n",
+ "\n",
+ "### Prerequisites\n",
+ "\n",
+ "- A [Snowflake account](https://signup.snowflake.com/) with Cortex LLM access enabled\n",
+ "- A Snowflake [Programmatic Access Token (PAT)](https://docs.snowflake.com/en/user-guide/programmatic-access-tokens) or key-pair authentication\n",
+ "- A [Langfuse](https://cloud.langfuse.com) project with API keys\n",
+ "\n",
+ "### Install Required Packages"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "%pip install langfuse openai --upgrade"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### Set Environment Variables\n",
+ "\n",
+ "Configure your Langfuse and Snowflake credentials. Get your Langfuse keys from the [project settings page](https://cloud.langfuse.com)."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "import os\n",
+ "\n",
+ "os.environ[\"LANGFUSE_PUBLIC_KEY\"] = \"pk-lf-...\"\n",
+ "os.environ[\"LANGFUSE_SECRET_KEY\"] = \"sk-lf-...\"\n",
+ "os.environ[\"LANGFUSE_BASE_URL\"] = \"https://cloud.langfuse.com\" # \ud83c\uddea\ud83c\uddfa EU region\n",
+ "# os.environ[\"LANGFUSE_BASE_URL\"] = \"https://us.cloud.langfuse.com\" # \ud83c\uddfa\ud83c\uddf8 US region\n",
+ "\n",
+ "SNOWFLAKE_ACCOUNT = \"