Skip to content

Conversation

gregnr
Copy link
Contributor

@gregnr gregnr commented Dec 6, 2023

Summary

Adds a cookbook example to store and query OpenAI embeddings in Supabase using pgvector and Supabase's auto-generated REST API. This guide is written for JavaScript developers, but also adds callouts that explain how they can modify it for other languages.

Motivation

Many Supabase customers use OpenAI embeddings in their DB (via pgvector) to perform semantic search and RAG over their data. This PR adds a guide that demonstrates exactly how to implement semantic search in Supabase using OpenAI embeddings while also following database best practices (like HNSW indexes, row level security, etc).

Supabase exposes an auto-generated REST API (based on the user's table schema), so this guide walks users through how to interact with their data via this API. There also aren't too many cookbook examples written for JavaScript developers, so this guide targets this audience and explains how to implement semantic search for multiple JavaScript runtimes (Node.js, Deno, Edge Functions). Since this focuses on JavaScript, the guide was written as mdx, but let me know if ipynb is preferred here!


For new content

When contributing new content, read through our contribution guidelines, and mark the following action items as completed:

  • I have added a new entry in registry.yaml (and, optionally, in authors.yaml) so that my content renders on the cookbook website.
  • I have conducted a self-review of my content based on the contribution guidelines:
    • Relevance: This content is related to building with OpenAI technologies and is useful to others.
    • Uniqueness: I have searched for related examples in the OpenAI Cookbook, and verified that my content offers new insights or unique information compared to existing documentation.
    • Spelling and Grammar: I have checked for spelling or grammatical mistakes.
    • Clarity: I have done a final read-through and verified that my submission is well-organized and easy to understand.
    • Correctness: The information I include is correct and all of my code executes successfully.
    • Completeness: I have explained everything fully, including all necessary references and citations.

We will rate each of these areas on a scale from 1 to 4, and will only accept contributions that score 3 or higher on all areas. Refer to our contribution guidelines for more details.

Copy link
Contributor

@logankilpatrick logankilpatrick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM pending small changes

gregnr and others added 2 commits December 11, 2023 16:55
Co-authored-by: Logan Kilpatrick  <23kilpatrick23@gmail.com>
@gregnr
Copy link
Contributor Author

gregnr commented Dec 12, 2023

@logankilpatrick thanks for reviewing! Suggested changes have been added.

@logankilpatrick logankilpatrick merged commit 68ff729 into openai:main Dec 18, 2023
katia-openai pushed a commit that referenced this pull request Feb 29, 2024
Co-authored-by: Logan Kilpatrick <23kilpatrick23@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants