-
Notifications
You must be signed in to change notification settings - Fork 3.7k
feat: WIP - Integrate Surrealdb as VectorDB #3235
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
base: main
Are you sure you want to change the base?
Conversation
🏛️ Created the initial structure
🏃 Async Demo now works
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.
Hey @dsaad68 thanks alot for this contribution. small comment
Also make sure to fix the failing style and validation test checks...
I have added scripts to the cookbook and done the formatting. |
@kausmeows could you please check if added |
Yes that looks fine but @dsaad68 i was testing this and ran the cookbook- I ran the docker command mentioned, am i missing anything? |
I have fixed this problem, the issue was with the version of the SurrealDB package. Can you run it again? |
@dsaad68 not sure if i'm doing something wrong but still getting the same error as in above screenshot... |
Sorry for the trouble. I will look into it. However, a somewhat unconventional approach, could you please attempt to relocate the script to the other folder, such as the root directory, and then test it? |
I have found the problem, I will solve it. |
@kausmeowsI have fixed the problem. Now it should work. |
…into integrate-surrealdb
DEFINE FIELD IF NOT EXISTS content ON {collection} TYPE string; | ||
DEFINE FIELD IF NOT EXISTS embedding ON {collection} TYPE array<float>; | ||
DEFINE FIELD IF NOT EXISTS meta_data ON {collection} TYPE object; | ||
DEFINE INDEX IF NOT EXISTS vector_idx ON {collection} FIELDS embedding HNSW DIMENSION {dimensions} DIST COSINE; |
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.
This would use the following defaults. It would be nice to make them explicit, or add a link to the docs about vector indexes
TYPE F64 -- other options e.g. F32, I64, ...
M 12 -- Max Connections per Element
EFC 150 -- Exploration factor during construction
Alse, there's the M-Tree index type, that may work on small data sets and dimensions. What do you think about making this customaizable instead of a convention to use only HNSW?
For example, this would be an m-tree index:
DEFINE INDEX IF NOT EXISTS vector_idx ON {collection} FIELDS embedding MTREE DIMENSION {dimensions} DIST COSINE TYPE F64;
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.
I will take care of it later.
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.
Current UPSERT_QUERY does not update documents because the doc.is is not used in the query.
Co-authored-by: Martin Schaer <martincorrales@gmail.com>
Co-authored-by: Martin Schaer <martincorrales@gmail.com>
Co-authored-by: Martin Schaer <martincorrales@gmail.com>
Hi @martinschaer appreciate the reviews here. Thanks a lot for jumping in! 🚀 @dsaad68 let me know when i can final test it, no rush! |
🚀 SurrealDB Vector Database Integration
🔍 Overview
This PR adds support for SurrealDB as a multi-model database backend for Agno. SurrealDB is a scalable, distributed database with native vector embedding support and HNSW indexes for vector search, making it a perfect fit for RAG applications.
🌟 About SurrealDB
SurrealDB is "the ultimate multi-model database for AI applications" that unifies vectors, graphs, documents, time-series and files in a single platform.
✨ Features
SurrealVectorDb
implementation supporting both synchronous and asynchronous operations🛠️ Improvements
AgentKnowledge
async capabilities withasync_filter_existing_documents
📝 Usage Example
🔗 References
Type of change
Checklist
./scripts/format.sh
and./scripts/validate.sh
)Additional Notes
Add any important context (deployment instructions, screenshots, security considerations, etc.)