New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP: DocsGPT POC#12056
Merged
Merged
WIP: DocsGPT POC #12056
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WIP: DocsGPT POC
The latest updates on your projects. Learn more about Vercel for Git ↗︎
4 Ignored Deployments
|
gregnr
reviewed
Jan 30, 2023
gregnr
reviewed
Jan 30, 2023
gregnr
reviewed
Jan 30, 2023
gregnr
reviewed
Jan 30, 2023
saltcod
approved these changes
Feb 6, 2023
apps/www/_blog/2023-02-03-openai-embeddings-postgres-vector.mdx
Outdated
Show resolved
Hide resolved
apps/www/_blog/2023-02-03-openai-embeddings-postgres-vector.mdx
Outdated
Show resolved
Hide resolved
apps/www/_blog/2023-02-03-openai-embeddings-postgres-vector.mdx
Outdated
Show resolved
Hide resolved
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
|
||
A new PostgreSQL extension is now available in Supabase: [`pgvector`](https://github.com/pgvector/pgvector), an open-source vector similarity search. | ||
|
||
The exponential progress of AI functionality over the past year has inspired many new real world applications. One specific challenge has been the ability to store and query _embeddings_ at scale. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[prettier] reported by reviewdog 🐶
Suggested change
The exponential progress of AI functionality over the past year has inspired many new real world applications. One specific challenge has been the ability to store and query _embeddings_ at scale. | |
The exponential progress of AI functionality over the past year has inspired many new real world applications. One specific challenge has been the ability to store and query _embeddings_ at scale. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
(copied from OP: #12054)
End-to-end POC for DocsGPT project.
Pre-reqs
Config/secrets
Updated your
./apps/docs/.env.local
file with some keys (use.env.sample
as a base):To get the OpenAI key, you will need an OpenAI account and create a key here:
https://beta.openai.com/account/api-keys
Run local Supabase stack
We have extended
./supabase
to include DB migrations required for DocsGPT. Be sure to run a local Supabase stack. From the project root:Generate embeddings (first time only)
The first time you will need to pre-generate embeddings for the documents (guide-only for now). Simply call the following script from
./apps/docs
:You can safely call this multiple times if you like - it uses a
checksum
to determine whether or not it has already generated an embedding for each document and will skip if its already there.In the future this will most likely be called from a CI pipeline.
Note: This does have a (very small) cost every time you run. It queries OpenAI's
embeddings
endpoint to generate embeddings. If you find yourself constantly restarting your Postgres instance, you can use the following commands to quickly backup/restore without re-generating embeddings every time:Backup:
pg_dump --column-inserts --data-only -h localhost -p 54322 -U postgres -t page -t page_section > backup.sql
Restore:
Run edge function
A server side edge function was built to handle DocGPT queries (search embeddings in Postgres, inject as context in prompt, send prompt request to OpenAI).
You will need to run this function locally and pass in the above environment variables. From the project root:
Run docs project
Of course we will need to run the docs project to use the frontend. From
./apps/docs
: