GitHub - KranzL/Jevflake: Ask TypeSafe's Jev decision model questions about your data from inside Snowflake. dbt package plus a Terraform module.

Open the original

Short summary

Jevflake is a dbt package that lets you query Snowflake data using TypeSafe AI's Jev decision model, which returns typed answers (yes/no probabilities, category picks, or scored ratings) that you can filter and join like regular SQL. It handles API setup, creates SQL functions, and manages answer caching so you don't re-query the same data.

  • Jev returns structured answers (probabilities for yes/no, picks with confidence for categories, weighted scores for ratings) rather than text, making answers usable directly in SQL operations
  • The package stores answers in an incremental table keyed by row ID and question, so rows are only sent to the API again if their content changes or you modify the questions
  • Setup splits between admin (network/integration) and dbt role (function creation), requiring Snowflake external access enabled and a TypeSafe API key

Full summary

Jevflake is a dbt package that integrates Snowflake with Jev, a decision model from TypeSafe AI. Instead of generating text, Jev takes a row of data and a typed question, then returns a typed answer with a probability — making it well-suited for SQL operations where you can filter, join, and test the results. The package handles three setup tasks: configuring Snowflake to call the Jev API, creating four SQL functions (jev_noul for yes/no questions, jev_choice for picking from options, jev_score for rating against ordered levels, and jev_ask for batching multiple questions), and providing dbt macros to store and reuse answers. A Terraform module exists for teams managing Snowflake that way, though this project isn't officially affiliated with TypeSafe AI, Snowflake, or dbt Labs. Getting started requires a Snowflake account with external access enabled (not default on trial accounts), a role that can create integrations, a TypeSafe API key, and dbt 1.8 or newer. You create a secret to store the API key, add the package to your dbt_packages.yml, then run a setup operation that creates a network rule restricting traffic to api.typesafe.ai, an external access integration, the SQL functions, and grants permissions to specified roles. The setup can be split between an admin and a dbt role, and you can run it multiple times if settings change. The three function types return different structures — noul gives a 0-to-1 probability, choice returns the pick with per-option probabilities and confidence, and score returns a weighted average score with probabilities and confidence. The recommended approach stores answers in an incremental table using the jevflake.judgments macro, which only re-sends rows to Jev if their content changes or you modify the questions. You define which columns Jev reads (only what's needed for accuracy), specify a unique key like ticket_id, and map out your questions with their criteria. Individual SQL functions let you query Jev directly in select statements, while jev_ask batches multiple questions into one API call per row, cutting costs and latency when you need several answers about the same data.

Ask about this article