NAME

SQLite::VecDB::Role::Embedding - Langertha embedding integration for SQLite::VecDB collections

VERSION

version 0.001

SYNOPSIS

# Applied automatically when SQLite::VecDB has an embedding engine:
use SQLite::VecDB;
use Langertha::Engine::Ollama;

my $vdb = SQLite::VecDB->new(
  db_file    => 'vectors.db',
  dimensions => 768,
  embedding  => Langertha::Engine::Ollama->new(
    url             => 'http://localhost:11434',
    embedding_model => 'nomic-embed-text',
  ),
);

my $coll = $vdb->collection('docs');
$coll->add_text(id => 'doc1', text => 'Some text to embed and store.');
my @results = $coll->search_text(text => 'search query', limit => 5);

DESCRIPTION

This role is automatically applied to SQLite::VecDB::Collection instances when the parent SQLite::VecDB has an embedding engine set. It adds add_text and search_text methods that use Langertha::Role::Embedding to generate vectors from text automatically.

add_text

$coll->add_text(
  id   => 'doc1',
  text => 'Some text to embed and store.',
);

Generates an embedding for text using the configured Langertha engine, then stores the vector. The text is also saved as content unless you provide your own content value.

search_text

my @results = $coll->search_text(
  text  => 'search query',
  limit => 10,
);

Generates an embedding for the query text, then performs KNN search.

SUPPORT

Issues

Please report bugs and feature requests on GitHub at https://github.com/Getty/p5-sqlite-vecdb/issues.

CONTRIBUTING

Contributions are welcome! Please fork the repository and submit a pull request.

AUTHOR

Torsten Raudssus <torsten@raudssus.us>

COPYRIGHT AND LICENSE

This software is copyright (c) 2026 by Torsten Raudssus.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.