← 开源
gannonh

chatgpt-pgvector

ChatGTP (gpt3.5-turbo) starter app

ApplicationsOtherTypeScript
在 GitHub 打开
增长势头
+024 小时新增 Star0.0%
937
Star
125
Fork
+0
本周
3
贡献者
创建于 2023-02-28 · 更新于 2026-09-30 · 今日第 12522 名
主要开发者
gannonhankaneoskarrough

gannonh/chatgpt-pgvector 排名第 12,522,有 937 个星标。

同类别比较

gannonh/chatgpt-pgvector 排名第 12,522,此处有 8 个同类条目;investbrainapp/investbrain 排名第 12,523。

同类别比较
名称排名指标
felixchenfy/Realtime-Action-Recognition12,491
语言:
Python
星标数:
942
分叉数:
260
简介:
Real-time multi-person action recognition from OpenPose skeleton sequences, with tracking, feature extraction, model training, and inference pipelines for research and prototyping.
JuliusBrussee/caveman-code12,498
语言:
TypeScript
星标数:
941
分叉数:
108
priiyaanjaalii0611/ASL_to_English12,505
语言:
Jupyter Notebook
星标数:
940
分叉数:
218
简介:
Reads your hand signs and translates them to English words using Tensorflow object detection API
nexu-io/codex-slides12,516
语言:
TypeScript
星标数:
938
分叉数:
80
investbrainapp/investbrain12,523
语言:
PHP
星标数:
937
分叉数:
73
简介:
Smart LLM-enabled investment tracker that consolidates and monitors market performance across your different brokerages
pgosar/ChatGDB12,525
语言:
Python
星标数:
937
分叉数:
32
简介:
Harness the power of ChatGPT inside the GDB or LLDB debugger!
haltakov/natural-language-youtube-search12,531
语言:
Jupyter Notebook
星标数:
936
分叉数:
70
简介:
Search inside YouTube videos using natural language
777genius/claude-code-source-code12,532
星标数:
935
分叉数:
1,082
简介:
Claude code source code
关键参数与规格
关键参数与规格
参数值
语言TypeScript
类别Applications
子类别Other
关键词RAG
星标数937
分叉数125
贡献者3
创建日期2023-02-28
更新日期2026-09-30
1 天星标数0
7 天星标数0
排名12,522
上次排名12,445
排名变化-77
7 天星标排名13,470
上次 7 天星标排名13,480
7 天星标排名变化10
总星标排名11,709
上次总星标排名11,692
总星标排名变化-17
国家USA
README 摘录

Domain-specific ChatGTP Starter App ChatGPT is great for casual, general-purpose question-answers but falls short when domain-specific knowledge is needed. Further, it makes up answers to fill its knowledge gaps and never cites its sources, so it can't really be trusted. This starter app uses embeddings coupled with vector search to solve this, or more specifically, to show how OpenAI's chat completions API can be used to create conversational interfaces to domain-specific knowledge. Embeddings, as represented

by vectors of floating-point numbers, measure the "relatedness" of text strings. These are super useful for ranking search results, clustering, classification, etc. Relatedness is measured by cosine similarity. If the cosine similarity between two vectors is close to 1, the vectors are highly similar and point in the same direction. In the case of text embeddings, a high cosine similarity between two embedding vectors indicates that the corresponding text strings are highly related. This starter app uses embeddings to

generate a vector representation of a document, and then uses vector search to find the most similar documents to the query. The results of the vector search are then used to construct a prompt. The response is then streamed to the user. Check out the Supabase blog posts on pgvector and OpenAI embeddings for more background. Technologies used: Nextjs (React framework) + Vercel hosting Supabase (using their pgvector implementation as the vector database) OpenAI API (for generating embeddings and chat completions

) TailwindCSS (for styling) Functional Overview Creating and storing the embeddings: Web pages are scraped, stripped to plain text and split into 1000-character documents OpenAI's embedding API is used to generate embeddings for each document using the "text-embedding-ada-002" model The embeddings are then stored in a Supabase postgres table using pgvector; the table has three columns: the document text, the source URL, and the embedding vectors returned from the OpenAI API. Responding to queries: A single embedding

is generated from the user prompt That embedding is used to perform a similarity search against the vector database The results of the similarity search are used to construct a prompt for GPT-3. 5/GPT-4 The GPT response is then streamed to the user. Getting Started The following set-up guide assumes at least basic familiarity developing web apps with React and Nextjs. Experience with OpenAI APIs and Supabase is helpful but not required to get things working

. Set-up Supabase Create a Supabase account and project at NOTE: Supabase support for pgvector is relatively new (02/2023), so it's important to create a new project if your project was created before then. First we'll enable the Vector extension. In Supabase, this can be done from the web portal through → . You can also do this in SQL by running: Next let's create a table to store our documents and their embeddings. Head over to the SQL Editor and

run the following query: Finally, we'll create a function that will be used to perform similarity searches. Head over to

常见问题

记录了多少星标和分叉?

gannonh/chatgpt-pgvector 有 937 个星标和 125 个分叉。

仓库排名是多少?

gannonh/chatgpt-pgvector 排名第 12,522。

记录的语言和类别是什么?

gannonh/chatgpt-pgvector 有 937 个星标,语言为 TypeScript,类别为 Applications。

哪个仓库排名最接近?

gannonh/chatgpt-pgvector 与 investbrainapp/investbrain 比较,后者排名第 12,523,有 937 个星标。

README

Domain-specific ChatGTP Starter App

ChatGPT is great for casual, general-purpose question-answers but falls short when domain-specific knowledge is needed. Further, it makes up answers to fill its knowledge gaps and never cites its sources, so it can't really be trusted. This starter app uses embeddings coupled with vector search to solve this, or more specifically, to show how OpenAI's chat completions API can be used to create conversational interfaces to domain-specific knowledge.

Embeddings, as represented by vectors of floating-point numbers, measure the "relatedness" of text strings. These are super useful for ranking search results, clustering, classification, etc. Relatedness is measured by cosine similarity. If the cosine similarity between two vectors is close to 1, the vectors are highly similar and point in the same direction. In the case of text embeddings, a high cosine similarity between two embedding vectors indicates that the corresponding text strings are highly related.

This starter app uses embeddings to generate a vector representation of a document, and then uses vector search to find the most similar documents to the query. The results of the vector search are then used to construct a prompt. The response is then streamed to the user. Check out the Supabase blog posts on pgvector and OpenAI embeddings for more background.

Technologies used:

  • Nextjs (React framework) + Vercel hosting
  • Supabase (using their pgvector implementation as the vector database)
  • OpenAI API (for generating embeddings and chat completions)
  • TailwindCSS (for styling)

Functional Overview

Creating and storing the embeddings:

  • Web pages are scraped, stripped to plain text and split into 1000-character documents
  • OpenAI's embedding API is used to generate embeddings for each document using the "text-embedding-ada-002" model
  • The embeddings are then stored in a Supabase postgres table using pgvector; the table has three columns: the document text, the source URL, and the embedding vectors returned from the OpenAI API.

Responding to queries:

  • A single embedding is generated from the user prompt
  • That embedding is used to perform a similarity search against the vector database
  • The results of the similarity search are used to construct a prompt for GPT-3.5/GPT-4
  • The GPT response is then streamed to the user.

Getting Started

The following set-up guide assumes at least basic familiarity developing web apps with React and Nextjs. Experience with OpenAI APIs and Supabase is helpful but not required to get things working.

Set-up Supabase

  • Create a Supabase account and project at https://app.supabase.com/sign-in. NOTE: Supabase support for pgvector is relatively new (02/2023), so it's important to create a new project if your project was created before then.
  • First we'll enable the Vector extension. In Supabase, this can be done from the web portal through Database → Extensions. You can also do this in SQL by running:
create extension vector;
  • Next let's create a table to store our documents and their embeddings. Head over to the SQL Editor and run the following query:
create table documents (
  id bigserial primary key,
  content text,
  url text,
  embedding vector (1536)
);
  • Finally, we'll create a function that will be used to perform similarity searches. Head over to the SQL Editor and run the following query:
create or replace function match_documents (
  query_embedding vector(1536),
  similarity_threshold float,
  match_count int
)
returns table (
  id bigint,
  content text,
  url text,
  similarity float
)
language plpgsql
as $$
begin
  return query
  select
    documents.id,
    documents.content,
    documents.url,
    1 - (documents.embedding <=> query_embedding) as similarity
  from documents
  where 1 - (documents.embedding <=> query_embedding) > similarity_threshold
  order by documents.embedding <=> query_embedding
  limit match_count;
end;
$$;

Set-up local environment

  • clone the repo: gh repo clone gannonh/chatgpt-pgvector
  • open in your favorite editor (the following assumes VS Code on a Mac)
cd chatgpt-pgvector
code .
  • install dependencies
npm install
  • create a .env.local file in the root directory to store environment variables:
cp .env.local.example .env.local
  • open the .env.local file and add your Supabase project URL and API key. You can find these in the Supabase web portal under Project → API. The API key should be stored in the SUPABASE_ANON_KEY variable and project URL should be stored under NEXT_PUBLIC_SUPABASE_URL.
  • Add your OPENAI API key to .env.local. You can find this in the OpenAI web portal under API Keys. The API key should be stored in the OPENAI_API_KEY variable.
  • [optional] environment variable OPEAI_PROXY be provide to enable your custom proxy of OPENAI api. Left it "" to call official API directly.
  • [optional] environment variable SPLASH_URL be provide to enable your splash (Splash is a javascript rendering service. It’s a lightweight web browser with an HTTP API, implemented in Python 3 using Twisted and QT5) api. Left it "" to fetch url direct.
  • Start the app
npm run dev
排名相邻
同类项目