Snowflake Cortex Is Cool. I Built My Own in an Afternoon.
Summary
An editorial analyst successfully replicated Snowflake Cortex's AI completion functionality using open-source tools and a local large language model, achieving a zero-cost alternative for personal projects. The author details setting up a PostgreSQL database on a mini PC and running Ollama on a separate tower, then creating a `plpython3u` function to call the local Ollama instance. This setup allowed for tasks like classifying financial Altman Z-Scores, mirroring the "farm out judgment calls" workflow used professionally for vendor data cleanup. The original Snowflake Cortex feature proved effective for processing 90,000 records of Concur transactions in 90 minutes, a task that would have taken an intern days.
Key takeaway
For AI Engineers or data professionals seeking to replicate cloud-based AI features like Snowflake Cortex for personal projects or cost-sensitive environments, consider building a local solution. You can achieve similar functionality by integrating Ollama with PostgreSQL via `plpython3u`, enabling custom AI inference without incurring cloud costs. This approach is particularly useful for tasks involving data classification or judgment calls where data privacy or budget constraints are critical.
Key insights
Replicate cloud AI functions locally using open-source tools for cost-effective, private data processing.
Principles
- Local LLMs offer cost-free cloud feature replication.
- PostgreSQL's `plpython3u` enables custom AI integrations.
Method
Install Ollama, configure it to listen on a network port, then create a PostgreSQL `plpython3u` function to send prompts to the Ollama API and return responses.
In practice
- Use `plpython3u` for Python-based Postgres functions.
- Run Ollama on a separate machine for local LLM inference.
- Classify data (e.g., financial scores) with local LLMs.
Topics
- Snowflake Cortex
- Ollama
- PostgreSQL Functions
- Python Integration
- Data Standardization
Best for: AI Engineer, Machine Learning Engineer, Software Engineer
Related on AIssential
Editorial summary, takeaway, and curation by AIssential. Original article published by LLM on Medium.