Adding RAG and new output mode#2
Open
mistrjirka wants to merge 4 commits intostratosphereips:mainfrom
Open
Conversation
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.
Description
This PR adds two major features to bsy-clippy:
--hide-thinkingflag to hide LLM reasoning (<think>tags) and show a spinner insteadMotivation and Context
Vector Database Feature
When processing large files through stdin, sending the entire content to the LLM can:
The vector database solves this by:
Hide Thinking Feature
Some users prefer cleaner output without the LLM's reasoning process. This feature:
<think>...</think>sections completelyAPI Key Handling Fix
Fixed an issue where localhost endpoints (127.0.0.1, localhost) required an API key even though local LLM servers like Ollama don't need authentication.
Dependencies
New dependencies added to
requirements.txtandpyproject.toml:fastembed>=0.3.0- CPU-based text embeddingshnswlib>=0.8.0- Fast approximate nearest neighbor searchnumpy>=1.24.0- Array operations for embeddingsType of change
How Has This Been Tested?
All tests were run on Python 3.13.7 with Ollama (qwen3:1.7b) on localhost.
Test 1: Vector Mode Without Chat Continuation
Command:
Expected: Should build vector index, answer the question, and exit (no interactive mode).
Result: ✅ PASSED
Test 2: Hide-Thinking Flag in Batch Mode
Command:
Expected: Should process input and show only the answer (no
<think>tags).Result: ✅ PASSED
Test 3: Hide-Thinking Flag in Stream Mode
Command:
Expected: Should show animated spinner during thinking, then display only the final answer.
Result: ✅ PASSED
Note: The whitespace represents where the spinner was displayed and then cleared
Test 4: Normal Mode (Default Behavior)
Command:
Expected: Should show colored
<think>tags with the reasoning process.Result: ✅ PASSED
Test 5: Vector Mode With Chat Continuation
Command:
Expected: Should answer question first, then enter interactive mode with RAG enabled.
Result: ✅ PASSED - Answers question, then prompts "You can now ask questions about the input data." and enters interactive mode.
Test 6: Localhost API Key Handling
Command:
Expected: Should work without API key for localhost endpoints.
Result: ✅ PASSED - No error, processes request successfully.
Test 7: Remote Endpoint API Key Requirement
Command:
Expected: Should show error requiring API key for remote endpoints.
Result: ✅ PASSED
Test Configuration
/tmp/test.txtcontaining:Checklist:
Additional Notes
Architecture Changes
Vector Index Implementation
VectorIndex- Manages embeddings and HNSW indexchunk_text()- Intelligent paragraph-aware chunking with configurable overlapbuild_vector_index()- Wrapper to create index from textSpinner Implementation
Spinner- Threaded spinner with animated framesRefactoring
handle_stdin_with_vector()- Separated logic for vector-enabled stdin processinghandle_stdin_without_vector()- Normal stdin processingNew CLI Arguments
Performance Considerations