Skip to content
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

PGVECTOR-ELIXIR extension: example with the classification of data using OpenAI #103

Open
ndrean opened this issue May 9, 2023 · 3 comments
Labels
external-dependency Depends on an entity/dependency external to the team's control

Comments

@ndrean
Copy link

ndrean commented May 9, 2023

1. An example of a usage of pgvector.

We want to classify a dataset using "a certain distance" among the rows. The idea is to send the data to the (rate limited) OpenAI api endpoint, get in return tokens for each row, store as a vector, and then apply a distance sorting query between rows based on this vector field.

Note: the distance operator <=> is also used with PostGIS.

Screenshot 2023-05-09 at 10 09 35

2. pgvector and indexes

Screenshot 2023-05-09 at 16 48 03

A summary of the post above, as found in the post!:
pgvector provides a comprehensive, performant, and 100% open source database for vector data. As a developer, the key to getting performance from pgvector are:

  • Ensure your query is using the indexes
  • Ensure your indexes have the optimal list size
  • Ensure you have enough memory for the index
@ndrean
Copy link
Author

ndrean commented May 9, 2023

3. pgvector-elixir

I want to use pgvector-elixir with Elixir.

❌ I failed miserably to install the extension PGVECTOR with brew install pgvector because I installed Postgres.App, and make doesn't seem to work easily on my brand new M2.

🚀 I installed postgresql@14 via homebrew, then pgvector, and I can CREATE EXTENSION VECTOR;.
It is just more annoying than using the Postgres.App.

Screenshot 2023-05-09 at 16 54 53

@ndrean ndrean changed the title PGVECTOR extension: classification of data using OpenAI and pgvector PGVECTOR-ELIXIR extension: classification of data using OpenAI and pgvector May 9, 2023
@ndrean ndrean added the help wanted If you can help make progress with this issue, please comment! label May 9, 2023
@ndrean ndrean changed the title PGVECTOR-ELIXIR extension: classification of data using OpenAI and pgvector PGVECTOR-ELIXIR extension: example with the classification of data using OpenAI May 9, 2023
@ndrean ndrean added external-dependency Depends on an entity/dependency external to the team's control and removed help wanted If you can help make progress with this issue, please comment! labels May 9, 2023
@ndrean
Copy link
Author

ndrean commented May 9, 2023

Next step, build a repo or Livebook to test this.

@ndrean
Copy link
Author

ndrean commented Nov 27, 2023

A nice post on pgvector with ML in mind:

Screenshot 2023-11-27 at 14 43 56

and pgvector and HNSW:
Screenshot 2023-11-27 at 16 48 02

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
external-dependency Depends on an entity/dependency external to the team's control
Projects
None yet
Development

No branches or pull requests

1 participant