VectorStoreFactory

org.llm4s.vectorstore.VectorStoreFactory

Factory for creating VectorStore instances.

Supports creating stores from configuration or explicit parameters. Backend selection is based on the provider name.

Currently supported backends:

  • "sqlite" - SQLite-based storage (default)
  • "pgvector" - PostgreSQL with pgvector extension
  • "qdrant" - Qdrant vector database

Future backends (roadmap):

  • "milvus" - Milvus vector database
  • "pinecone" - Pinecone cloud service

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Type members

Classlikes

object Backend

Attributes

Companion
trait
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
Backend.type
sealed trait Backend

Supported vector store backends.

Supported vector store backends.

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object PgVector
object Qdrant
object SQLite
final case class Config(backend: Backend, path: Option[String], connectionString: Option[String], options: Map[String, String])

Configuration for creating a vector store.

Configuration for creating a vector store.

Value parameters

backend

The storage backend to use

connectionString

Connection string (for remote backends)

options

Additional backend-specific options

path

Path to database file (for file-based backends)

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object Config

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
Config.type

Value members

Concrete methods

def create(config: Config): Result[VectorStore]

Create a vector store from configuration.

Create a vector store from configuration.

Value parameters

config

The store configuration

Attributes

Returns

The vector store or error

def create(provider: String, path: Option[String], connectionString: Option[String]): Result[VectorStore]

Create a vector store from a provider name.

Create a vector store from a provider name.

Value parameters

connectionString

Optional connection string for remote backends

path

Optional path for file-based backends

provider

The provider name (e.g., "sqlite", "pgvector")

Attributes

Returns

The vector store or error

Create an in-memory vector store.

Create an in-memory vector store.

Useful for testing or temporary storage.

Attributes

Returns

The vector store or error

def pgvector(tableName: String): Result[VectorStore]

Create a pgvector store with default local settings.

Create a pgvector store with default local settings.

Connects to localhost:5432/postgres with user postgres.

Value parameters

tableName

Table name for vectors (default: "vectors")

Attributes

Returns

The vector store or error

def pgvector(connectionString: String, user: String, password: String, tableName: String): Result[VectorStore]

Create a pgvector store with explicit connection settings.

Create a pgvector store with explicit connection settings.

Value parameters

connectionString

JDBC connection string (jdbc:postgresql://...)

password

Database password

tableName

Table name for vectors

user

Database user

Attributes

Returns

The vector store or error

def qdrant(collectionName: String): Result[VectorStore]

Create a Qdrant store with default local settings.

Create a Qdrant store with default local settings.

Connects to localhost:6333.

Value parameters

collectionName

Collection name (default: "vectors")

Attributes

Returns

The vector store or error

def qdrant(url: String, collectionName: String): Result[VectorStore]

Create a Qdrant store with explicit URL.

Create a Qdrant store with explicit URL.

Value parameters

collectionName

Collection name

url

Qdrant server URL (e.g., http://localhost:6333)

Attributes

Returns

The vector store or error

def qdrantCloud(cloudUrl: String, apiKey: String, collectionName: String): Result[VectorStore]

Create a Qdrant Cloud store.

Create a Qdrant Cloud store.

Value parameters

apiKey

Qdrant API key

cloudUrl

Qdrant cloud URL (e.g., https://xxx.qdrant.io)

collectionName

Collection name (default: "vectors")

Attributes

Returns

The vector store or error

def sqlite(path: String): Result[VectorStore]

Create a file-based SQLite vector store.

Create a file-based SQLite vector store.

Value parameters

path

Path to the database file

Attributes

Returns

The vector store or error