#11753·LocalAI

Add Embedding, Reranker (and optional OCR) model fields to Agent configuration for building RAG pipelines at the agent level

Author: marcorossi85Created Aug 27, 2026Updated Sep 19, 2026
Labelsenhancementarea/apiarea/webui

Description:

Currently, the ModelSettings section of an agent's configuration exposes Model, MultimodalModel, TranscriptionModel, TranscriptionLanguage, TTSModel, and PlanReviewerModel.

However, there is no dedicated field for:

  • An Embedding Model override at the per-agent level (the only embedding model configuration today is the pool-wide LOCALAI_AGENT_POOL_EMBEDDING_MODEL / agent_pool_embedding_model setting used for the Knowledge Base, not something selectable per agent) .
  • A Reranker Model to run a second-stage relevance-scoring pass (via /v1/rerank) on Knowledge Base search results before they reach the LLM.
  • An optional OCR Model for pre-processing scanned documents/images before chunking and embedding.

Requested feature:

Extend AgentConfig (and the corresponding ModelSettings UI fields in configmeta.go) with new optional fields, e.g.:

  • embedding_model (string) — overrides the pool default EmbeddingModel for this agent's Knowledge Base ingestion/search.
  • reranker_model (string) — if set, automatically invokes /v1/rerank on the top-K KB search results before passing them to the agent's LLM context, refining relevance ordering.
  • ocr_model (string, optional) — if set, runs OCR/vision-to-text extraction on uploaded scanned documents/images before chunking, so that Knowledge Base ingestion for Enable Knowledge Base / kb_mode configmeta.go:91-101 can handle scanned PDFs and images properly.

Motivation:

Today, building an embed → rerank → LLM pipeline for RAG requires external orchestration outside of the agent configuration, since Knowledge Base collections endpoints (/api/agents/collections/:name/search, /upload, etc.) have no built-in reranking or OCR hook. Making these configurable per-agent would let users build fully self-contained multi-stage RAG pipelines natively, without needing a separate script/action to call /v1/rerank manually.

Thanks!