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-aicore-vectorstore

A LangChain vector store backed by SAP AI Core Document Grounding: the collection holds the documents and makes the embeddings, and the CAP application stores no vectors of its own.

@mi8y/cap-agents-cds-vectorstore keeps documents in the CAP database; AICoreVectorStore points at a Document Grounding collection in SAP AI Core instead, so there is no CDS persistence model to deploy and no embeddings implementation to supply. Each addDocuments() call creates one Grounding document with a UUID v7 and makes every LangChain document a chunk under it, and a retrieved chunk comes back as one LangChain document with document and chunk metadata merged and the collection, document and chunk identifiers under metadata.grounding. Filtering takes SAP AI Core's own retrieval fields, documentMetadata, chunkMetadata, dataRepositoryMetadata, filter and scoringConfiguration, rather than the Mongo-style operators the CDS store accepts, and the adapter pins the collection ID, the vector repository type and the chunk count whatever the filter says. It stops at the collection's contents: delete() needs one parent Grounding document ID and removes every chunk under it, a single chunk cannot be deleted through the adapter, collection lifecycle stays outside it, and similaritySearchVectorWithScore() is unsupported because Grounding takes a text query rather than a caller's vector.

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.SAP AI CoreSAP AI CoreartifactThe Document Grounding collection it reads and writes: the package needs an existing collection and credentials for the service, through a binding or a configured destination.

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

Connections2

Install

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

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

Where it sits in your app

Download
Your CAP applicationYour SAP BTP subaccountdocumentedrequires@mi8y/cap-agents-aicore-vectorstore, module@mi8y/cap-agents-aic…SAP AI Core, service instanceSAP AI Core
SAPnot SAP's, or the project's owndocumented only

README

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

@mi8y/cap-agents-aicore-vectorstore

npm version License: MIT

A LangChain VectorStore for SAP CAP applications backed by the SAP AI Core Document Grounding service.

SAP AI Core owns document storage, embedding, and retrieval. The package therefore needs no CDS persistence model or client-side LangChain embeddings implementation.

Installation

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

Requires:

  • @sap/cds >= 10
  • @langchain/core >= 1
  • An existing SAP AI Core Document Grounding collection
  • SAP AI Core credentials through a service binding or a configured SAP Cloud SDK destination

Configuration

collectionId is required and must be the Grounding collection ID, not its human-readable title.

import { AICoreVectorStore } from "@mi8y/cap-agents-aicore-vectorstore";

const vectorStore = new AICoreVectorStore({
  collectionId: "2b0f4d00-0000-0000-0000-000000000000",
  aiResourceGroup: "default",
  destination: {
    destinationName: "aicore",
    useCache: true,
  },
});

Options:

  • collectionId: string — required Grounding collection ID.
  • aiResourceGroup?: string — value of the AI-Resource-Group header; defaults to default.
  • destination?: object — optional destination configuration. When omitted, the SAP AI SDK uses its default connection, such as an AI Core service binding.
    • destinationName: string — SAP Cloud SDK destination name.
    • useCache?: boolean — whether the SAP Cloud SDK destination cache should be used.

A CAP application can keep these values under cds.requires:

{
  "cds": {
    "requires": {
      "cap-agents-aicore-vectorstore": {
        "collectionId": "2b0f4d00-0000-0000-0000-000000000000",
        "aiResourceGroup": "default",
        "destination": {
          "destinationName": "aicore",
          "useCache": true
        }
      }
    }
  }
}

And then you can use the configuration to instantiate the AICoreVectorStore as shown below:

import cds from "@sap/cds";
import { AICoreVectorStore } from "@mi8y/cap-agents-aicore-vectorstore";

const config = cds.env.requires["cap-agents-aicore-vectorstore"];
export const vectorStore = new AICoreVectorStore(config);

Add documents

LangChain and Document Grounding use different document models:

  • A LangChain document corresponds to a Grounding chunk.
  • Grounding chunks are grouped into Grounding documents.
  • Grounding documents belong to a collection.

Each non-empty addDocuments() call creates one Grounding document with a random UUID v7. Every supplied LangChain document becomes a chunk in that parent document. If a LangChain Document.id is present, it is used as the Grounding chunk ID.

import { Document } from "@langchain/core/documents";

const groundingDocumentIds = await vectorStore.addDocuments([
  new Document({
    id: "cap-overview",
    pageContent: "SAP CAP is a framework for enterprise applications.",
    metadata: { source: "guide.md", topic: "cap" },
  }),
  new Document({
    id: "cap-services",
    pageContent: "CAP services are described using CDS.",
    metadata: { source: "guide.md", topic: "services" },
  }),
]);

Document metadata is stored on its corresponding chunk. Embeddings are generated server-side according to the collection configuration. The returned IDs are the Grounding document IDs reported by the update API, not the input chunk IDs. Passing an empty array returns an empty array without calling the API.

Search and retrievers

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

const scoredResults = await vectorStore.similaritySearchWithScore(
  "What is SAP CAP?",
  4,
);

const retriever = vectorStore.asRetriever({ k: 4 });
const documents = await retriever.invoke("What is SAP CAP?");

A retrieved Grounding chunk becomes one LangChain document. The LangChain document ID is the parent Grounding document ID. Grounding document metadata and chunk metadata are merged, and identifiers are added under metadata.grounding:

{
  collectionId: "2b0f4d00-0000-0000-0000-000000000000",
  collectionTitle: "CAP documentation",
  documentId: "0195f4c0-0000-7000-8000-000000000000",
  chunkId: "cap-overview",
}

When document and chunk metadata use the same key, chunk metadata takes precedence. The returned score uses postProcessingScore, then aggregatedScore, then denseRetrievalScore; it falls back to 0 when no score is available.

Queries must not be empty, and k must be a positive integer.

Metadata filters

Filtering uses SAP AI Core's native retrieval filter structures rather than Mongo-style operators:

const documents = await vectorStore.similaritySearch("leave policy", 4, {
  documentMetadata: [
    {
      key: "country",
      value: ["US"],
    },
  ],
  chunkMetadata: [
    {
      key: "language",
      value: ["en"],
    },
  ],
});

The filter accepts the following SAP AI Core retrieval fields:

  • documentMetadata
  • chunkMetadata
  • dataRepositoryMetadata
  • filter
  • scoringConfiguration

The adapter always enforces its configured collection ID, the vector repository type, the langchain-search filter ID, and searchConfiguration.maxChunkCount based on k. These fields cannot be overridden through the supplied filter.

Metadata conversion

Grounding represents every metadata value as string[]. Ingestion converts values as follows:

  • Strings remain strings.
  • Numbers, booleans, and bigints use String(value).
  • Arrays are converted element by element.
  • Objects and null use JSON serialization.
  • undefined properties are omitted.

On retrieval, a single value becomes a string and multiple values remain an array. Values are not automatically converted back to numbers, booleans, or objects.

Delete documents

Deletion requires one explicit parent Grounding document ID:

await vectorStore.delete({ documentId: groundingDocumentIds[0] });

Deleting a Grounding document removes all chunks associated with it. Individual chunks cannot be deleted through this adapter. Calling delete() without a documentId throws, preventing accidental collection-wide deletion. Collection lifecycle operations remain outside the LangChain vector-store adapter.

Static helpers

The static helpers follow the conventional LangChain signatures:

const fromTexts = await AICoreVectorStore.fromTexts(
  texts,
  metadata,
  embeddings,
  config,
);

const fromDocuments = await AICoreVectorStore.fromDocuments(
  documents,
  embeddings,
  config,
);

The embeddings argument is required by the LangChain API but ignored by this implementation because Document Grounding generates embeddings server-side. Both helpers create a vector store and immediately add the supplied content.

Vector operations

addVectors(vectors, documents) ignores the supplied vectors and delegates the documents to addDocuments() so that embeddings are generated server-side.

similaritySearchVectorWithScore() is unsupported because Document Grounding accepts text queries rather than caller-provided query vectors. Use similaritySearch(), similaritySearchWithScore(), or a LangChain retriever instead.

License

MIT License

MIT, read

History

Latest

v0.2.0

Features 1

Notes
Minor Changes
  • fe35713: Add AICoreVectorStore, AI-Core Document Grounding API based implementation of LangChain VectorStore API to build RAG pipelines
3downloads per week, npm
Weekly downloads for @mi8y/cap-agents-aicore-vectorstore26 complete calendar weeks from 2026-04-27 to 2026-10-25; the latest total is 3.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: 10221 Sept – 27 Sept: 1828 Sept – 4 Oct: 95 Oct – 11 Oct: 712 Oct – 18 Oct: 819 Oct – 25 Oct: 3
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-cds-vectorstoreLangChain vector store with CDS entities for embeddings
  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-aicore-vectorstoreversion, releases, installschecked
github.com/git+https://github.com/mi8y/cap-agents-plugins.gittree, pushes, contributors, CIchecked
packages/cap-agents-aicore-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-aicore-vectorstore
JSON
/artifacts/mi8y-cap-agents-aicore-vectorstore.json
MCP
Connecting an agent