feat(intelligent-assistant): add a label to make RAG sources distinguishable - #4178
feat(intelligent-assistant): add a label to make RAG sources distinguishable#4178debsmita1 wants to merge 2 commits into
Conversation
Changed Packages
|
PR Summary by Qodofeat(intelligent-assistant): label RAG sources with LCORE source field
AI Description
Diagram
High-Level Assessment
Files changed (8)
|
Code Review by Qodo
1.
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4178 +/- ##
=======================================
Coverage 58.33% 58.34%
=======================================
Files 2432 2433 +1
Lines 96775 96793 +18
Branches 26885 26886 +1
=======================================
+ Hits 56456 56474 +18
Misses 38852 38852
Partials 1467 1467
*This pull request uses carry forward flags. Click here to find out more. Continue to review full report in Codecov by Harness.
🚀 New features to boost your workflow:
|
|
Looks good to me, thank you @debsmita1 ! |
|
@debsmita1 I verified by brining my own knowledge, the response is good. The url and tag is proper in the card is proper , but the name is not appearing. Could you please check it.
|
Local BYOK Testing GuidePrerequisites
Step 1: Prepare your knowledge sourceCreate a working directory and add your document with YAML frontmatter for citation support: mkdir -p ~/Desktop/redhat/byok-test/docsCreate ---
title: My Custom Knowledge Document
url: https://example.com/my-doc
---
# Your content here
...Step 2: Set up the Python environmentcd ~/Desktop/redhat/rhdh-rag-content
uv sync
source .venv/bin/activateStep 3: Download the embedding modelpython -c "
from sentence_transformers import SentenceTransformer
model = SentenceTransformer('sentence-transformers/all-mpnet-base-v2')
model.save('$HOME/Desktop/redhat/byok-test/embeddings_model')
print('Done — model saved.')
"Step 4: Create the custom processorCreate #!/usr/bin/env python3
"""Generate BYOK vector database from custom knowledge sources."""
import os
from lightspeed_rag_content.metadata_processor import MetadataProcessor
from lightspeed_rag_content.document_processor import DocumentProcessor
from lightspeed_rag_content import utils
class CustomMetadataProcessor(MetadataProcessor):
def __init__(self, url):
self.url = url
def url_function(self, file_path: str) -> str:
return self.url
if __name__ == "__main__":
parser = utils.get_common_arg_parser()
args = parser.parse_args()
metadata_processor = CustomMetadataProcessor(
"https://example.com/my-doc", # fallback URL for docs without frontmatter
)
document_processor = DocumentProcessor(
args.chunk, args.overlap, args.model_name, args.model_dir,
args.workers, args.vector_store_type,
)
try:
document_processor.process(args.folder, metadata=metadata_processor)
document_processor.save(args.index, args.output)
finally:
if hasattr(document_processor, "db") and hasattr(document_processor.db, "tmp_dir"):
document_processor.db.tmp_dir.cleanup()
print("Done — vector database saved.")
os._exit(0)Step 5: Build the vector indexcd ~/Desktop/redhat/byok-test
python custom_processor.py \
-f ./docs \
-o ./vector_db/my_knowledge \
-i v1 \
--vector-store-type=llamastack-faiss \
-md ./embeddings_model \
-mn sentence-transformers/all-mpnet-base-v2 \
--chunk 512 \
--overlap 128Step 6: Extract the vector_db_idpython -c "
import sqlite3, json
conn = sqlite3.connect('./vector_db/my_knowledge/faiss_store.db')
rows = conn.execute('SELECT key FROM kvstore').fetchall()
for r in rows:
if 'vector_stores' in r[0]:
vid = r[0].split('::')[-1]
print(f'vector_db_id: {vid}')
break
conn.close()
"Note the printed Step 7: Copy BYOK data into the rag-content volumecp -r ~/Desktop/redhat/byok-test/vector_db/my_knowledge \
~/Desktop/redhat/lightspeed-configs/rag-content/vector_db/Step 8: Configure lightspeed-stack.yamlAdd/update the byok_rag:
- rag_id: my-knowledge
rag_type: inline::faiss
embedding_model: sentence-transformers//rag-content/embeddings_model
embedding_dimension: 768
vector_db_id: <your-vector-db-id-from-step-6>
db_path: /rag-content/vector_db/my_knowledge/faiss_store.db
score_multiplier: 1.2
rag:
inline:
- my-knowledge # deterministic — always injects context
tool:
- my-knowledge # probabilistic — LLM calls file_search on demandStep 9: Restart LCOREcd ~/Desktop/redhat/lightspeed-configs
make local-down && make local-upWait ~30 seconds, then verify: # Check container is healthy
podman ps --format '{{.Status}} {{.Names}}' | grep lightspeed
# Check readiness
curl -s http://localhost:8080/readiness
# Check models are registered
curl -s http://localhost:8080/v1/models | python3 -m json.toolStep 10: Start the Backstage frontend and testcd <rhdh-plugins>/workspaces/intelligent-assistant
yarn install
yarn startOpen
Troubleshooting
|
| top: 'var(--pf-t--global--spacer--sm)', | ||
| right: 'var(--pf-t--global--spacer--sm)', | ||
| zIndex: 1, | ||
| ...ragSourceLabelAppearance, |
There was a problem hiding this comment.
These overrides are always been an headache. I hope you have added it as minimum as possible.
Screen.Recording.2026-08-06.at.4.11.25.PM.mov |
There was a problem hiding this comment.
The doc_title: "---" was not a PR bug — it was a document preparation issue. The rag-content processor uses the first line of the markdown file as the title, and since the source document started with YAML frontmatter (---), that delimiter became the title. Removing the frontmatter and rebuilding the vector index fixed it.
/lgtm
S_.2026-08-07.at.5.54.21.PM.mov
b493a87 to
a9d0272
Compare
|
New changes are detected. LGTM label has been removed. |
|




Hey, I just made a Pull Request!
Resolves:
https://redhat.atlassian.net/browse/RHIDP-14152
Solution description:
Show each RAG citation’s LCORE source as a pill label on source cards and in the sources modal so knowledge bases are distinguishable.
Screenshot:

✔️ Checklist