-
Notifications
You must be signed in to change notification settings - Fork 53
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
Intermittent playground crash #46
Comments
PS: need to improve error handling when using embedbase-js sdk at some level to determine |
need to try dot product instead of cos sim in pgvector: ...
select
STUFFHERE,
(documents.embedding <#> embedding) * -1 as similarity
from documents
-- The dot product is negative because of a Postgres limitation, so we negate it
and (documents.embedding <#> embedding) * -1 > match_threshold
-- OpenAI embeddings are normalized to length 1, so
-- cosine similarity and dot product will produce the same results.
-- Using dot product which can be computed slightly faster.
--
-- For the different syntaxes, see https://github.com/pgvector/pgvector
order by documents.embedding <#> embedding
limit match_count;
end;
$$; need to setup performance monitoring beforehand though |
different thing that could be tried that will highly likely improve perf:
|
To update the index to use 220 lists, you'll need to first drop the existing index and then create a new index with the desired lists value. Here are the SQL commands to do that: -- Drop the existing index
DROP INDEX documents_embedding_vector_cosine_ops_idx;
-- Create a new index with 220 lists
CREATE INDEX documents_embedding_vector_cosine_ops_idx
ON documents
USING ivfflat (embedding vector_cosine_ops)
WITH (lists = 220); Replace Dropping and recreating an index can have some impact on your users, depending on your database's current usage and workload. Here's how it might affect your users:
To minimize the impact on your users, consider performing the index update during a maintenance window or a period of low database usage. Additionally, you can use the -- Create a new index with 220 lists, concurrently
CREATE INDEX CONCURRENTLY documents_embedding_vector_cosine_ops_idx
ON documents
USING ivfflat (embedding vector_cosine_ops)
WITH (lists = 220); Note that you cannot use the |
nvm all this. just need to distinct the select query when optimizing duplicates |
fixed 🚢🚢🚢🚢🚢 |
🐛 Bug Report
crash sometimes (chain of issues, backend crashing default timeout supabase is 5 seconds)
🔬 How To Reproduce
Steps to reproduce the behavior:
📎 Additional context
Dashboard/playground
Backend
different-ai/embedbase-hosted#3
Solutions:
The text was updated successfully, but these errors were encountered: