Skip to content

Commit 8cfb347

Browse files
are-cesclaude
andcommitted
LCORE-1426: add SUPPORTED_BACKENDS mapping and restore doc comments
- Add SUPPORTED_BACKENDS dict to validate backend types during enrichment instead of hardcoding inline:: prefix - Restore inline comments in reranker auto-enable validator - Add backward compatibility note to RAG guide Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent f6b74d3 commit 8cfb347

3 files changed

Lines changed: 26 additions & 2 deletions

File tree

docs/rag_guide.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@ Lightspeed Core Stack (LCS) supports two complementary RAG strategies:
3434

3535
Both strategies can be enabled independently via the `rag` section of `lightspeed-stack.yaml`. See [BYOK Feature Documentation](byok_guide.md) for configuration details.
3636

37+
> [!NOTE]
38+
> **Backward compatibility:** if neither `retrieval.inline.sources` nor `retrieval.tool.sources` is
39+
> configured, all BYOK vector stores registered in llama-stack are automatically exposed as
40+
> Tool RAG (`file_search`). Inline RAG is **not** enabled in this fallback — only Tool RAG.
41+
3742
### Inline RAG chunk flow
3843

3944
```mermaid

src/llama_stack_configuration.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@
1717

1818
logger = get_logger(__name__)
1919

20+
BACKEND_TO_LLAMA_STACK_PROVIDER: dict[str, str] = {
21+
"faiss": "inline::faiss",
22+
# "pgvector": "remote::pgvector", # TODO(are-ces): add enrichment support
23+
}
24+
2025

2126
class YamlDumper(yaml.Dumper): # pylint: disable=too-many-ancestors
2227
"""Custom YAML dumper with proper indentation levels."""
@@ -335,13 +340,22 @@ def construct_vector_io_providers_section(
335340
continue
336341
existing_ids.add(provider_id)
337342
added += 1
343+
344+
backend = brag.get("backend", constants.DEFAULT_RAG_BACKEND)
345+
provider_type = BACKEND_TO_LLAMA_STACK_PROVIDER.get(backend)
346+
if provider_type is None:
347+
raise ValueError(
348+
f"Unsupported backend '{backend}' for BYOK RAG '{rag_id}'. "
349+
f"Supported backends: {list(BACKEND_TO_LLAMA_STACK_PROVIDER.keys())}"
350+
)
351+
338352
output.append(
339353
{
340354
"provider_id": provider_id,
341-
"provider_type": f"inline::{brag.get('backend', 'faiss')}",
355+
"provider_type": provider_type,
342356
"config": {
343357
"persistence": {
344-
"namespace": "vector_io::faiss",
358+
"namespace": f"vector_io::{backend}",
345359
"backend": backend_name,
346360
}
347361
},

src/models/config.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2394,10 +2394,15 @@ def validate_reranker_auto_enable(self) -> Self:
23942394
Returns:
23952395
Self: The validated configuration instance with reranker potentially enabled.
23962396
"""
2397+
# Check if BYOK RAG entries are configured
23972398
# pylint: disable=no-member
23982399
has_byok = len(self.rag.byok.stores) > 0
2400+
2401+
# Check if OKP is configured in inline RAG strategy
23992402
has_okp = constants.OKP_RAG_ID in self.rag.retrieval.inline.sources
24002403

2404+
# If both BYOK and OKP are present and reranker is using default settings,
2405+
# ensure it's enabled for optimal results
24012406
if (
24022407
has_byok
24032408
and has_okp

0 commit comments

Comments
 (0)