SShortSingh.
Back to feed

Why RAG copilots silently give wrong counts and how to fix the pipeline

0
·1 views

A document-search copilot built on LangGraph and Bedrock confidently returned an incorrect document count to a user, stating 27 when the actual database total was 84. The discrepancy arose because the language model counted only the results visible in its context window, after retrieval caps, permission gates, and version deduplication had already reduced the dataset. A deeper code review revealed that a single shared state field, total_available_results, was being overwritten mid-pipeline, causing its meaning to shift from the true database total to the smaller surfaced card count. The fix involved preserving the authoritative database count in a dedicated, immutable state field that nothing downstream could overwrite. The incident highlights a broader design principle: LLMs should never compute aggregates such as counts or sums, as those answers must always come from the system of record.

Read the full story at DEV Community

This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)

Log in to join the discussion and vote.

Log in

Related stories

0
ProgrammingDEV Community ·

How AI Tools Like Claude and Copilot Are Speeding Up Code Reviews

Developers are increasingly using AI tools such as Claude, ChatGPT, and GitHub Copilot to assist with code reviews, handling routine checks for bugs, security flaws, and performance issues in seconds. These tools can be integrated into CI/CD pipelines via GitHub Actions, automatically flagging potential problems before a human reviewer ever opens a pull request. The approach is not meant to replace human reviewers but to filter out repetitive, low-level issues so engineers can focus on architecture and business logic. Pricing varies by tool, with options ranging from per-review API costs to flat-rate business subscriptions, and most offer free tiers for experimentation. Practitioners note that AI reviews are not infallible and work best when combined with human judgment, particularly for context-specific or design-level decisions.

0
ProgrammingDEV Community ·

Google Earth Adds Gemini AI Chat and Imagery Search for Web Users

Google Earth on the web has introduced two experimental Gemini-powered features: Ask Google Earth, a chat interface for natural-language geospatial analysis, and Imagery search, a multimodal tool for finding relevant satellite and aerial imagery. Ask Google Earth allows users to query the map using the active viewport, selected features, or defined areas as context, reducing the need to manually describe geographic details. The Imagery search feature scans satellite and aerial imagery to surface potentially relevant visual results, returning up to 30 non-authoritative leads that require human verification. Both features are currently experimental and available only to Professional and Professional Advanced users in the United States. Google emphasizes that the tools are meant to assist with faster discovery and preliminary analysis, not to replace established geospatial review workflows.

0
ProgrammingDEV Community ·

Nearly Half of Top News Sites Now Block OpenAI's Crawler, Reuters Institute Finds

Major news publishers are increasingly restricting AI web crawlers, with a Reuters Institute study finding that about 48% of the world's top online news sites had blocked OpenAI's GPTBot by end of 2023. The response was sharpest in the United States, where roughly 79% of leading news sites blocked OpenAI's crawler, compared to only 24% blocking Google's AI crawler globally. Publishers are concerned that their reporting may be used to train AI models or generate answers without proper compensation, attribution, or referral traffic. High-profile actions include The Guardian blocking GPTBot in September 2023 and The New York Times suing OpenAI and Microsoft in December 2023 over alleged misuse of its content. While some publishers opt for outright blocking, others like Axel Springer have pursued licensing deals, reflecting an evolving and unsettled commercial landscape for AI access to journalism.

Why RAG copilots silently give wrong counts and how to fix the pipeline · ShortSingh