Use Ollama Embeddings with PostgreSQL (Tutorial)

Published: 19 December 2024
on channel: Tiger Data (creators of TimescaleDB)
19,618
482

🔥 Build AI Apps with PostgreSQL, pgvector, and Ollama: Complete Tutorial

Learn how to build powerful AI applications using PostgreSQL, pgVector, and Ollama! In this tutorial, we'll show you how to:
Set up Ollama for local LLM deployment
Use pgVector to turn Postgres into a vector database
Automate embedding creation with pgai Vectorizer
Perform semantic search on text data
Build a RAG (Retrieval Augmented Generation) application

We'll use Sam Altman's blog posts as example data to demonstrate how to create a complete RAG pipeline using 100% open source tools. All the code runs locally on your machine - no API costs or third-party dependencies required!

🛠️ Technologies covered:
PostgreSQL
Ollama
pgvector extension
Pgai Extension & Vectorizer
Nomic Embed (embedding model)
TinyLlama (1.1B parameter LLM)

All resources and code are available in the PGAI GitHub repo. Start building your AI apps today!

📌 pgai Github repo ⇒ https://github.com/timescale/pgai
📌 Ollama ⇒ https://ollama.com
📌 pgai Vectorizer Ollama Quickstart ⇒ https://github.com/timescale/pgai/blo...
📌 The Emerging Open-Source AI Stack ⇒ https://www.timescale.com/blog/the-em...

📚 𝗖𝗵𝗮𝗽𝘁𝗲𝗿𝘀
00:00 Introduction: Ollama and PostgreSQL
01:19 Set up
01:38 Setup with Docker Compose
02:43 Dataset overview
03:29 Download embedding models and LLM from Ollama
04:35 Using pgai Vectorizer to auto-embed data
07:02 pgai Vectorizer Architecture overview
09:12 Vectorizer Status Check
10:45 Example: Similarity Search with pgvector and pgai
11:51 Example: RAG with pgvector and pgai
14:18 Learn more on pgai github


On this page of the site you can watch the video online Use Ollama Embeddings with PostgreSQL (Tutorial) with a duration of hours minute second in good quality, which was uploaded by the user Tiger Data (creators of TimescaleDB) 19 December 2024, share the link with friends and acquaintances, this video has already been watched 19,618 times on youtube and it was liked by 482 viewers. Enjoy your viewing!