Skip to content

Commit

Permalink
RAG Chunk Filter PoC
Browse files Browse the repository at this point in the history
  • Loading branch information
TamiTakamiya committed Dec 8, 2024
1 parent 55c648b commit 7b0f431
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions ols/src/query_helpers/docs_summarizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,14 @@ def summarize(
logger.warning("Proceeding without RAG content. Check start up messages.")
rag_chunks = []

# If the leading RagChunk is appended from the documents added manually to the
# aap-rag-content repo, then shorten the rag_chunks list to contain only three
# items, letting the LLM concentrate its response mainly on that specific document.
if (len(rag_chunks) > 3 and
rag_chunks[0].doc_url
.startswith("https://github.com/ansible/aap-rag-content/blob/main/")):
rag_chunks = rag_chunks[:3]

rag_context = [rag_chunk.text for rag_chunk in rag_chunks]

# Truncate history, if applicable
Expand Down

0 comments on commit 7b0f431

Please sign in to comment.