Assessment: spaCy + scikit-learn query classification and adaptive RAG routing#2
Closed
Copilot wants to merge 2 commits into
Closed
Assessment: spaCy + scikit-learn query classification and adaptive RAG routing#2Copilot wants to merge 2 commits into
Copilot wants to merge 2 commits into
Conversation
Agent-Logs-Url: https://github.com/Unknown27s/Astro_bot/sessions/25dc0ffb-1841-4216-89aa-527609c95ee9 Co-authored-by: Unknown27s <174230120+Unknown27s@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Analyze application stack for potential improvements
Add TECH_STACK.md — full stack inventory and future improvement roadmap
Apr 1, 2026
Copilot stopped work on behalf of
Unknown27s due to an error
April 1, 2026 12:55
Copilot
AI
changed the title
Add TECH_STACK.md — full stack inventory and future improvement roadmap
Assessment: spaCy + scikit-learn query classification and adaptive RAG routing
Apr 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
User proposed using spaCy and scikit-learn to classify query intent, then routing to full RAG vs. semantic-only retrieval based on type. No implementation was requested — this PR captures the technical assessment.
Findings
Current pipeline is one-size-fits-all
Every query — including greetings and simple definitions — runs the full
retrieve → format → LLMchain. A classifier layer eliminates unnecessary retrieval and LLM calls for conversational and conceptual queries.Recommended routing by query type
Tool fit is good
spacy en_core_web_sm(~12 MB) covers POS, dependency parsing, and NER — sufficient to distinguish "how many" (factual) from "how to" (procedural) and identify named-entity queriessklearnTF-IDF cosine similarity over per-category seed phrases is a lightweight fallback for ambiguous inputsentence-transformersand ChromaDB are already present, so semantic-only mode adds zero new infrastructureKey implementation notes (when ready)
en_core_web_smrequirespython -m spacy download en_core_web_smpost-install; needs aDockerfile.apistepspacy>=3.7.0andscikit-learn>=1.4.0torequirements.txt(no known CVEs on current releases)threading.Lock()pattern inembedder.py) — classifier must not block the request threadOriginal prompt