Spaces:
Sleeping
Sleeping
|
Download docs/md/design/data_pipeline/indicator_rag.md from thanhnv2323/humanize-text-python: direct link, hf CLI and curl.
- Browser
- Download file 1.92 kB
-
https://huggingface.co/spaces/thanhnv2323/humanize-text-python/resolve/main/docs/md/design/data_pipeline/indicator_rag.md
- Command line
-
hf download hf://spaces/thanhnv2323/humanize-text-python/docs/md/design/data_pipeline/indicator_rag.md
-
curl -L -o indicator_rag.md https://huggingface.co/spaces/thanhnv2323/humanize-text-python/resolve/main/docs/md/design/data_pipeline/indicator_rag.md
1.92 kB
Data Pipeline: PersonaIndicatorRAG
Code: adsp/data_pipeline/persona_data_pipeline/rag/indicator.py
Purpose
PersonaIndicatorRAG provides a retrieval system over persona indicators using LangChain primitives. It is a more realistic implementation of the RAG concept than the Core VectorDatabase stub.
Responsibilities
- Render each persona’s indicators into text “documents”
- Embed and store them in a vector store
- Provide similarity search and retriever interfaces
- Convert retrieved documents into a prompt-ready context string
Public API
index_persona(persona: PersonaProfileModel) -> list[str]
Adds a persona’s indicators to the vector store and returns vector store ids.
index_personas(personas: Iterable[PersonaProfileModel) -> list[str]
Batch indexing helper.
search(query: str, k: int = 5) -> list[Document]
Returns top-k similar documents.
as_retriever(k: int = 5) -> VectorStoreRetriever
Returns a retriever wrapper for LangChain chains.
documents_to_context_prompt(documents: Iterable[Document]) -> str
Renders a list of Document results to a single context string with headers, separated by ---.
Inputs/outputs
Inputs
embeddings: langchain_core.embeddings.Embeddings(caller supplies the embedding model)- personas:
PersonaProfileModelobjects (typed schema)
Outputs
- Retrieval:
langchain_core.documents.Document[] - Context:
strsuitable for injection into prompt builder
Key dependencies / technologies
langchain_community.vectorstores.FAISSlangchain_core.documents.Documentlangchain_core.embeddings.Embeddings
Notes / production hardening
- Swap the default FAISS index with a persistent vector store for production.
- Add metadata filters to enforce persona scoping at retrieval time.
- Preserve
sources(doc_id/pages) and emit citations in addition to context text.