Takeaways

By the end of this module, you will be able to:
  • Create a table in your database to store embeddings
  • Add logic to chunk and create embeddings when creating resources
  • Understand the relationship between resources and their embeddings
  • Implement the complete embedding generation workflow

Module structure

Prerequisites

Before starting this module, ensure you have:
  • PostgreSQL database running with pgvector extension
  • Basic understanding of database schemas and relationships
  • Familiarity with TypeScript and async/await patterns

What you’ll build

Embeddings Table

A table with proper indexing to store vector representations of your content chunks.

Chunking Function

Logic to break down content into manageable pieces for embedding generation.

Embedding Generation

Functions to create embeddings using OpenAI’s text-embedding-ada-002 model.

Enhanced Workflow

Updated resource creation that automatically generates and stores embeddings.