Skip to content
unzoi docs
Search and navigation
Start here
REST API
MCP
Limits and plans
Agent clients
SDKs
Guides

Recipes / Ground an LLM answer without wasting context

Ground an LLM answer without wasting context

/stories in hybrid mode. This page is the operational half — what comes back, how it breaks, and what running it for real takes.

The request

GET /stories
  ?q=<the user's question, unmodified>
  &mode=hybrid
  &from=<now - 7d>
  &limit=8

As a call you can paste:

curl -s -G "https://api.unzoi.com/stories" \
  -H "x-api-key: $UNZOI_KEY" \
  --data-urlencode "q=<the user's question, unmodified>" \
  --data-urlencode "mode=hybrid" \
  --data-urlencode "from=<now - 7d>" \
  --data-urlencode "limit=8"

For an agent rather than a script, the same query is the list_stories MCP tool with these as its arguments.

Parameters used here

What comes back

Eight distinct events, each with its outlet list. That fits comfortably in a context window and gives the model genuine variety to reason over, plus a defensible corroboration signal in the outlet count rather than in raw repetition.

Field by field: the /stories response reference.

How this goes wrong

Using /search with a high limit and letting the model deduplicate. It cannot, reliably, and you have paid for every duplicate token to find that out. If you change one thing about a news-to-LLM pipeline, change this.

Adapting it

For a research agent rather than a single answer, let the model call find_related on its best result instead of issuing another search. Models reformulate badly under uncertainty and each reformulation costs a request, so a similarity lookup from a result it already trusts is both cheaper and usually better. If answers must cite sources, return the outlet list with each story and instruct the model to cite the outlet rather than the story identifier, which means nothing to a reader.

Running it for real

Set a per-run request budget. Framework agents commonly issue three to five requests per user question because they retry when a first result looks unsatisfying, and that multiplier is invisible in testing where you watch one query at a time. Put the story-grouping tool first in the tool list and describe it as the default; given two similar tools an agent takes the first plausible one, and if that is article search it will fill its own context with duplicates and then reason over them.

Why this approach

The case for these parameters over the obvious alternatives — and when this recipe is the wrong tool entirely — is on the recipe's page on unzoi.com. It is kept there rather than repeated here, so the argument and the operations cannot drift apart.