Skip to main content

Crate daimon_plugin_opensearch

Crate daimon_plugin_opensearch 

Source
Expand description

§daimon-plugin-opensearch

An OpenSearch k-NN backed VectorStore plugin for the Daimon AI agent framework.

This crate provides OpenSearchVectorStore, which stores document embeddings in OpenSearch using its native k-NN plugin. It supports cosine similarity, L2 (euclidean), and inner product distance metrics with HNSW indexing via nmslib, faiss, or lucene engines.

§Quick Start

use daimon_plugin_opensearch::{OpenSearchVectorStoreBuilder, SpaceType, Engine};
use daimon::retriever::SimpleKnowledgeBase;
use std::sync::Arc;

let store = OpenSearchVectorStoreBuilder::new("http://localhost:9200", 1536)
    .index("my_docs")
    .space_type(SpaceType::CosineSimilarity)
    .engine(Engine::Lucene)
    .build()
    .await?;

// Compose with an embedding model for a full RAG pipeline:
let kb = SimpleKnowledgeBase::new(embedding_model, store);

§Manual Index Setup

If you prefer to manage index creation yourself, disable auto-creation and use the JSON from index_settings:

let store = OpenSearchVectorStoreBuilder::new(url, 1536)
    .auto_create_index(false)
    .build()
    .await?;

§AWS OpenSearch Service

Enable the aws-auth feature for SigV4 authentication:

daimon-plugin-opensearch = { version = "0.15", features = ["aws-auth"] }

Modules§

index_settings
Index creation JSON for manual setup.

Structs§

OpenSearchVectorStore
A VectorStore backed by OpenSearch with the k-NN plugin.
OpenSearchVectorStoreBuilder
Builds an OpenSearchVectorStore with optional auto-index-creation.

Enums§

Engine
k-NN engine used for approximate nearest neighbor search.
SpaceType
Distance metric / space type for k-NN vector search.