Files
promptfoo--promptfoo/site/docs/providers/snowflake.md
T
wehub-resource-sync 0d3cb498a3
CI / Shell Format Check (push) Has been cancelled
CI / Check Ruby (3.4) (push) Has been cancelled
CI / CI Config (push) Has been cancelled
CI / Test on Node ${{ matrix.node }} and ${{ matrix.os }}${{ matrix.shard && format(' (shard {0}/3)', matrix.shard) || '' }} (push) Has been cancelled
CI / Build on Node ${{ matrix.node }} (push) Has been cancelled
CI / Style Check (push) Has been cancelled
CI / Generate Assets (push) Has been cancelled
CI / Check Python (3.14) (push) Has been cancelled
CI / Check Python (3.9) (push) Has been cancelled
CI / Build Docs (push) Has been cancelled
CI / Code Scan Action (push) Has been cancelled
CI / Site tests (push) Has been cancelled
CI / webui tests (push) Has been cancelled
CI / Run Integration Tests (push) Has been cancelled
CI / Run Smoke Tests (push) Has been cancelled
CI / Go Tests (push) Has been cancelled
CI / Share Test (push) Has been cancelled
CI / Redteam (Production API) (push) Has been cancelled
CI / Redteam (Staging API) (push) Has been cancelled
CI / GitHub Actions Lint (push) Has been cancelled
CI / Check Ruby (3.0) (push) Has been cancelled
release-please / release-please (push) Has been cancelled
release-please / build (push) Has been cancelled
release-please / publish-npm (push) Has been cancelled
release-please / publish-npm-backfill (push) Has been cancelled
release-please / docker (push) Has been cancelled
release-please / publish-code-scan-action (push) Has been cancelled
release-please / attest-code-scan-action (push) Has been cancelled
Deploy local.promptfoo.app / Deploy to Cloudflare Pages (push) Has been cancelled
Test and Publish Multi-arch Docker Image / test (push) Has been cancelled
Test and Publish Multi-arch Docker Image / build-docker-and-push-digests (map[digest-suffix:linux-amd64 platform:linux/amd64 runner:ubuntu-latest]) (push) Has been cancelled
Test and Publish Multi-arch Docker Image / build-docker-and-push-digests (map[digest-suffix:linux-arm64 platform:linux/arm64 runner:ubuntu-24.04-arm]) (push) Has been cancelled
Test and Publish Multi-arch Docker Image / merge-docker-digests (push) Has been cancelled
Test and Publish Multi-arch Docker Image / Attest Multi-arch Image (push) Has been cancelled
Validate Renovate Config / Validate Renovate Configuration (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 13:24:08 +08:00

134 lines
3.8 KiB
Markdown

---
sidebar_label: Snowflake Cortex
description: "Connect to AI models through Snowflake Cortex's OpenAI-compatible REST API with access to Claude, GPT, Mistral, and Llama models"
---
# Snowflake Cortex
[Snowflake Cortex](https://docs.snowflake.com/en/user-guide/snowflake-cortex/overview) is Snowflake's AI and ML platform that provides access to various LLM models through an [OpenAI-compatible](/docs/providers/openai/) REST API. Cortex offers industry-leading LLMs including Claude, GPT, Mistral, and Llama models without requiring a dedicated warehouse.
## Setup
1. Obtain your Snowflake account identifier (format: `orgname-accountname`)
2. Generate a bearer token (JWT, OAuth, or programmatic access token)
3. Ensure you have the `SNOWFLAKE.CORTEX_USER` database role
## Provider Format
The Snowflake Cortex provider uses this format:
- `snowflake:<model_name>` - Connects to Snowflake Cortex using the specified model name
## Configuration
### Basic Configuration
```yaml title="promptfooconfig.yaml"
# yaml-language-server: $schema=https://promptfoo.dev/config-schema.json
providers:
- id: snowflake:mistral-large2
config:
accountIdentifier: 'myorg-myaccount'
apiKey: 'your-bearer-token'
```
### With Environment Variables
Set your Snowflake credentials as environment variables:
```bash
export SNOWFLAKE_ACCOUNT_IDENTIFIER="myorg-myaccount"
export SNOWFLAKE_API_KEY="your-bearer-token"
```
Then use the provider without specifying credentials:
```yaml
providers:
- id: snowflake:mistral-large2
```
### With Additional Parameters
Snowflake Cortex supports OpenAI-compatible parameters:
```yaml
providers:
- id: snowflake:mistral-large2
config:
accountIdentifier: 'myorg-myaccount'
apiKey: 'your-bearer-token'
temperature: 0.7
max_tokens: 1024
top_p: 0.9
```
### Custom Base URL
Override the default base URL if needed:
```yaml
providers:
- id: snowflake:claude-3-5-sonnet
config:
apiBaseUrl: 'https://custom.snowflakecomputing.com'
apiKey: 'your-bearer-token'
```
## Features
Snowflake Cortex supports:
- **Tool Calling** - Function calling and tool use
- **Structured Output** - JSON schema validation
- **Streaming** - Real-time token streaming (via API)
- **Image Input** - Vision capabilities for select models
- **Content Filtering** - Built-in guardrails
- **Cross-Region Inference** - Models available across Snowflake regions
## Authentication
Authentication is handled via Bearer tokens in the Authorization header. Snowflake Cortex supports multiple token types:
- **JWT (JSON Web Token)** - Standard Snowflake authentication
- **OAuth tokens** - OAuth 2.0 authentication flow
- **Programmatic access tokens** - Service account tokens
## Example Configuration
```yaml title="promptfooconfig.yaml"
# yaml-language-server: $schema=https://promptfoo.dev/config-schema.json
description: 'Compare Snowflake Cortex models'
prompts:
- 'Explain {{topic}} in simple terms'
providers:
- id: snowflake:claude-3-5-sonnet
config:
temperature: 0.7
max_tokens: 1024
- id: snowflake:mistral-large2
config:
temperature: 0.7
max_tokens: 1024
- id: snowflake:llama-3.1-70b
config:
temperature: 0.7
max_tokens: 1024
tests:
- vars:
topic: quantum computing
assert:
- type: contains
value: quantum
```
## See Also
- [OpenAI Provider](/docs/providers/openai) - Compatible API format used by Snowflake Cortex
- [Configuration Reference](/docs/configuration/reference.md) - Full configuration options for providers
- [Snowflake Cortex Documentation](https://docs.snowflake.com/en/user-guide/snowflake-cortex/overview) - Official Cortex documentation
- [Snowflake Cortex REST API](https://docs.snowflake.com/en/user-guide/snowflake-cortex/cortex-rest-api) - REST API reference