tutorials

Different Sources: Not Every Answer Lives in Embedded Text

15 min read

A supplier asked the portal assistant when invoice INV-1042 would be paid. The assistant answered from the payment-terms page: approved invoices are paid in 30 days. The page was current. It still could not answer the question. In the invoice system, INV-1042 was blocked because the purchase-order number on the invoice did not match the order on file. Until someone fixed the mismatch, there was no payment date to quote.

The document retriever did its job. It found the right policy document and passed it to the model. But the answer failed because the source of truth was a database row. The document index contained payment terms. The invoice’s state lived elsewhere.

This is Post 3 in the Retrieval Patterns series. Post 1 covered the upgrades every production RAG makes first, and Post 2 covered the patterns for when the question is the problem. This post moves behind both of them, to the source itself.

When the source is the problem

The first two posts assumed the answer could be represented as embedded text. That assumption covers a large share of knowledge bases, policy libraries, documentation portals, and support archives. It breaks the moment the answer depends on exact state, live state, connected state, visual evidence, or a sequence of events.

Vector search answers a narrow question: what text looks closest to this query? Business users ask different questions. When will this invoice be paid? Where is this order right now? Which supplier feeds the factory behind this recall? Which diagram shows the connector? What changed in the last ten minutes?

The five patterns in this group change what counts as a source. SQL retrieval asks the database. API-augmented retrieval asks the live system. GraphRAG follows relationships. Multimodal retrieval reaches evidence that never became prose. StreamingRAG keeps pace with events as they arrive.

Each one adds an owner. A schema needs maintenance. An API contract can change. Entity graphs can merge the wrong entities. Visual pipelines can misread charts. Event streams can carry bad events. The source becomes more useful and more operational at the same time.

Structured retrieval (SQL RAG)

Vector search treats every fact as if it were written somewhere in prose. Structured retrieval starts from the opposite premise: the fact already exists in a table, so retrieve the row. The system turns the user’s question into SQL, validates that query against the schema and permissions, runs it against the database, and hands the returned rows to the model.

The model still writes the final answer, but the factual core comes from the database. That makes the result easier to inspect. A reviewer can look at the generated SQL, the rows returned, and the answer written around them. The database facts are exact. The model can still write the wrong explanation, which is why the query and rows need to stay visible in traces.

The difficult part is schema meaning. A question like “what was revenue last quarter” depends on whether the business means booked, billed, collected, or recognized revenue. The Spider text-to-SQL benchmark showed how hard arbitrary schema mapping can be when questions require joins across unfamiliar tables. Production systems narrow that problem with semantic layers, curated views, allowed tables, query validation, and audit logs.

An invoice payment question answered from the live invoice row, versus a payment-terms page producing a confident but incomplete answer SQL retrieval answers from the invoice status row; the document path can quote policy without knowing the invoice is blocked.

Where it earns its keep. Exact facts with a clear system of record: invoice status, inventory counts, order totals, account balances, shipment quantities, entitlement status, usage meters, and operational metrics. It matters most when the cost of a wrong number is higher than the cost of a slower answer.

Example. The assistant translates "when will INV-1042 be paid" into a query for invoice status, approval state, block reason, and payment terms. The row says blocked, with a purchase-order mismatch. The assistant explains that the 30-day term does not produce a date while the invoice is blocked. The payment-terms page can stay in the document index as policy context, but the team no longer treats it as invoice state.

Where it doesn’t. SQL retrieval cannot answer questions whose evidence lives in prose, images, events, or informal business logic. It also fails when the schema does not encode the concept the user asked about. A generated query can be syntactically valid and semantically wrong, which is worse than no query because it returns precise-looking nonsense.

Counterexample. A merchandising analyst asks why a product line is underperforming. The database can return sales, returns, discounts, and stock positions, but the reason sits in customer complaints, campaign notes, pricing experiments, and supplier conversations. SQL gives the model clean numbers and no cause. A second failure hides underneath: the generated query uses order date where the business expects delivery date, so even the numbers answer the wrong question.
Paper or production? paper
production

Production under constraints. Text-to-SQL remains difficult across arbitrary schemas, but bounded production systems already use it through semantic layers and controlled database access. The winning version is narrow, inspected, constrained, and built for permission-aware retrieval.

API-augmented RAG

In many architectures, the system of record sits behind an application boundary. The database underneath belongs to another team or vendor. API-augmented retrieval treats live endpoints as sources. The system decides which endpoint to call, passes the right parameters, receives structured data, shapes it into context, and lets the model answer from the response.

The pattern predates the current tool-use wave in spirit. The 2023 Toolformer paper showed a language model learning when to call external APIs and how to use their responses. Production systems now do the same thing in operational terms: endpoint contracts, authentication, retries, timeouts, response filters, and logs.

The distinction from SQL retrieval matters. Use SQL when the database is yours and the question is an ad-hoc read over relational data. Use an API when the owning system exposes the operation you need, when permissions are enforced at that boundary, or when copying the data into your own store would create a freshness or ownership problem.

An order-status question answered by a live operations API, versus a bot falling back to a stale cached page during an endpoint outage API augmentation reaches the systems that own current state; the fallback path can turn a stale cache into a confident answer.

Where it earns its keep. Current operational state: order status, payment state, shipment location, inventory availability, delivery slots, subscription state, service health, account entitlements, and live pricing. Any answer that changes faster than the ingestion cycle belongs here.

Example. A customer asks why an order has not moved. The support bot calls the order-management API, sees a payment authorization retry, then calls the shipment API and finds no label created. The answer is specific because the bot reached the systems that own the state. A document index full of shipping policy pages would have produced a polite guess.

Where it doesn’t. Every call inherits the endpoint’s latency, failure rate, rate limits, authentication model, and schema drift. APIs also tend to answer current state without the history needed to explain how the system got there. A response can return a 200 status and still be unusable if it carries undocumented codes, missing fields, truncated arrays, or a payload too large for the context window.

Counterexample. During a carrier outage, the tracking endpoint times out. The bot falls back to a cached tracking page from the document index and presents yesterday's location as current. The user reads a confident answer while the parcel sits in a different depot. The failure came from treating a stale document as equivalent to a live source.
Paper or production? paper
production

Production with operational sharp edges. Production systems now treat the tool call as normal infrastructure. The hard part is controlling cost, permissions, failure behavior, and evidence quality once several endpoints can answer overlapping questions.

GraphRAG

Some answers do not sit inside one row, endpoint, or document. They sit across relationships. GraphRAG represents entities and relationships as a graph, then retrieves connected context by traversing that graph. The system might follow a supplier to a factory, a factory to a component, and a component to a product recall. A chunk index cannot see that path unless one document happens to spell it out.

The label now covers two related uses. The first is local multi-hop retrieval: start with entities in the question, traverse their relationships, and return the connected evidence. The second is global sensemaking across a corpus. Microsoft’s GraphRAG paper builds an entity graph from source documents, pregenerates summaries for groups of related entities, and uses those summaries to answer broad questions about the whole dataset.

That distinction matters in production. A supplier-trace question needs graph traversal. Broad theme questions across ten thousand incident reports need the summarizing version. Both use relationships, but they solve different retrieval problems.

A recall question traversing supplier, factory, component, and product nodes, versus two different suppliers merged into one false node GraphRAG makes the relationship path visible, but a bad entity merge can make a false path look structural.

Where it earns its keep. Relationship-heavy questions: supply-chain tracing, fraud investigation, dependency analysis, customer hierarchies, organizational ownership, infrastructure dependencies, research discovery, and incident impact analysis. It is strongest when the question crosses documents or systems and the path matters as evidence.

Example. A quality team asks which products are affected by a recalled component. Vector search retrieves the recall notice and a few product pages, but the connection chain sits across supplier records, factory assignments, component catalogs, and product bills of material. Graph retrieval follows the path and returns the affected products with the chain visible.

Where it doesn’t. Someone has to model the graph, extract entities, resolve duplicates, maintain relationships, and decide what freshness means. Entity resolution causes the worst failures. Merge two suppliers with similar names and downstream traversals become confident fiction. Graph infrastructure is wasted money when one document can answer the question.

Counterexample. Two suppliers share the trading name "Northline Components". The ingestion process merges them into one node. A recall traversal now links the wrong factory to the wrong products, and the graph returns a clean path diagram for a false answer. Vector search would have failed with less machinery, but the graph makes the error look structural.
Paper or production? paper
production

Production in parts. Knowledge graphs are established enterprise infrastructure, and Microsoft’s GraphRAG work is real. The expensive work is building a graph clean enough to trust and fresh enough to use. The query language is secondary.

Multimodal RAG

Some evidence never becomes clean prose. Charts, scanned forms, product photos, architecture diagrams, presentation slides, and video frames all carry information that text extraction either flattens or loses. Multimodal retrieval gives the system a way to find and use that evidence.

One version uses a shared embedding space for images and text, so a text query can retrieve visually similar evidence. The CLIP paper popularized that approach by training image and text representations together. Production systems often use a less pure mixture: image embeddings, OCR output, document metadata, vision-model descriptions, and the surrounding page text. That mixture is common because it works better in practice.

The key design question is what the model receives after retrieval. A retrieved image can be passed to a vision-capable model, converted into a description, or paired with extracted text and metadata. Each choice changes cost, accuracy, latency, and the kind of error you can inspect.

A connector question answered from the right product diagram, versus a blurry scanned table whose digits are misread Multimodal retrieval can use the diagram as evidence, while weak visual extraction can misread the right image.

Where it earns its keep. Mixed-media corpora: product catalogs, engineering manuals, scanned forms, scientific papers, manufacturing records, design libraries, real-estate listings, training material, and support documents with diagrams. Use it when the missing fact lives in the visual artifact rather than beside it.

Example. A customer asks which cable fits a device. The text specification names the connector family, but the orientation diagram decides whether the cable will fit. Multimodal retrieval finds the diagram, passes it to a vision-capable model, and the answer cites both the written specification and the visual detail.

Where it doesn’t. Multimodal indexing costs more in storage, compute, evaluation, and review. OCR errors survive inside the pipeline. The right chart can still be misread. A text-only corpus gets overhead without benefit, and a bad visual parser can turn the right image into the wrong evidence.

Counterexample. A scanned compatibility table is retrieved correctly. The scan is blurry, the table lines are faint, and the vision model reads a 3 as an 8. Retrieval did its job. The answer still ships the wrong part because the representation layer could not recover the digits.
Paper or production? paper
production

Production where the corpus justifies it. Visual search and multimodal embeddings are established. Full mixed-corpus question answering is still uneven because extraction quality varies more than the retrieval model does.

StreamingRAG

Most retrieval indexes are batch artifacts. A job runs, documents are processed, and the index is updated. Events that arrive afterward remain invisible until the next run. StreamingRAG treats change as the input. Events arrive continuously, the system extracts entities and relationships, timestamps them, and maintains a live representation of current state.

The 2025 StreamingRAG paper applies this idea to real-time multimodal streams, using an evolving knowledge graph to preserve scene, object, and entity context. Enterprise versions look different: inventory events, shipment scans, payment events, sensor readings, security signals, and operational telemetry flowing into a queryable state layer.

Streaming retrieval differs from API-augmented retrieval. An API call asks the owning system when the user asks. Streaming retrieval keeps listening before the question arrives. Use the API when a bounded lookup is enough. Use streaming when the answer depends on continuous events, standing queries, or the recent sequence of state changes.

Warehouse scan events updating a live inventory graph, versus two duplicate shipment entities splitting the same physical package Streaming retrieval keeps state moving with events, but identifier failure can split one package into two live records.

Where it earns its keep. Logistics tracking, inventory movement, fraud monitoring, IoT telemetry, security operations, financial market monitoring, infrastructure incidents, and live operational dashboards. The common requirement is temporal awareness. Current state alone often fails to explain what changed or when.

Example. A warehouse bot watches scan events as inventory moves between receiving, storage, picking, and dispatch. Asked where a shipment is, the system answers with the current location and the last meaningful transition. For availability, it can distinguish a physical unit from one already allocated to another order.

Where it doesn’t. Streaming infrastructure is expensive to operate, and event quality decides whether the live view means anything. Schemas drift, events arrive late, identifiers fail to match, replay behavior surprises teams, and retention decisions become product decisions. For a low-volume document corpus, the machinery adds cost without benefit.

Counterexample. Two scan systems use different identifiers for the same package. The streaming layer creates two shipment entities and splits the event history across them. The live graph has fresh events and clean relationships, yet its identity spine is wrong. A stale but consistent batch index would have given a better answer.
Paper or production? paper
production

Closest to paper in this group. Streaming data infrastructure is mature, but StreamingRAG as a named retrieval pattern is new. Production use remains bespoke event-driven state assembly rather than a standard product feature.

How the five compare

The five patterns answer different source failures, and the easiest way to keep them apart is what each one treats as evidence.

Structured retrieval
queries the rows
the database becomes the evidence
API-augmented RAG
calls the system
the live endpoint becomes the evidence
GraphRAG
follows the relationships
the connected path becomes the evidence
Multimodal RAG
reads the artifact
the image, scan, or frame becomes the evidence
StreamingRAG
tracks the changes
the current event-backed state becomes the evidence

These patterns overlap in real systems. A supplier assistant might query the invoice table for status, call the procurement API for receipt state, traverse invoice-to-order relationships, read the invoice scan, and watch payment events for exceptions. The spec sheets below compress the differences.

Structured retrieval queries the rows
  • Fixes: exact facts hidden from vector search because they live in relational data
  • Slots: alongside document retrieval as a structured source, behind schema and permission controls
  • Costs: schema mapping, semantic maintenance, query validation, access control, and audit logging
  • Latency: the database query plus generation; simple lookups are fast, broad joins can dominate the request
  • Reach for it when: the answer is exact state or a number owned by a relational system
  • Skip it when: the evidence is prose, visual, informal, or absent from the schema
API-augmented RAG calls the system
  • Fixes: stale answers caused by data changing faster than ingestion
  • Slots: at query time as a controlled tool call into the owning system
  • Costs: endpoint contracts, authentication, rate limits, error handling, response shaping, and monitoring
  • Latency: network time plus endpoint load; several calls can compound
  • Reach for it when: current operational state matters more than document completeness
  • Skip it when: connectivity is unreliable, latency is tight, payloads are unpredictable, or the endpoint cannot support the question cleanly
GraphRAG follows the relationships
  • Fixes: answers scattered across entities, documents, systems, and relationship paths
  • Slots: as a graph index beside the document index, with entity extraction and resolution upstream
  • Costs: graph modeling, entity resolution, extraction quality, freshness work, and graph infrastructure
  • Latency: local traversals can be fast; broad fanout and global summarization need precomputation
  • Reach for it when: the path between entities is part of the answer
  • Skip it when: one document can answer the question or the relationships are too subjective to model
Multimodal RAG reads the artifact
  • Fixes: evidence locked in images, charts, scans, diagrams, slides, or video frames
  • Slots: at ingestion and retrieval through visual embeddings, OCR, metadata, page context, or vision-model descriptions
  • Costs: heavier indexing, visual-model usage, storage, evaluation, and manual inspection workflows
  • Latency: indexing cost rises sharply; query cost depends on whether a vision model reads the artifact live
  • Reach for it when: the missing fact is visual rather than textual
  • Skip it when: the corpus is already clean text or the visual extraction quality cannot be trusted
StreamingRAG tracks the changes
  • Fixes: batch-index blindness to events that happened after the last ingestion run
  • Slots: before retrieval as a continuously updated, timestamped source layer
  • Costs: streaming infrastructure, event schemas, identity resolution, retention policy, replay handling, and operations
  • Latency: ingestion work is continuous; queries can be fast when current state is materialized
  • Reach for it when: freshness is measured in seconds or the sequence of events matters
  • Skip it when: the corpus changes slowly or event volume is too low for a stream

The “costs” field deserves close attention. Each new source creates an operational surface somewhere else. The database needs schema stewardship; the API needs contract monitoring; the graph needs entity resolution; visual extraction needs review; and event streams need discipline. None of these are free upgrades.

The failure this group still won’t fix

A better source can feed a system that does not know how to think with it. SQL returns the blocked invoice state while the procurement API reports a posted goods receipt. Graph retrieval shows that the invoice, purchase order, and goods receipt belong to the same supplier, but their identifiers do not line up. Multimodal extraction reads the scanned invoice and exposes the mismatched PO number. The payment stream carries a payment-run event scheduled for tonight.

The harder question arrives after retrieval. When will the supplier see money?

The evidence is present and correct. The system has to decide which sources apply, which conflict matters, whether another lookup is needed, how to weigh the blocking state against the surrounding evidence, and when to stop retrieving. The remaining problem is reasoning and control.

Counterexample. The invoice row says blocked, the procurement API reports a posted goods receipt, the graph shows identifiers that do not line up, extraction confirms the mismatched number, and the payment stream carries a payment-run event for tonight. Faced with a date question, the bot compresses all of it into "payment will go out tonight". Every retrieval step succeeded. The synthesis invented the payment date.

That is where Post 4 goes. Self-RAG, corrective retrieval, adaptive retrieval, agentic RAG, IRCoT, memory, and modular pipelines all start from the same need: the system has to examine what it retrieved and decide what to do next.


Working With Flytebit

At FLYTEBIT TECHNOLOGIES, RAG development is a structured engagement rather than a workshop and a tool licence.

Source failures have a recognizable signature. Retrieval tuning is done and the corpus is clean, yet the answer still depends on data that never belonged in the document index. We map answer types before choosing retrieval machinery: exact state, live state, connected evidence, visual evidence, and event-backed state all take different paths. The feasibility study is where that source map happens before the vector database choice hardens.

We run the same source discipline in our own products. PASSR reviews pull requests against repository context, where diffs, symbols, dependencies, and history act as systems of record. DOCKR regenerates documentation from codebase structure and change events, so the output stays tied to the repository itself. TESTR builds tests from current source behavior; a test grounded in stale documentation repeats the cached-inventory failure in a codebase context.


Ready to get started?



Key Takeaways

  • The source decides what retrieval can know. Vector search can rank embedded text well and still miss facts that live in rows, endpoints, relationships, visual artifacts, or event streams.
  • SQL retrieval is for exact state with an owner. It works when schema meaning is constrained through semantic layers, permissions, validation, and audit trails. Valid SQL against the wrong concept still returns precise-looking nonsense.
  • API augmentation trades ingestion lag for operational dependency. Live endpoints answer current state, but every call inherits latency, rate limits, schema drift, and outage behavior from the owning system.
  • GraphRAG makes relationship paths retrievable. It earns its cost when the path is evidence; entity resolution decides whether that path is trustworthy.
  • Multimodal retrieval is only as good as representation. Finding the right diagram does not help if OCR or the vision model reads it wrong.
  • StreamingRAG is an operational commitment. Event-backed state solves batch blindness, but identity resolution, replay, retention, and schema discipline decide whether the live view means anything.
  • Better sources do not finish the system. Once the right evidence arrives, something still has to resolve conflicts, decompose the question, retry, and stop. That is the systems-that-think problem.

The series intro:

Retrieval Patterns: From Naive RAG to Agentic Retrieval

Frequently Asked Questions

What is SQL RAG?

SQL RAG retrieves exact facts from relational databases by turning natural language into SQL rather than searching embedded documents. The model receives rows returned by the query and writes the answer around them. It fits invoice status, inventory, revenue, order status, account balances, and other facts with a system-of-record table. The hard part is schema meaning: the model can write valid SQL against the wrong column, so production systems constrain it with a semantic layer, permissions, query validation, and audit logging.

When should I use GraphRAG instead of vector search?

Use GraphRAG when the answer depends on relationships across entities or documents: supplier chains, account ownership, dependency paths, fraud rings, or multi-document investigations. Vector search finds text that resembles the question. Graph traversal follows relationships. If one document contains the answer, hybrid search is cheaper and easier to operate.

What is the difference between API-augmented RAG and StreamingRAG?

API-augmented RAG asks a live system for data when the user asks a question. StreamingRAG maintains a live representation as events arrive, before anyone asks. Use an API for bounded state lookups such as order status or stock availability. Use streaming retrieval when events arrive continuously and the answer depends on current state plus the recent sequence of changes.

Does multimodal RAG mean images and text share one embedding space?

Sometimes, but not always. Some systems use a shared embedding space for text and images. Others combine image embeddings, OCR text, document metadata, and vision-model descriptions. The design goal is the same: a text question should be able to reach evidence that does not exist as ordinary prose. The right implementation depends on whether the corpus contains product images, scanned forms, charts, diagrams, or video.

Which source-side RAG pattern should I implement first?

Map the answers before choosing the pattern. Exact business facts point toward SQL retrieval, current operational state points toward APIs, relationship questions point toward GraphRAG, visual evidence points toward multimodal retrieval, and continuously changing event data points toward StreamingRAG. In many enterprise systems, SQL or API access comes first because it removes confident answers based on the wrong source rather than adding another layer of document search.

#RAG#RetrievalAugmentedGeneration#GraphRAG#MultimodalRAG#SQLRAG#AIEngineering#TutorialSeries
Jayaveer Bhupalam

Written by

FLYTEBIT Technologies

Founder · Chief Technology Officer · AI & Digital Transformation Leader

Ready to Transform Your Business with AI?

Let's discuss how Agentic AI and intelligent automation can help you achieve your goals.