Skip to content

LCORE-2436: Update rag-content to generate lightspeed-stack config together with Llama Stack config#219

Open
are-ces wants to merge 5 commits into
lightspeed-core:mainfrom
are-ces:lcore-2436-lcs-config-output-v2
Open

LCORE-2436: Update rag-content to generate lightspeed-stack config together with Llama Stack config#219
are-ces wants to merge 5 commits into
lightspeed-core:mainfrom
are-ces:lcore-2436-lcs-config-output-v2

Conversation

@are-ces

@are-ces are-ces commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Description

After building a vector database, rag-content now generates a full, runnable lightspeed-stack.yaml alongside the existing llama-stack.yaml. The generated config includes all required LCS sections (service, llama_stack, authentication, conversation_cache, user_data_collection) plus the byok_rag entry and rag retrieval strategy for the generated vector store.

Both FAISS and pgvector backends are supported. The llama-stack config template is also updated with agents and safety APIs required by LCS.

Changes:

  • Add write_lcs_config() method with base + FAISS/pgvector BYOK templates
  • Call it from save() to write lightspeed-stack.yaml in the output directory
  • Update llama-stack template to include agents and safety APIs/providers
  • Update README to document the new output
  • Add unit tests for both backends and integration test assertions

Type of change

  • Refactor
  • New feature
  • Bug fix
  • CVE fix
  • Optimization
  • Documentation Update
  • Configuration Update
  • Bump-up service version
  • Bump-up dependent library
  • Bump-up library or tool used for development (does not change the final image)
  • CI configuration change
  • Konflux configuration change
  • Unit tests improvement
  • Integration tests improvement
  • End to end tests improvement

Tools used to create PR

  • Assisted-by: Claude Opus 4.6
  • Generated by: Claude Opus 4.6

Related Tickets & Documents

Checklist before requesting a review

  • I have performed a self-review of my code.
  • PR has passed all pre-merge test jobs.
  • If it is a core feature, I have added thorough tests.

Testing

  1. Run uv run make test-unit — all 207 tests pass
  2. E2E validated: generated vector DB + configs, started LCS in service mode with the generated lightspeed-stack.yaml + llama-stack.yaml, queried /v1/query and received RAG-augmented response with chunks from the test document

Summary by CodeRabbit

  • New Features

    • Added support for generating an additional Lightspeed configuration alongside the main setup output.
    • Expanded the generated configuration to better support retrieval-augmented workflows and multiple storage backends.
  • Bug Fixes

    • Updated the generated configuration structure and example output for improved consistency and completeness.
    • Refreshed the documentation sample to match the latest generated files and settings.

are-ces and others added 3 commits July 2, 2026 13:55
…ck.yaml

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
… snippet

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…tegy to LCS config

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 3, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@are-ces, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 44 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 028c606a-f2f5-450a-b3d5-ca6b65edc4af

📥 Commits

Reviewing files that changed from the base of the PR and between 8b495c1 and 2f640e5.

📒 Files selected for processing (4)
  • README.md
  • src/lightspeed_rag_content/config_templates.py
  • src/lightspeed_rag_content/document_processor.py
  • tests/test_document_processor_llama_stack.py

Walkthrough

This PR adds Lightspeed Core Stack (LCS) configuration generation for BYOK RAG flows. It introduces new YAML templates for FAISS and PGVector backends, a write_lcs_config() helper wired into save(), updates the embedded Llama-Stack template with agents/safety APIs, and updates tests and README accordingly.

Changes

LCS BYOK Configuration Generation

Layer / File(s) Summary
Llama-Stack template updates
src/lightspeed_rag_content/document_processor.py
Adds agents/safety to the apis list and adds an agents provider with persistence and SQL-backed responses in the embedded template.
LCS config templates and helper
src/lightspeed_rag_content/document_processor.py
Adds LCS_CFG_FILENAME, LCS_BASE_TEMPLATE, FAISS/PGVector BYOK templates, and write_lcs_config() that selects a template by provider type and writes the resulting YAML.
Save() wiring
src/lightspeed_rag_content/document_processor.py
Extends save() to compute the LCS config path and call write_lcs_config() with the vector store id and db path.
Test updates
tests/test_document_processor_llama_stack.py
Updates expected YAML fixtures, adds write_lcs_config tests for FAISS/pgvector, and extends _test_save to assert write_lcs_config invocation.
README documentation update
README.md
Replaces the old barebones llama-stack.yaml example with a description of the generated lightspeed-stack.yaml byok_rag snippet.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Caller
  participant LlamaStackDB as _LlamaStackDB
  participant Disk

  Caller->>LlamaStackDB: save()
  LlamaStackDB->>LlamaStackDB: create vector store, update llama-stack.yaml
  LlamaStackDB->>LlamaStackDB: write_lcs_config(provider_type, vector_store_id, db_path)
  LlamaStackDB->>LlamaStackDB: select FAISS or PGVector BYOK template
  LlamaStackDB->>LlamaStackDB: concatenate with LCS_BASE_TEMPLATE
  LlamaStackDB->>Disk: write lightspeed-stack.yaml
Loading

Related PRs: None found.

Suggested labels: enhancement, documentation

Suggested reviewers: None identified.

Poem

A rabbit hops with YAML in paw,
BYOK configs, no more a flaw,
FAISS or Postgres, pick your db,
Agents now join the API,
lightspeed-stack.yaml, written with glee! 🐰

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: generating lightspeed-stack config alongside Llama Stack config.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (2)
src/lightspeed_rag_content/document_processor.py (2)

410-477: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Duplicate rag: block across FAISS/PGVector BYOK templates.

LCS_FAISS_BYOK_TEMPLATE and LCS_PGVECTOR_BYOK_TEMPLATE share an identical trailing rag: section. Consider factoring this shared tail into a common template fragment to avoid future drift between the two variants.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/lightspeed_rag_content/document_processor.py` around lines 410 - 477, The
FAISS and PGVector BYOK template constants in document_processor.py duplicate
the same trailing rag section, so refactor the shared suffix into a single
reusable fragment and have LCS_FAISS_BYOK_TEMPLATE and
LCS_PGVECTOR_BYOK_TEMPLATE compose it, keeping the unique byok_rag portions
separate to reduce drift and make updates easier.

867-869: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Parameter ordering differs from write_yaml_config.

write_lcs_config(index, filename, vector_store_id, db_file) orders vector_store_id before db_file, while the sibling write_yaml_config(index_id, filename, db_file, files_metadata_db_file) puts db-related params first. Minor consistency nit, not blocking.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/lightspeed_rag_content/document_processor.py` around lines 867 - 869, The
parameter order in write_lcs_config is inconsistent with write_yaml_config and
should be aligned for readability and API consistency. Update write_lcs_config
in document_processor.py so the db-related argument comes before the vector
store identifier, matching the ordering style used by write_yaml_config and any
internal call sites that may rely on this convention.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@README.md`:
- Around line 435-445: The README example currently reads like a complete
lightspeed-stack.yaml, but it is only the BYOK excerpt. Update the wording
around the byok_rag YAML snippet to explicitly say it is a partial example or
excerpt and that the generator also writes other required top-level sections, so
readers do not copy it as a full config.

In `@src/lightspeed_rag_content/document_processor.py`:
- Around line 308-313: The template’s provider list is missing the required
safety provider even though apis now includes safety. Update the provider
registration in document_processor so it also adds the matching providers.safety
entry with the inline::llama-guard provider, alongside the existing agents,
files, inference, tool_runtime, vector_io, and safety API setup.

---

Nitpick comments:
In `@src/lightspeed_rag_content/document_processor.py`:
- Around line 410-477: The FAISS and PGVector BYOK template constants in
document_processor.py duplicate the same trailing rag section, so refactor the
shared suffix into a single reusable fragment and have LCS_FAISS_BYOK_TEMPLATE
and LCS_PGVECTOR_BYOK_TEMPLATE compose it, keeping the unique byok_rag portions
separate to reduce drift and make updates easier.
- Around line 867-869: The parameter order in write_lcs_config is inconsistent
with write_yaml_config and should be aligned for readability and API
consistency. Update write_lcs_config in document_processor.py so the db-related
argument comes before the vector store identifier, matching the ordering style
used by write_yaml_config and any internal call sites that may rely on this
convention.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: de5b712a-e269-4d02-970e-af6f7c6fa620

📥 Commits

Reviewing files that changed from the base of the PR and between ecbe0ca and 8b495c1.

📒 Files selected for processing (3)
  • README.md
  • src/lightspeed_rag_content/document_processor.py
  • tests/test_document_processor_llama_stack.py

Comment thread README.md
Comment thread src/lightspeed_rag_content/document_processor.py Outdated
are-ces and others added 2 commits July 3, 2026 15:57
Fixes pylint too-many-lines (C0302) by moving all llama-stack and
LCS configuration templates to config_templates.py.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@are-ces

are-ces commented Jul 3, 2026

Copy link
Copy Markdown
Contributor Author

@syedriko Question: should I update the e2e tests to use the generated lightspeed-stack.yaml config instead of the llama-stack.yaml config?

@syedriko

syedriko commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator

/retest

@syedriko

syedriko commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator

@syedriko Question: should I update the e2e tests to use the generated lightspeed-stack.yaml config instead of the llama-stack.yaml config?

Absolutely!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants