Feat/snowflake cortex rest API integration#2864
Open
navnitshukla wants to merge 7 commits intolangfuse:mainfrom
Open
Feat/snowflake cortex rest API integration#2864navnitshukla wants to merge 7 commits intolangfuse:mainfrom
navnitshukla wants to merge 7 commits intolangfuse:mainfrom
Conversation
The Jupyter notebook demonstrates: - Simple chat completion with Cortex via `langfuse.openai.OpenAI` - Nested traces with `@observe()` (multi-step document analysis) - Custom metadata via `propagate_attributes` - Streaming responses
|
@Nav25oct is attempting to deploy a commit to the langfuse Team on Vercel. A member of the Team first needs to authorize it. |
|
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
….mdx Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
|
Hi team 👋 — friendly follow-up on this PR. I've addressed the JSON issues flagged by Greptile (missing commas in The Vercel preview is pending authorization from a team member. Would someone be able to authorize the deployment and give this a review when you get a chance? Happy to make any additional changes if needed. Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add Snowflake Cortex as a Model Provider Integration
Summary
langfuse.openai)AnthropicInstrumentor(OpenTelemetry) with the native Anthropic SDKFiles Added
cookbook/integration_snowflake_cortex_rest_api.ipynb— Example notebook with 6 examples (4 Chat Completions + 2 Messages API)content/integrations/model-providers/snowflake-cortex-rest-api.mdx— Integration docs pagepublic/images/integrations/snowflake_cortex_icon.svg— LogoFiles Modified
content/integrations/model-providers/meta.json— Added"snowflake-cortex-rest-api"to page listcookbook/_routes.json— Route mapping for cookbookHow It Works
Chat Completions API (all models):
Snowflake Cortex exposes an OpenAI-compatible endpoint at:
https://<account>.snowflakecomputing.com/api/v2/cortex/v1The existing
from langfuse.openai import OpenAIwrapper works out of the box — just pointbase_urlto Cortex and use a Snowflake PAT as the API key.Messages API (Claude models only):
Snowflake Cortex exposes an Anthropic-compatible endpoint at:
https://<account>.snowflakecomputing.com/api/v2/cortex/v1/messagesUses the native
anthropic.Anthropicclient withAnthropicInstrumentorfromopentelemetry-instrumentation-anthropic. Requireshttpxto override auth header (Snowflake expectsBearertoken, notx-api-key).For a detailed walkthrough of all authentication methods, see: You Have Three Options to Authenticate to the Cortex REST API
Testing
claude-sonnet-4-5,mistral-large2,openai-gpt-4.1,deepseek-r1,llama4-maverick, andsnowflake-llama-3.3-70bclaude-sonnet-4-5(simple call + multi-turn conversation)@observe(), custom metadata, streaming)Disclaimer: Experimental PR review
Greptile Summary
This PR adds a Snowflake Cortex REST API integration to Langfuse docs, including a new MDX page, a 6-example Jupyter notebook, and a Snowflake logo SVG. There are two invalid-JSON issues blocking the build, and a logo path mismatch that will render a broken image.
meta.jsonand_routes.jsonare both missing commas in the newly added entries, making them invalid JSON and breaking site navigation/routing.snowflake_cortex_icon.svgbut the file actually added issnowflake-logo.svg, resulting in a broken sidebar logo.Confidence Score: 2/5
Not safe to merge — two invalid-JSON files will break site build/routing.
Two P0 syntax errors (missing commas in meta.json and _routes.json) make both config files unparseable, plus a P1 logo path mismatch. These need to be fixed before merging.
content/integrations/model-providers/meta.json and cookbook/_routes.json (invalid JSON); content/integrations/model-providers/snowflake-cortex-rest-api.mdx (wrong logo path).
Important Files Changed
Sequence Diagram
sequenceDiagram participant User participant LangfuseWrapper as langfuse.openai / AnthropicInstrumentor participant CortexChatAPI as Snowflake Cortex (Chat Completions) participant CortexMsgAPI as Snowflake Cortex (Messages API) participant Langfuse as Langfuse Platform Note over User,Langfuse: Chat Completions API (all models) User->>LangfuseWrapper: client.chat.completions.create(model, messages) LangfuseWrapper->>CortexChatAPI: POST /api/v2/cortex/v1/chat/completions (Bearer PAT) CortexChatAPI-->>LangfuseWrapper: completion response LangfuseWrapper-->>User: response LangfuseWrapper->>Langfuse: trace (model, tokens, latency) Note over User,Langfuse: Messages API (Claude models only) User->>LangfuseWrapper: anthropic_client.messages.create(model, messages) LangfuseWrapper->>CortexMsgAPI: POST /api/v2/cortex/v1/messages (Authorization: Bearer PAT) CortexMsgAPI-->>LangfuseWrapper: message response LangfuseWrapper-->>User: response LangfuseWrapper->>Langfuse: OTel span (via AnthropicInstrumentor)Prompt To Fix All With AI
Reviews (1): Last reviewed commit: "Update _routes.json" | Re-trigger Greptile