burgerkhan6227/tokenWise-Optimizer
๐ฏ Optimize LLM token usage by 70-90% with smart context ranking, reducing costs while maintaining quality and performance.
What's novel
๐ฏ Optimize LLM token usage by 70-90% with smart context ranking, reducing costs while maintaining quality and performance.
Code Analysis
15 files read ยท 4 roundsA FastAPI service that takes a query and a list of context items, chunks them, ranks them by relevance using OpenAI embeddings plus keyword/recency/relationship scoring, then selects the best subset within a token budget โ essentially a relevance-based context filter for LLM prompts.
Strengths
The pipeline architecture (chunk โ rank โ select โ reorder) is cleanly separated into distinct modules with clear responsibilities, and the MMR diversity selection strategy shows some algorithmic thought. The code is readable with consistent naming and reasonable docstrings throughout.
Weaknesses
Multiple bugs break core functionality (broken import in /index endpoint, cache key bug in embed_batch, camelCase example vs snake_case API), synchronous OpenAI calls block the async event loop, the vector store is dead code in the main pipeline, and the README is wildly misleading (describes a GUI desktop app with .exe/.dmg downloads when it's actually a Python API library).
Score Breakdown
Signal breakdown
Innovation
Craft
Traction
Scope
Evidence
Commits
14
Contributors
2
Files
30
Active weeks
3
Repository
Language
Python
Stars
2
Forks
0
License
MIT