Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Ai Surreal Db Store

Ai Surreal Db Store Laravel Package

symfony/ai-surreal-db-store

SurrealDB vector store integration for Symfony AI Store, enabling similarity search over embeddings using SurrealQL vector functions and MTREE/HNSW indexes.

View on GitHub
Deep Wiki
Context7

SurrealDB vector store bridge for Symfony AI

Frequently asked questions about Ai Surreal Db Store
How do I install symfony/ai-surreal-db-store with Composer?
Run composer require symfony/ai-surreal-db-store, which brings in Symfony AI Store and the SurrealDB PHP client as dependencies. You then register the store in your container, typically by binding it to the Symfony AI Store vector store interface, and point it at your SurrealDB endpoint, namespace, and database. In Laravel, add that binding in a service provider so application code depends on the interface rather than the concrete class.
Can I use this SurrealDB vector store in a Laravel application?
Yes. The package targets Symfony AI Store, but it installs via Composer in Laravel and can be wired through a service provider that binds the store and document interfaces in the container. If you prefer not to depend on Symfony AI at all, you can use the surrealdb/surrealdb client directly behind your own vector store contract. Either way, keep your domain code typed against interfaces for portability.
Should I use MTREE or HNSW indexes with this store?
Both are supported, because you define the index yourself in SurrealDB with DEFINE INDEX and the store queries it through SurrealQL vector functions. MTREE is a reasonable starting point for moderate datasets, while HNSW is usually preferred for larger corpora where approximate nearest-neighbour speed matters. Benchmark recall and latency with your own embeddings before committing to one.
How do I define a vector index in SurrealDB for my embeddings?
Use a SurrealQL statement such as DEFINE INDEX vector_idx ON TABLE document FIELDS embedding MTREE DIMENSION 1536 DIST COSINE TYPE F64, adjusting the table, field name, dimension, and distance metric to match your model. The dimension must match your embedding model exactly, and the distance metric should be the same one used when comparing query vectors. For HNSW, switch the index type and tune its parameters for your recall and latency targets.
What dependencies and SurrealDB version do I need?
You need PHP with Composer, symfony/ai for Symfony AI Store, and the surrealdb/surrealdb PHP client. Your SurrealDB server must support native vector types and vector functions, so use a recent release and check the official vector and DEFINE INDEX documentation for that version. Review the package composer.json for the exact PHP and dependency constraints before upgrading.
What changed with VectorDocumentInterface in v0.14?
Version 0.14 introduces VectorDocumentInterface as a canonical document contract between the store and your application, so the store can hydrate objects instead of returning raw arrays. Type-hint the interface in your services and bind or alias the concrete document class in a Laravel service provider or repository. Any code that assumed array-shaped responses should be reviewed and re-tested against a real dataset.
Does the new count capability work with the SurrealDB store?
The v0.14 count capability adds store-level and collection-level metrics without you writing custom SurrealQL counters. That is useful for dashboards, pagination, and sanity checks after bulk embedding imports. Confirm the exact method names in the Symfony AI Store interface version you install, since the package is still pre-1.0.
How do I test similarity search without a production SurrealDB instance?
Run SurrealDB locally, for example with the official Docker image, and point the store at a dedicated test namespace and database. Write integration tests that define the index, insert a few vectors, and assert nearest-neighbour ordering. For unit tests, fake or mock the store interface so your application code never needs a live database.
Is SurrealDB vector search production-ready compared with pgvector or Weaviate?
SurrealDB offers native vector types, MTREE and HNSW indexes, and vector functions, but its vector search is less battle-tested at large scale than pgvector or Weaviate. Benchmark latency, recall, and index build times with a representative embedding set before relying on it in production. The package itself is pre-1.0, so treat minor upgrades as potential migrations.
How do I migrate existing embeddings from pgvector or Elasticsearch to SurrealDB?
Export your vectors and metadata, transform them into SurrealQL CREATE or INSERT statements, and load them into a table whose vector field matches your embedding dimension. Recreate the index with the same distance metric you used before, then run a sample of known queries to compare results. You can also re-embed the source documents if the original vectors came from a different model.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
coleus/frame
thtg88/journalism
filagora/filagora-ai-forums
rlacerda83/query-parser
socialdept/atp-orm
cboxdk/laravel-assistant-client
socialdept/atp-resolver
socialdept/tenant-domains
tautvydasr/blade-class-names
socialdept/color-scales
maherelgamil/controller
coleus/widgets
coleus/table
coleus/users
coleus/music
coleus/health
coleus/calendar
coleus/notes
coleus/support
coleus/settings