Posts

Showing posts from November, 2026

How to Install RAGAS on Windows When pip install ragas Fails

Short answer: If pip install ragas fails on Windows, the most reliable fix is to create a virtual environment with an older, well-supported Python version (such as 3.11) and install RAGAS there. If you have to stay on a very new Python release, you can install RAGAS without its dependencies, add the missing packages one at a time, and patch out an import you do not use. Both routes are below. I hit this while evaluating a RAG tutor project. I needed RAGAS scores (faithfulness, answer relevancy, context precision and context recall) for two versions of the pipeline, and the install kept failing on a Windows machine running Python 3.14. This post is the fix that worked, plus the cleaner route I would take next time. Why does pip install ragas fail on Windows? RAGAS pulls in a large tree of dependencies through LangChain and its integrations. On a very new Python version, some of those packages may not have pre-built Windows wheels yet, so pip tries to build them from source and fails. ...

Adaptive Top-k Retrieval: 17% Fewer RAG Input Tokens With No Extra LLM Calls

Image
Short answer: Adaptive top-k retrieval lets a RAG system choose how many passages to send to the LLM for each question, based on the drop in similarity scores. In my benchmark it used 17% fewer input tokens than a fixed top-k of 5, with no extra LLM calls and no loss in answer quality. Most RAG pipelines retrieve a fixed number of passages for every question, usually five. That is simple, but it is wasteful. A question like "Who wrote this book?" needs one passage. A question that compares two things may need four or five. With a fixed k, the easy questions pay for context they do not need, and the extra passages can distract the model. I tested a small change: let the retriever decide how many passages to keep for each query, using only the similarity scores it already has. This post covers how it works, what the numbers were, and where the evidence is still thin. What is adaptive top-k retrieval? When you search a vector store, the results come back with similarity scores....