Skip to content

embedding component reference ​

This page lists every field and option. The overview shows what it does and a first example.

The embedding component runs one embedding operation and returns a structured result. It uses a SQLite keyword store for index, search, upsert, and delete. It uses an embedding backend for vectorize and embed_query, and Cohere for rerank.

It comes from the components asset set. Call it with a component: resource. You do not install it. It calls the embedding tool of the kdeps API. This tool runs the native executor. kdeps rejects a workflow that uses embedding: directly, as primary or in a before:/after: step.

It runs as a workflow step.

component: embeddingPOST /tools/embedding/callSQLite keyword storeindex, search, upsert, deleteembedding backendvectorize, embed_queryCoherererankresult mapoperation index/search/upsert/deleteoperation vectorize/embed_queryoperation rerank

Configuration ​

yaml
# resources/store.yaml
actionId: store
name: Store Document
component:
  name: embedding                   # from the components asset set; a components/embedding/ of your own wins
  with:
    operation: index                # required: index | search | upsert | delete | vectorize | embed_query | rerank
    text: "{{ get('text') }}"       # text to index, search for, upsert or delete
    collection: docs                # optional namespace (default: "default")
    dbPath: /data/store.db          # optional SQLite path; default from the kdeps embedding defaults
    limit: 5                        # optional max search results
InputTypeRequiredDefaultDescription
operationstringyes-index, search, upsert, delete, vectorize, embed_query, or rerank
textstringsee below-Text to index, search for, upsert, or delete. Required for index, search, and upsert; empty deletes the whole collection on delete
collectionstringno"default"Namespace inside the SQLite database
dbPathstringnokdeps embedding defaultSQLite database file path
limitnumbernokdeps embedding defaultMax results for search
inputsarrayyes for vectorize, embed_query-Texts to embed
modelstringnobackend defaultEmbedding model, e.g. text-embedding-3-small
backendstringnokdeps LLM backendopenai, ollama, or google
baseURLstringno-Custom base URL for an OpenAI-compatible backend
rerankQuerystringyes for rerank-Query the candidate documents are ranked against
rerankDocumentsarrayyes for rerank-Candidate documents to rerank
rerankTopNnumberno0 (all)Number of top reranked results

Operations ​

OperationBackingDescription
indexSQLiteInsert text (ignored if duplicate)
upsertSQLiteInsert or replace text
searchSQLiteTexts holding every query word, matched by stem with the local search tokenizer (search.yaml), closest word overlap first
deleteSQLiteDelete by text, or the whole collection when text is empty
vectorizeembedding backendConvert inputs into vectors
embed_queryembedding backendConvert text into a query vector
rerankCohereRank rerankDocuments against rerankQuery

Output ​

json
{
  "operation": "search",
  "collection": "docs",
  "query": "compiled language",
  "results": ["Go is a statically typed, compiled programming language."],
  "count": 1,
  "json": "{\"collection\":\"docs\",...}"
}

Read fields with output('store').results, output('store').count, and so on.

KeyTypeDescription
operationstringThe operation that was performed
collectionstringThe collection used
successbooltrue on success
results[]stringMatching texts (search only)
countintegerNumber of results (search only)
affectedintegerRows deleted (delete only)
jsonstringFull result as a JSON string

A failed operation does not return this map: the call fails and onError: on the resource decides what happens next.

Examples ​

Build a RAG pipeline ​

yaml
# Step 1: Scrape content
actionId: fetch
component:
  name: web_scraper
  with:
    url: "{{ get('url') }}"

# Step 2: Index it
actionId: storeDoc
flow:
  requires: [fetch]
  requires: [findDocs]
component:
  name: embedding
  with:
    operation: index
    text: "{{ output('fetch').content }}"
    collection: knowledge
    dbPath: /data/store.db

# Step 3: Search on user query
actionId: findDocs
component:
  name: embedding
  with:
    operation: search
    text: "{{ get('query') }}"
    collection: knowledge
    dbPath: /data/store.db
    limit: 5

# Step 4: Answer with context
actionId: answer
chat:
  model:
    name: llama3.2:1b
  context:
    prompt: |
      Context: {{ output('findDocs').results }}
      Question: {{ get('query') }}
apiResponse:
  response: "{{ output('answer') }}"

Vector embeddings ​

yaml
# resources/embed.yaml
actionId: embed
component:
  name: embedding
  with:
    operation: vectorize
    inputs: ["{{ get('text') }}"]    # texts to embed
    model: text-embedding-3-small
    backend: openai                  # KDEPS_OPENAI_API_KEY or ~/.kdeps/config.yaml

Collections ​

Use collection to namespace documents - useful for multi-tenant or multi-topic stores:

yaml
# Index into separate collections
component:
  name: embedding
  with:
    operation: index
    text: "..."
    collection: contracts

# Search only within one collection
component:
  name: embedding
  with:
    operation: search
    text: termination clause
    collection: contracts

Note: index, search, upsert, and delete use keyword matching (every query word, by stem), not vector similarity. Use vectorize and embed_query with a backend for vector embeddings.

See also ​

kdeps has the Apache 2.0 License.