Introducing Virtual MCP Servers
LogoLogo
GithubJoin SlackSignupBook a Demo
  • Documentation
  • Self Hosted
  • Integrations
  • Guides
  • Enterprise
  • Examples
  • OpenAI
  • Vercel AI SDK
  • DeepSeek
  • Anthropic
  • LangChain
  • CrewAI
  • Gemini
  • Bedrock
  • xAI
  • TogetherAI
  • FireworksAI
  • DeepInfra
  • OpenRouter
  • Smithery
  • LlamaIndex
  • Supabase
  • Mem0
Powered by GitBook
LogoLogo

Social

  • LinkedIn
  • X
  • Youtube
  • Github

Platform

  • Pricing
  • Documentation
  • Blog

Company

  • Home
  • About

Legal

  • Privacy Policy
  • Terms of Service

2025 LangDB. All rights reserved.

On this page
  • Preparing Database
  • Generating and Storing Embeddings

Was this helpful?

Export as PDF

Supabase

Connect LangDB to LangChain using OpenAI-compatible setup to generate embeddings and store them in Supabase for efficient data retrieval.

PreviousLlamaIndexNextMem0

Was this helpful?

LangDB integrates AI models like OpenAI to generate embeddings and store them in Supabase for efficient data retrieval.

Preparing Database

1

Create a Supabase Project

Go to and create a new project.

2

Enable PgVector

create extension vector;
3

Create a table to store Embeddings

create table embeddings (
  id bigserial primary key,
  content text,
  embedding vector(1536)
);

Generating and Storing Embeddings

1

Install Libraries

pip install openai python-dotenv supabase
2

Generate Embeddings

from openai import OpenAI
from dotenv import load_dotenv
from supabase import create_client, Client
import os

load_dotenv()
api_key = os.getenv("LANGDB_API_KEY")
project_id = os.getenv("LANGDB_PROJECT_ID")
base_url = f"https://api.us-east-1.langdb.ai/{project_id}/v1"


client = OpenAI(
    base_url=base_url,
    api_key=api_key,
)

text = "Hello LangDB"
response = client.embeddings.create(
    model="text-embedding-ada-002",
    input=text,
)

embedding = response.data[0].embedding
3

Store in Supabase

# # Store in Supabase
result = supabase.table('embeddings').insert({
    "content": text,
    "embedding": embedding
}).execute()

Supabase