Skip to content

RHIDP-14076: add top-level vector store config#2200

Open
Jdubrick wants to merge 7 commits into
lightspeed-core:mainfrom
Jdubrick:add-vector-store-section
Open

RHIDP-14076: add top-level vector store config#2200
Jdubrick wants to merge 7 commits into
lightspeed-core:mainfrom
Jdubrick:add-vector-store-section

Conversation

@Jdubrick

@Jdubrick Jdubrick commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Description

  • Adds a top-level vector store config section to allow for vector stores to be created
    • Pairs well with the /v1/vector-stores API that is available for pre-creating destinations

Example for RHDH Notebooks:

vector_store_providers:
  - id: notebooks
    type: faiss
    default: true
    embedding_model: /rag-content/embeddings_model
    embedding_dimension: 768
    config:
      path: /rag-content/vector_db/notebooks/faiss_store.db

Maps to the following in the synthesized run.yaml:

providers:
   ...
  vector_io:
    - config:
        persistence:
          backend: vsprov_notebooks_storage
          namespace: vector_io::faiss
      provider_id: notebooks
      provider_type: inline::faiss
server:
  ...
storage:
  backends:
    vsprov_notebooks_storage:
      db_path: /rag-content/vector_db/notebooks/faiss_store.db
      type: kv_sqlite
...
vector_stores:
  default_embedding_model:
    model_id: /rag-content/embeddings_model
    provider_id: sentence-transformers
  default_provider_id: notebooks

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
  • Benchmarks improvement

Tools used to create PR

Identify any AI code assistants used in this PR (for transparency and review context)

  • Assisted-by: Grok 4.5
  • Generated by: Grok 4.5

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

  • Please provide detailed steps to perform tests related to this code change.
  • How were the fix/results from this change verified? Please provide relevant screenshots or results.

Summary by CodeRabbit

  • New Features

    • Added configuration support for dynamically created vector stores using FAISS and pgvector providers.
    • Providers can specify embedding models, dimensions, storage settings, and connection details.
    • Configured default providers are automatically applied during unified configuration synthesis.
  • Documentation

    • Added setup guidance, YAML examples, validation rules, and configuration references for dynamic vector-store providers.
    • Clarified when to use dynamic provider configuration versus BYOK RAG settings.
  • Tests

    • Added coverage for provider validation, defaults, storage behavior, and configuration synthesis.

Jdubrick added 5 commits July 21, 2026 16:31
Signed-off-by: Jordan Dubrick <jdubrick@redhat.com>
Signed-off-by: Jordan Dubrick <jdubrick@redhat.com>
Signed-off-by: Jordan Dubrick <jdubrick@redhat.com>
Signed-off-by: Jordan Dubrick <jdubrick@redhat.com>
Signed-off-by: Jordan Dubrick <jdubrick@redhat.com>
@coderabbitai

coderabbitai Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

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

Next review available in: 46 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: ASSERTIVE

Plan: Pro

Run ID: e093417c-1cdc-4d8b-80ba-6709bdb24cea

📥 Commits

Reviewing files that changed from the base of the PR and between 18a58a1 and d12e99b.

📒 Files selected for processing (5)
  • docs/devel_doc/openapi.json
  • docs/user_doc/config.md
  • docs/user_doc/rag_guide.md
  • src/llama_stack_configuration.py
  • src/models/config.py

Walkthrough

Adds dynamic FAISS and pgvector vector-store provider configuration, validates provider IDs and defaults, enriches unified Llama Stack synthesis with providers and storage settings, and documents the configuration with tests and examples.

Changes

Dynamic vector-store providers

Layer / File(s) Summary
Provider configuration contracts
src/models/config.py, tests/unit/models/config/*, tests/unit/utils/test_models_dumper.py
Adds discriminated FAISS and pgvector provider models, environment-based pgvector defaults, provider validation, root configuration support, serialization expectations, and schema assertions.
Unified synthesis enrichment
src/llama_stack_configuration.py, tests/unit/test_llama_stack_configuration.py, tests/unit/test_llama_stack_synthesize.py
Maps configured providers into Llama Stack vector I/O entries, optional FAISS storage backends, registered embedding models, and vector-store defaults during unified synthesis.
Provider configuration documentation
docs/user_doc/byok_guide.md, docs/user_doc/config.md, docs/user_doc/rag_guide.md
Documents provider fields, FAISS and pgvector examples, default-provider rules, synthesis behavior, and related configuration references.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Configuration
  participant synthesize_configuration
  participant enrich_vector_store_providers
  participant LlamaStackConfig
  Configuration->>synthesize_configuration: vector_store_providers
  synthesize_configuration->>enrich_vector_store_providers: provider entries
  enrich_vector_store_providers->>LlamaStackConfig: enriched vector I/O and defaults
Loading

Possibly related PRs

Suggested reviewers: tisnik, max-svistunov

🚥 Pre-merge checks | ✅ 7
✅ Passed checks (7 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: adding top-level vector store configuration.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
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.
Performance And Algorithmic Complexity ✅ Passed No new N+1/API/DB pattern or unbounded cache; vector_store_providers validation is single-pass and enrichment is startup-only.
Security And Secret Handling ✅ Passed PASS: secret fields use SecretStr/env refs, vector-store enrichment logs only provider_id, and existing /v1/vector-stores endpoints still use auth/authz.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
✨ Simplify code
  • Create PR with simplified code

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.

Split vector store provider enrichment to satisfy pylint, and refresh
docs/devel_doc/openapi.json for the new config models.

Signed-off-by: Jordan Dubrick <jdubrick@redhat.com>
Co-authored-by: Cursor <cursoragent@cursor.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🤖 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 `@docs/user_doc/config.md`:
- Line 327: Update the FAISS provider ID description at
docs/user_doc/config.md:327-327 to document the shared validator’s
surrounding-whitespace normalization instead of claiming IDs are emitted as-is;
apply the same correction to the pgvector description at
docs/user_doc/config.md:528-528, preserving the existing format and byok_
constraints.

In `@docs/user_doc/rag_guide.md`:
- Around line 445-447: Update the unified synthesis documentation near
“vector_store_providers” to clarify that only inference models/providers require
separate configuration; distinguish embedding models as being registered
automatically by the enricher when needed.

In `@src/llama_stack_configuration.py`:
- Around line 632-651: Update _apply_vector_stores_defaults so
vector_stores["default_provider_id"] uses the same stripped string normalization
as the emitted vector_io provider_id, applying str(...).strip() to
designated["id"] before assignment. Leave the embedding-model handling
unchanged.
🪄 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: ASSERTIVE

Plan: Pro

Run ID: 8a8441f0-94b4-43f6-8d0c-83d66b18dc20

📥 Commits

Reviewing files that changed from the base of the PR and between f1eb9c9 and 18a58a1.

📒 Files selected for processing (10)
  • docs/user_doc/byok_guide.md
  • docs/user_doc/config.md
  • docs/user_doc/rag_guide.md
  • src/llama_stack_configuration.py
  • src/models/config.py
  • tests/unit/models/config/test_dump_configuration.py
  • tests/unit/models/config/test_vector_store_providers.py
  • tests/unit/test_llama_stack_configuration.py
  • tests/unit/test_llama_stack_synthesize.py
  • tests/unit/utils/test_models_dumper.py
📜 Review details
⏰ Context from checks skipped due to timeout. (14)
  • GitHub Check: build-pr
  • GitHub Check: integration_tests (3.13)
  • GitHub Check: integration_tests (3.12)
  • GitHub Check: Pylinter
  • GitHub Check: unit_tests (3.12)
  • GitHub Check: unit_tests (3.13)
  • GitHub Check: Konflux kflux-prd-rh02 / lightspeed-stack-0-7-on-pull-request
  • GitHub Check: E2E: library mode / ci / group 1
  • GitHub Check: E2E: server mode / ci / group 1
  • GitHub Check: E2E Tests for Lightspeed Evaluation job
  • GitHub Check: E2E: library mode / ci / group 3
  • GitHub Check: E2E: server mode / ci / group 3
  • GitHub Check: E2E: server mode / ci / group 2
  • GitHub Check: E2E: library mode / ci / group 2
⚠️ CI failures not shown inline (2)

GitHub Actions: OpenAPI (Spectral) / spectral: RHIDP-14076: add top-level vector store config

Conclusion: failure

View job details

##[group]Run set -euo pipefail
 �[36;1mset -euo pipefail�[0m
 �[36;1muv run python scripts/generate_openapi_schema.py /tmp/openapi-generated.json�[0m
 �[36;1mif ! diff -u docs/devel_doc/openapi.json /tmp/openapi-generated.json; then�[0m
 �[36;1m  echo "::error::docs/devel_doc/openapi.json is out of date. Regenerate with: uv run scripts/generate_openapi_schema.py docs/devel_doc/openapi.json"�[0m

GitHub Actions: OpenAPI (Spectral) / 0_spectral.txt: RHIDP-14076: add top-level vector store config

Conclusion: failure

View job details

##[group]Run set -euo pipefail
 �[36;1mset -euo pipefail�[0m
 �[36;1muv run python scripts/generate_openapi_schema.py /tmp/openapi-generated.json�[0m
 �[36;1mif ! diff -u docs/devel_doc/openapi.json /tmp/openapi-generated.json; then�[0m
 �[36;1m  echo "::error::docs/devel_doc/openapi.json is out of date. Regenerate with: uv run scripts/generate_openapi_schema.py docs/devel_doc/openapi.json"�[0m
🧰 Additional context used
📓 Path-based instructions (4)
**/*

📄 CodeRabbit inference engine (Custom checks)

**/*: Flag meaningful O(n^2)+ algorithms on non-trivial inputs, including handlers and Kubernetes list operations.
Flag N+1 patterns that list items and then query once per item, including Kubernetes API and database access.
Flag expensive work inside loops, including API calls, JSON parsing, and regex compilation.
Flag unbounded growth in caches, watchers, or buffers when eviction or limits are missing.
Flag missing pagination or limits on list operations and API endpoints.
Flag secrets or tokens logged in plaintext or hardcoded in source.
Flag API endpoints missing authentication or authorization.
Flag injection vulnerabilities, including SQL injection, command injection, and path traversal.
Flag sensitive data leaked in API responses, WebSocket messages, or logs.
Flag Kubernetes Secrets and Red Hat secrets missing OwnerReferences.

Never commit secrets or keys; use environment variables for sensitive data.

Files:

  • docs/user_doc/byok_guide.md
  • tests/unit/test_llama_stack_synthesize.py
  • tests/unit/utils/test_models_dumper.py
  • tests/unit/models/config/test_vector_store_providers.py
  • docs/user_doc/config.md
  • tests/unit/test_llama_stack_configuration.py
  • src/models/config.py
  • tests/unit/models/config/test_dump_configuration.py
  • docs/user_doc/rag_guide.md
  • src/llama_stack_configuration.py
tests/unit/**/*.py

📄 CodeRabbit inference engine (AGENTS.md)

tests/unit/**/*.py: Use pytest for unit tests, shared fixtures in conftest.py, pytest-mock for mocks, and pytest.mark.asyncio for async tests.
Maintain at least 60% unit-test coverage; add unit tests for new functionality.

Files:

  • tests/unit/test_llama_stack_synthesize.py
  • tests/unit/utils/test_models_dumper.py
  • tests/unit/models/config/test_vector_store_providers.py
  • tests/unit/test_llama_stack_configuration.py
  • tests/unit/models/config/test_dump_configuration.py
src/**/*.py

📄 CodeRabbit inference engine (AGENTS.md)

src/**/*.py: Use absolute imports for internal Python modules, complete type annotations, descriptive snake_case names, and module docstrings.
Every module, class, and function must have a descriptive Google-style docstring; document parameters, returns, raises, and class attributes where applicable.
Use logger = get_logger(__name__) from log.py for module logging and apply debug, info, warning, and error levels appropriately.
Use Final[type] annotations for constants and define shared constants in constants.py with descriptive comments.
Use async def for I/O operations and external API calls, and avoid modifying mutable parameters in place; return newly constructed data instead.
Use modern union syntax such as str | int, Optional[Type] for optional values, and typing_extensions.Self for model validators.
All configuration must use Pydantic models extending ConfigurationBase; configuration must reject unknown fields with extra="forbid".
Use @field_validator and @model_validator for custom Pydantic validation; use specific types such as Optional[FilePath], PositiveInt, and SecretStr.
Classes require descriptive docstrings, PascalCase names, complete typed attributes, and specific types instead of Any.
Use ABC and @abstractmethod for abstract interfaces; use standard suffixes such as Configuration, Error/Exception, Resolver, and Interface where applicable.

Files:

  • src/models/config.py
  • src/llama_stack_configuration.py
src/models/**/*.py

📄 CodeRabbit inference engine (AGENTS.md)

Pydantic configuration models extend ConfigurationBase, while data models extend BaseModel; use Pydantic validators for validation.

Files:

  • src/models/config.py
🧠 Learnings (5)
📚 Learning: 2026-06-24T13:45:37.249Z
Learnt from: Jdubrick
Repo: lightspeed-core/lightspeed-stack PR: 1971
File: src/utils/markdown_repair.py:31-36
Timestamp: 2026-06-24T13:45:37.249Z
Learning: In the lightspeed-stack repository, docstrings must use the section header name "Parameters:" (not "Args:") for function arguments, even if the project references Google Python docstring conventions. Ensure docstrings follow the project’s established "Parameters:" header format for any documented function parameters.

Applied to files:

  • tests/unit/test_llama_stack_synthesize.py
  • tests/unit/utils/test_models_dumper.py
  • tests/unit/models/config/test_vector_store_providers.py
  • tests/unit/test_llama_stack_configuration.py
  • src/models/config.py
  • tests/unit/models/config/test_dump_configuration.py
  • src/llama_stack_configuration.py
📚 Learning: 2026-01-12T10:58:40.230Z
Learnt from: blublinsky
Repo: lightspeed-core/lightspeed-stack PR: 972
File: src/models/config.py:459-513
Timestamp: 2026-01-12T10:58:40.230Z
Learning: In lightspeed-core/lightspeed-stack, for Python files under src/models, when a user claims a fix is done but the issue persists, verify the current code state before accepting the fix. Steps: review the diff, fetch the latest changes, run relevant tests, reproduce the issue, search the codebase for lingering references to the original problem, confirm the fix is applied and not undone by subsequent commits, and validate with local checks to ensure the issue is resolved.

Applied to files:

  • src/models/config.py
📚 Learning: 2026-02-25T07:46:33.545Z
Learnt from: asimurka
Repo: lightspeed-core/lightspeed-stack PR: 1211
File: src/models/responses.py:8-16
Timestamp: 2026-02-25T07:46:33.545Z
Learning: In the Python codebase, requests.py should use OpenAIResponseInputTool as Tool while responses.py uses OpenAIResponseTool as Tool. This difference is intentional due to differing schemas for input vs output tools in llama-stack-api. Apply this distinction consistently to other models under src/models (e.g., ensure request-related tools use the InputTool variant and response-related tools use the ResponseTool variant). If adding new tools, choose the corresponding InputTool or Tool class based on whether the tool represents input or output, and document the rationale in code comments.

Applied to files:

  • src/models/config.py
📚 Learning: 2026-07-06T15:26:18.398Z
Learnt from: Jdubrick
Repo: lightspeed-core/lightspeed-stack PR: 2071
File: src/models/config.py:2416-2422
Timestamp: 2026-07-06T15:26:18.398Z
Learning: In this repo’s Python code under src/**, don’t treat differences in string concatenation style as a style inconsistency when Black has effectively forced (or made clearer) use of explicit `+` string concatenation in multi-line logger/string expressions. If adjacent-literal implicit concatenation is avoided/changed specifically to accommodate Black’s formatting in these call sites, accept the `+` usage and don’t recommend converting it solely for consistency with nearby blocks that use implicit concatenation.

Applied to files:

  • src/models/config.py
  • src/llama_stack_configuration.py
📚 Learning: 2026-07-17T19:25:05.325Z
Learnt from: Jdubrick
Repo: lightspeed-core/lightspeed-stack PR: 2166
File: src/utils/saved_prompts.py:129-157
Timestamp: 2026-07-17T19:25:05.325Z
Learning: For any endpoint that handles saved prompts and calls `src/utils/saved_prompts.py::create_saved_prompt`, treat the endpoint as the validation boundary. Before calling `create_saved_prompt`, validate the incoming saved-prompt name and content, specifically using `validate_saved_prompt_name` and then persist (store) the normalized value it returns. Do not call `create_saved_prompt` with unvalidated/raw name/content.

Applied to files:

  • src/models/config.py
  • src/llama_stack_configuration.py
🪛 ast-grep (0.44.1)
tests/unit/test_llama_stack_synthesize.py

[info] 646-646: Do not hardcode temporary file or directory names
Context: "/tmp/notebooks.db"
Note: [CWE-377] Insecure Temporary File.

(hardcoded-tmp-file)

tests/unit/models/config/test_vector_store_providers.py

[warning] 18-18: File path is request-/variable-derived; validate and normalize to prevent path traversal.
Context: open(_BASE_CONFIG_PATH, "r", encoding="utf-8")
Note: [CWE-22] Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal').

(open-filename-from-request)


[info] 79-79: Do not hardcode temporary file or directory names
Context: "/tmp/x.db"
Note: [CWE-377] Insecure Temporary File.

(hardcoded-tmp-file)


[info] 109-109: Do not hardcode temporary file or directory names
Context: "/tmp/x.db"
Note: [CWE-377] Insecure Temporary File.

(hardcoded-tmp-file)


[info] 123-123: Do not hardcode temporary file or directory names
Context: "/tmp/x.db"
Note: [CWE-377] Insecure Temporary File.

(hardcoded-tmp-file)


[info] 137-137: Do not hardcode temporary file or directory names
Context: "/tmp/x.db"
Note: [CWE-377] Insecure Temporary File.

(hardcoded-tmp-file)


[info] 154-154: Do not hardcode temporary file or directory names
Context: "/tmp/a.db"
Note: [CWE-377] Insecure Temporary File.

(hardcoded-tmp-file)


[info] 155-155: Do not hardcode temporary file or directory names
Context: "/tmp/b.db"
Note: [CWE-377] Insecure Temporary File.

(hardcoded-tmp-file)


[info] 165-165: Do not hardcode temporary file or directory names
Context: "/tmp/a.db"
Note: [CWE-377] Insecure Temporary File.

(hardcoded-tmp-file)


[info] 166-166: Do not hardcode temporary file or directory names
Context: "/tmp/b.db"
Note: [CWE-377] Insecure Temporary File.

(hardcoded-tmp-file)


[info] 185-185: Do not hardcode temporary file or directory names
Context: "/tmp/other.db"
Note: [CWE-377] Insecure Temporary File.

(hardcoded-tmp-file)

tests/unit/test_llama_stack_configuration.py

[info] 909-909: Do not hardcode temporary file or directory names
Context: "/tmp/kv.db"
Note: [CWE-377] Insecure Temporary File.

(hardcoded-tmp-file)


[info] 1133-1133: Do not hardcode temporary file or directory names
Context: "/tmp/n.db"
Note: [CWE-377] Insecure Temporary File.

(hardcoded-tmp-file)

🔇 Additional comments (23)
docs/user_doc/byok_guide.md (1)

419-420: LGTM!

docs/user_doc/config.md (3)

250-250: LGTM!


319-326: LGTM!

Also applies to: 328-345


520-526: LGTM!

Also applies to: 529-550

docs/user_doc/rag_guide.md (5)

19-19: LGTM!


38-42: LGTM!


139-196: LGTM!


397-444: LGTM!

Also applies to: 446-447


465-469: LGTM!

src/models/config.py (4)

2132-2189: LGTM!


2192-2282: LGTM!


2864-2872: LGTM!


2941-2970: LGTM!

tests/unit/models/config/test_vector_store_providers.py (1)

1-191: LGTM!

tests/unit/models/config/test_dump_configuration.py (1)

197-197: LGTM!

Also applies to: 421-421, 781-781, 1040-1040, 1294-1294, 1513-1513, 1892-1892, 2117-2117, 2342-2342, 2574-2574

tests/unit/utils/test_models_dumper.py (1)

9168-9169: LGTM!

Also applies to: 9241-9242

src/llama_stack_configuration.py (5)

84-88: LGTM!


362-398: LGTM!


510-630: LGTM!

Also applies to: 654-723


1121-1123: LGTM!


646-651: 🗄️ Data Integrity & Integration

No action needed: vector_stores.default_embedding_model.model_id is already the provider model id. registered_resources.models[*].model_id is the synthetic internal id; the raw embedding path belongs in provider_model_id, so this default is not pointing at an unregistered model.

			> Likely an incorrect or invalid review comment.
tests/unit/test_llama_stack_configuration.py (1)

3-4: LGTM!

Also applies to: 21-21, 887-1139

tests/unit/test_llama_stack_synthesize.py (1)

633-658: LGTM!

Comment thread docs/user_doc/config.md Outdated
Comment thread docs/user_doc/rag_guide.md Outdated
Comment thread src/llama_stack_configuration.py
Signed-off-by: Jordan Dubrick <jdubrick@redhat.com>
@Jdubrick

Copy link
Copy Markdown
Contributor Author

cc @tisnik

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.

1 participant