new·The score now tells you which way it movedA brain's exam only ever grows: its own material writes questions, and so does every question a real caller asked and did not get answered. The score is a percentage over that growing set, so a brain that learned more could post a smaller number — and this week three did. One of them answered two MORE questions than the week before and showed eighteen points less. Printed as a single percentage, that reads as decline to a reader and as punishment to anyone who contributes material.all news →
mozg.beta
Sign in

Supabase · all subjects

ai-tools/chatgpt-plugin

8 notes, read out of this brain and free to use. Each one was extracted from a source and is re-checked against its exam.

ChatGPT Retrieval Plugin architecture and steps

A Retrieval Plugin is a Python project that injects external data into ChatGPT conversations by: (1) turning documents into smaller chunks, (2) converting chunks into embeddings using OpenAI's text-embedding-ada-002 model, (3) storing embeddings into a vector database, and (4) querying the vector database for relevant documents when a question is asked. This allows ChatGPT to dynamically pull relevant information from data sources such as PDF documents, Confluence, or Notion knowledge bases.

Retrieval Plugin environment variables for Supabase

To configure the ChatGPT Retrieval Plugin with Supabase, export these environment variables: OPENAI_API_KEY (OpenAI API key), DATASTORE=supabase, SUPABASE_URL (Supabase project URL), and SUPABASE_SECRET_KEY (Supabase service role key).

Retrieval Plugin environment variables for Postgres

To configure the ChatGPT Retrieval Plugin with Postgres, export these environment variables: OPENAI_API_KEY (OpenAI API key), DATASTORE=postgres, PG_HOST (Postgres host URL), and PG_PASSWORD (Postgres password).

Running ChatGPT Retrieval Plugin locally with Supabase CLI

To run the Retrieval Plugin locally, install supabase-cli, navigate to the examples/providers folder in the repo, and run the command 'supabase start'. This pulls all Docker images and runs the Supabase stack locally, including pgvector from the start. It also applies all necessary migrations to set everything up. You can then export environment variables and proceed with the next steps. Alternatively, any other Docker image or hosted version of Postgres that includes pgvector can be used, but you must run the migrations from examples/providers/supabase/migrations/20230414142107_init_pg_vector.sql.

Running ChatGPT Retrieval Plugin dev server

Execute 'poetry run dev' to run the plugin. The plugin starts on localhost port 3333 by default and watches for changes in the ./chatgpt-retrieval-plugin directory.

Uploading documents to Retrieval Plugin

Use the /upsert-file endpoint to upload documents to the plugin's datastore. Example command: 'curl -X POST -F "file=@./postgresql-15-US.pdf" http://localhost:3333/upsert-file'. The plugin automatically splits documents and data into smaller chunks.

Creating vector index for embedding column

To speed up vector searches in the documents table, create an HNSW index on the embedding column using the SQL command: 'create index on documents using hnsw (embedding vector_ip_ops) with (lists = 10);'. This creates an approximate index for inner product distance function. As a general guideline, use the formula 'rows / 1000' to determine the optimal lists constant value when you have less than 1 million records in your table.

Registering ChatGPT Retrieval Plugin with ChatGPT

To integrate the plugin with ChatGPT, register it in the ChatGPT dashboard by selecting the Plugins model in a new chat, choosing 'Plugin store' and 'Develop your own plugin', then entering 'localhost:3333' (or your plugin domain) into the domain input. The plugin is then available for use in ChatGPT conversations.

Give your agent this brain