PackagePackagetypeA library you install and call yourself.See every one →What this type is →independently maintainedindependently maintainedoriginPublished by one person or a small company outside SAP. Says nothing about quality; the readings say that.See every one →

@mi8y/cap-agents-cds-vectorstore

A LangChain vector store whose documents and embeddings are CDS entities, so retrieval runs as a CDS query against the database the CAP service is already bound to.

Retrieval inside a CAP application has to put the chunks and their embeddings somewhere, and LangChain's retrieval APIs expect a VectorStore behind them. CDSVectorStore is that implementation over CDS: cds add agent-cds-vectorstore generates Documents and DocumentMetadata entities in the plugin.langchain.vectorstore namespace with a Vector(1536) embedding sized for text-embedding-3-small, and both are aspects, so a project that wants a second store or another dimension declares its own entities and passes their names to the constructor. similaritySearch, similaritySearchWithScore, maxMarginalRelevanceSearch and asRetriever are the read side, with cosine similarity, a threshold that defaults to 0.75, and metadata filters over direct equality, $eq, $ne, $in and $notIn. Turning text into a vector is the caller's: an Embeddings implementation is passed to the constructor, and nothing here splits a long document into chunks.

Facts

Latestv0.2.0ReleasedLast pushLicenceMIT

Where it sits

Lives in
Provides
Retrieval-augmented generationCAPRetrieval-augmented generationcapabilityGrounding a model's answer in data retrieved at question time: text split into chunks, each chunk embedded as a vector, and the chunks nearest to the question placed into the prompt. Semantic search is the same retrieval with a person reading the matches, and fine-tuning changes the model's weights, not its input.
Flavors
Node.jsfrom its runtime
Requires
@sap/cds≥ 10@sap/cdsartifactThe peer range, as published.

Who is behind it

Merbin J AnselmMerbin J AnselmPersonMaintains this
In the atlas: maintains 6, contributes to 6
@anselm94
Mi8Y TechnologiesMi8Y TechnologiesOrganisationMaintains this
In the atlas: maintains 6
@mi8y
maintainers

Before choosing this

Conditions

LicenceSAP Developer License Agreement 3.2 CAP§ 3from Retrieval-augmented generationCovered SAP materials or a covered CAP customer application are included in training data, model development or model refinement.
  • § 3 Artificial Intelligence Training. The agreement prohibits use of the covered materials and customer applications for training artificial-intelligence models or systems.

Retrieval and inference are not automatically AI training. The section becomes relevant if the indexed or retrieved covered material is instead used for training, developing or refining the model or system.

SAP Developer License Agreement 3.2 CAP →

What it declares

Every artifact

Type
Package
Origin
Independently maintained
Runtime
Node.js

As a package

Declared for
>=10
Type declarations
declared
Where it runs
does not say
Distributed through
does not say

Connections1

Install

npm add @mi8y/cap-agents-cds-vectorstore

Derived from the package name. No recipe recorded; the README has the configuration.

README

quoted from mi8y/cap-agents-addons under MIT, read
mi8y/cap-agents-addons/packages/cap-agents-cds-vectorstore/README.mdOn GitHub

@mi8y/cap-agents-cds-vectorstore

npm version License: MIT monthly downloads

A simple LangChain vector store for SAP CAP applications.

This package gives you a VectorStore implementation backed by CAP CDS entities, so you can store embeddings and documents in your CAP application's database and use standard LangChain retrieval APIs for RAG and semantic search.

Installation

npm install @mi8y/cap-agents-cds-vectorstore

Then register the CDS model in your CAP project:

cds add agent-cds-vectorstore

This creates db/agent-cds-vectorstore.cds with two concrete entities (Documents and DocumentMetadata) under the default plugin.langchain.vectorstore namespace. The entities implement the package's reusable aspects with a default Vector(1536) embedding size (matching OpenAI text-embedding-3-small).

Requires:

  • @sap/cds >= 10
  • @langchain/core >= 1

What it adds

The plugin provides two reusable CDS aspects under the plugin.langchain.vectorstore namespace:

  • VectorDocument — defines the shape for stored content and embeddings
  • VectorDocumentMetadata — defines the shape for document metadata entries

Running cds add agent-cds-vectorstore generates default concrete entities implementing these aspects.

At runtime, CDSVectorStore reads and writes through CAP CDS, so it fits naturally into CAP applications and their existing database setup.

Usage

import { OpenAIEmbeddings } from "@langchain/openai";
import { CDSVectorStore } from "@mi8y/cap-agents-cds-vectorstore";

const embeddings = new OpenAIEmbeddings({
  model: "text-embedding-3-small",
});

const vectorStore = new CDSVectorStore(embeddings, {
  name: "knowledge-base",
});

await vectorStore.addDocuments([
  {
    id: "doc-1",
    pageContent: "SAP CAP is a framework for building enterprise applications.",
    metadata: { source: "docs", topic: "cap" },
  },
  {
    id: "doc-2",
    pageContent:
      "LangChain helps build LLM apps with retrieval, tools, and agents.",
    metadata: { source: "docs", topic: "langchain" },
  },
]);

const results = await vectorStore.similaritySearch("What is SAP CAP?", 2);
console.log(results);

Customizing entities

1. Customizing embedding size

The default entities generated by cds add use Vector(1536). To use a different embedding size, just override the embedding field in your own concrete entity implementing the VectorDocument aspect.

...

entity Documents : managed, VectorDocument {
    embedding : Vector(3072); // ---> for 'text-embedding-3-large' model
    metadata  : Composition of many DocumentMetadata
                    on metadata.document = $self;
}

...
2. Customizing namespace and entity definitions

To use a different namespace or entity definitions (i.e. one definition per vector store), define your own entities implementing the package's aspects:

using { managed } from '@sap/cds/common';
using { VectorDocument, VectorDocumentMetadata } from '@mi8y/cap-agents-cds-vectorstore';

namespace my.app.vectorstore;

/**
 Vector store 1: Knowledge Base
 */

entity KnowledgeBaseDocuments : managed, VectorDocument {
    embedding   : Vector(3072);
    metadata    : Composition of many DocumentMetadata
                      on metadata.document = $self;
}

entity KnowledgeBaseDocumentMetadata : VectorDocumentMetadata {
    key document : Association to KnowledgeBaseDocuments;
}

/**
 Vector store 2: Customer Support
 */
entity CustomerSupportDocuments : managed, VectorDocument {
    embedding   : Vector(1536);
    metadata    : Composition of many DocumentMetadata
                      on metadata.document = $self;
}

entity CustomerSupportDocumentMetadata : VectorDocumentMetadata {
    key document : Association to CustomerSupportDocuments;
}

Then pass the custom entity names to CDSVectorStore:

const knowledgebaseVectorStore = new CDSVectorStore(embeddings, {
  name: "knowledge-base",
  fqnDocumentsEntity: "my.app.vectorstore.KnowledgeBaseDocuments",
  fqnDocumentMetadataEntity: "my.app.vectorstore.KnowledgeBaseDocumentMetadata",
});

const customersupportVectorStore = new CDSVectorStore(embeddings, {
  name: "customer-support",
  fqnDocumentsEntity: "my.app.vectorstore.CustomerSupportDocuments",
  fqnDocumentMetadataEntity:
    "my.app.vectorstore.CustomerSupportDocumentMetadata",
});

Field names (storeName, id, pageContent, embedding, metadata, name, value, document) are fixed across all implementations.

Use as a retriever

CDSVectorStore implements the standard LangChain vector store interface, so you can turn it into a retriever directly:

const retriever = vectorStore.asRetriever({
  k: 2,
});

const docs = await retriever.invoke("Explain CAP");

It also supports:

  • similaritySearch
  • similaritySearchWithScore
  • maxMarginalRelevanceSearch

Metadata filtering

You can filter results by metadata when retrieving:

const retriever = vectorStore.asRetriever({
  k: 2,
  filter: {
    topic: "cap",
    priority: { $in: [2, 3] },
  },
});

const docs = await retriever.invoke("framework");

Supported operators:

  • direct equality, like { topic: "cap" }
  • $eq — equal to
  • $ne — not equal to
  • $in — match any of the provided values
  • $notIn — exclude any of the provided values

API

new CDSVectorStore(embeddings, config)

Creates a CDS-backed vector store.

Config options:

  • name: string Required store name. Use this to isolate one vector store from another in the same database.

  • threshold?: number Optional similarity threshold. Defaults to 0.75.

  • fqnDocumentsEntity?: string Fully-qualified CDS entity name for the documents table. Defaults to plugin.langchain.vectorstore.Documents.

  • fqnDocumentMetadataEntity?: string Fully-qualified CDS entity name for the metadata table. Defaults to plugin.langchain.vectorstore.DocumentMetadata.

Static helpers
  • CDSVectorStore.fromTexts(texts, metadatas, embeddings, config)
  • CDSVectorStore.fromDocuments(docs, embeddings, config)
  • CDSVectorStore.fromExistingIndex(embeddings, config)

Notes

  • Document IDs are preserved if you provide them.
  • If no ID is provided, the store generates one.
  • The package uses cosine similarity for retrieval.
  • The CDS model uses CAP's Vector type for embeddings.
  • To extend the default embedding size, define your own concrete entities implementing the package's aspects.

License

MIT License

MIT, read

History

Latest

v0.2.0

Features 1

Notes
Minor Changes
  • b38ac5f: Added @mi8y/cap-agents-cds-vectorstore package for building simple RAG pipelines, with reusable CDS aspects and cds add agent-cds-vectorstore command.
4downloads per week, npm
Weekly downloads for @mi8y/cap-agents-cds-vectorstore26 complete calendar weeks from 2026-04-27 to 2026-10-25; the latest total is 4.27 Apr – 3 May: 04 May – 10 May: 011 May – 17 May: 018 May – 24 May: 025 May – 31 May: 01 Jun – 7 Jun: 08 Jun – 14 Jun: 015 Jun – 21 Jun: 022 Jun – 28 Jun: 029 Jun – 5 Jul: 06 Jul – 12 Jul: 013 Jul – 19 Jul: 020 Jul – 26 Jul: 027 Jul – 2 Aug: 03 Aug – 9 Aug: 010 Aug – 16 Aug: 017 Aug – 23 Aug: 024 Aug – 30 Aug: 031 Aug – 6 Sept: 07 Sept – 13 Sept: 014 Sept – 20 Sept: 8921 Sept – 27 Sept: 1828 Sept – 4 Oct: 75 Oct – 11 Oct: 612 Oct – 18 Oct: 1119 Oct – 25 Oct: 4
RAG on CDS
  1. SAP AI CoreAI runtime on BTP with the Generative AI Hub
  2. SAP HANA CloudManaged SAP HANA database service on BTP
  3. @cap-js/aiValue-help recommendations and SAP AI Core as a CAP service
  4. cap-llm-pluginGenerative AI in CAP with fields anonymised through SAP HANA
  5. @mi8y/cap-agents-aicore-vectorstoreLangChain vector store on SAP AI Core Document Grounding
  6. @sap/cdsCAP Node.js runtime
  7. @saptarishi/cds-plugin-llmCAP service kind putting eleven model providers behind one API
  8. @saptarishi/cds-plugin-vector-hanaVector storage and similarity search on SAP HANA from CAP

Details

Sources4
Added by handdiscovered herechecked
npm registry, @mi8y/cap-agents-cds-vectorstoreversion, releases, installschecked
github.com/git+https://github.com/mi8y/cap-agents-plugins.gittree, pushes, contributors, CIchecked
packages/cap-agents-cds-vectorstore/README.mdquoted, and what the entry declareschecked

Sources are graph entities: the same page may back several entries, and an unreachable source flags every row that rests on it.

Compatibility and provenance
runtimesnode
declared for>=10
latestv0.2.0
first release
releases and cadence1
discovered viaAdded by hand
first seen in the atlas
ecosystem and domaincap, ai-and-agents
History in the atlas1
  1. First seen.
For your agent
Ref
artifact:mi8y-cap-agents-cds-vectorstore
JSON
/artifacts/mi8y-cap-agents-cds-vectorstore.json
MCP
Connecting an agent