Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 15 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -459,19 +459,22 @@ conversation_cache:
authentication:
module: "noop"

byok_rag:
- rag_id: custom-docs-0_1
rag_type: inline::faiss
embedding_model: sentence-transformers/all-mpnet-base-v2
embedding_dimension: 768
vector_db_id: <generated-vector-store-id>
db_path: /home/<user>/rag-content/vector_db/custom_docs/0.1/faiss_store.db

rag:
# inline:
# - custom-docs-0_1
tool:
- custom-docs-0_1
byok:
stores:
- rag_id: custom-docs-0_1
backend: faiss
embedding_model: sentence-transformers/all-mpnet-base-v2
embedding_dimension: 768
vector_db_id: <generated-vector-store-id>
db_path: /home/<user>/rag-content/vector_db/custom_docs/0.1/faiss_store.db
retrieval:
# inline:
# sources:
# - custom-docs-0_1
tool:
sources:
- custom-docs-0_1
Comment on lines 462 to +477

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Update db_path in the example to match the generated template.

The generated configuration now wraps the db_path with an environment variable fallback (${env.RAG_DB_PATH:=...}). Please consider updating the example to accurately reflect the actual generated lightspeed-stack.yaml.

📝 Proposed fix
-        db_path: /home/<user>/rag-content/vector_db/custom_docs/0.1/faiss_store.db
+        db_path: ${env.RAG_DB_PATH:=/home/<user>/rag-content/vector_db/custom_docs/0.1/faiss_store.db}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
rag:
# inline:
# - custom-docs-0_1
tool:
- custom-docs-0_1
byok:
stores:
- rag_id: custom-docs-0_1
backend: faiss
embedding_model: sentence-transformers/all-mpnet-base-v2
embedding_dimension: 768
vector_db_id: <generated-vector-store-id>
db_path: /home/<user>/rag-content/vector_db/custom_docs/0.1/faiss_store.db
retrieval:
# inline:
# sources:
# - custom-docs-0_1
tool:
sources:
- custom-docs-0_1
rag:
byok:
stores:
- rag_id: custom-docs-0_1
backend: faiss
embedding_model: sentence-transformers/all-mpnet-base-v2
embedding_dimension: 768
vector_db_id: <generated-vector-store-id>
db_path: ${env.RAG_DB_PATH:=/home/<user>/rag-content/vector_db/custom_docs/0.1/faiss_store.db}
retrieval:
# inline:
# sources:
# - custom-docs-0_1
tool:
sources:
- custom-docs-0_1
🤖 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 `@README.md` around lines 462 - 477, Update the db_path value in the README
rag.byok.stores example to use the generated configuration template format,
including the ${env.RAG_DB_PATH:=...} environment-variable fallback around the
existing default path.

```

Once we have a database we can use script `query_rag.py` to check some results:
Expand Down
62 changes: 34 additions & 28 deletions src/lightspeed_rag_content/config_templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,37 +160,43 @@
"""

LCS_FAISS_BYOK_TEMPLATE = """\
byok_rag:
- rag_id: {index_id}
rag_type: inline::faiss
embedding_model: {model_name}
embedding_dimension: {dimension}
vector_db_id: {vector_store_id}
db_path: ${{env.RAG_DB_PATH:={db_path}}}

rag:
# inline:
# - {index_id}
tool:
- {index_id}
byok:
stores:
- rag_id: {index_id}
backend: faiss
embedding_model: {model_name}
embedding_dimension: {dimension}
vector_db_id: {vector_store_id}
db_path: ${{env.RAG_DB_PATH:={db_path}}}
retrieval:
# inline:
# sources:
# - {index_id}
tool:
sources:
- {index_id}
"""

LCS_PGVECTOR_BYOK_TEMPLATE = """\
byok_rag:
- rag_id: {index_id}
rag_type: remote::pgvector
embedding_model: {model_name}
embedding_dimension: {dimension}
vector_db_id: {vector_store_id}
host: ${{env.POSTGRES_HOST}}
port: ${{env.POSTGRES_PORT}}
db: ${{env.POSTGRES_DATABASE}}
user: ${{env.POSTGRES_USER}}
password: ${{env.POSTGRES_PASSWORD}}

rag:
# inline:
# - {index_id}
tool:
- {index_id}
byok:
stores:
- rag_id: {index_id}
backend: pgvector
embedding_model: {model_name}
embedding_dimension: {dimension}
vector_db_id: {vector_store_id}
host: ${{env.POSTGRES_HOST}}
port: ${{env.POSTGRES_PORT}}
db: ${{env.POSTGRES_DATABASE}}
user: ${{env.POSTGRES_USER}}
password: ${{env.POSTGRES_PASSWORD}}
retrieval:
# inline:
# sources:
# - {index_id}
tool:
sources:
- {index_id}
"""
18 changes: 11 additions & 7 deletions tests/test_document_processor_llama_stack.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,15 +227,17 @@ def test_write_lcs_config_faiss(self, mocker, llama_stack_processor):
assert "service:" in data
assert "llama_stack:" in data
assert "authentication:" in data
assert "byok_rag:" in data
assert "rag_type: inline::faiss" in data
assert "byok:" in data
assert "stores:" in data
assert "backend: faiss" in data
assert "rag_id: my-index" in data
assert "vector_db_id: vs_abc123" in data
assert "${env.RAG_DB_PATH:=/data/faiss_store.db}" in data
assert "embedding_dimension: 768" in data
assert f"embedding_model: {llama_stack_processor['model_name']}" in data
assert "rag:" in data
assert "retrieval:" in data
assert "tool:" in data
assert "sources:" in data
assert "- my-index" in data

def test_write_lcs_config_pgvector(self, mocker, llama_stack_processor):
Expand All @@ -253,20 +255,22 @@ def test_write_lcs_config_pgvector(self, mocker, llama_stack_processor):
assert "service:" in data
assert "llama_stack:" in data
assert "authentication:" in data
assert "byok_rag:" in data
assert "rag_type: remote::pgvector" in data
assert "byok:" in data
assert "stores:" in data
assert "backend: pgvector" in data
assert "rag_id: pg-index" in data
assert "vector_db_id: vs_pg123" in data
byok_section = data[data.index("byok_rag:") :]
byok_section = data[data.index("byok:") :]
assert "db_path" not in byok_section
assert f"embedding_model: {llama_stack_processor['model_name']}" in data
assert "${env.POSTGRES_HOST}" in data
assert "${env.POSTGRES_PORT}" in data
assert "${env.POSTGRES_DATABASE}" in data
assert "${env.POSTGRES_USER}" in data
assert "${env.POSTGRES_PASSWORD}" in data
assert "rag:" in data
assert "retrieval:" in data
assert "tool:" in data
assert "sources:" in data
assert "- pg-index" in data

def test_run_llama_stack(self, mocker, llama_stack_processor):
Expand Down
Loading