The reviews loved it. The ratings didn’t.

· engineering

Infino is now a LlamaIndex vector store, and it gives your agent something a vector store never has: search that you can join, filter and count, in one SQL query, in the same engine that holds your data.

We wanted to see what that changes in practice, so we built a shopping assistant over 100,000 real Amazon beauty reviews and asked it the kind of question shoppers ask every day. The answer surprised us. (For the full argument behind one-query agents, see One query answers the agent’s whole question. This post is the hands-on version, in LlamaIndex, on real data.)

Which sunscreen doesn’t leave a white cast?

That was the question. We started the way most RAG tutorials do: embed the reviews, retrieve the five closest, hand them to the model.

It did fine. Of the five closest reviews, three were for SKIN AQUA (“NO WHITECAST the best sunscreen on the market so cheap so hydrating 10000/10”) and two for Dear Klairs, one of which starts “Little bit of white cast but not too bad”. Any model reading those would recommend SKIN AQUA.

But think about what a shopper actually sees when they search for sunscreen on Amazon. Before reading a single result, the page has counted products by brand and let them drop everything under four stars. Five reviews can’t do that. They can’t say whether SKIN AQUA leads by two reviews or twenty, which brands people mention next, or whether the products reviewers love are rated well by everyone else.

To answer those questions, an agent needs to count, group and look things up. Usually that means a SQL database next to the vector store and a router deciding which one to ask. With Infino it means one more tool.

Search is a table

Our reviews live in an Infino table that LlamaIndex treats as an ordinary vector store, with stars, year and brand as plain columns. The catalog, 39,906 products with their overall Amazon rating, is a second Infino table next to it.

The agent gets two tools. The first is search: hybrid search, keyword and vector ranked together, with filters on stars, year and brand. The second runs SQL over both tables, and this is where Infino is different. hybrid_search(...) is a table function. Its results can be grouped, joined and filtered like any other table, in the same statement, without the data leaving the engine.

Which brands, and by how much

The brand panel for our question, from the 300 most relevant four and five star reviews:

brands.sql
SELECT store, COUNT(*) AS reviews, ROUND(AVG(rating), 2) AS stars
FROM hybrid_search('reviews', 'text', 'sunscreen that does not leave a white cast',
                   'embedding', '{query_vector}', 300)
WHERE rating >= 4 AND store IS NOT NULL
GROUP BY store
ORDER BY reviews DESC
brandreviewsstars
SKIN AQUA284.96
OZ Naturals154.93
Ocean Potion55.00
Zalan54.80
Coppertone54.80

SKIN AQUA leads by a wide margin. And in second place is a brand that never showed up in the top five at all.

The query ran in about a fifth of a second on a laptop. The model can’t write a 384-number vector into SQL, so it writes {query_vector} and the tool fills in the embedding.

What the catalog knew

OZ Naturals looked like a great second choice. Fifteen glowing reviews, almost all of them five stars. So we joined those same reviews to the catalog:

catalog.sql
SELECT p.title, p.average_rating, p.rating_number, COUNT(*) AS praising
FROM hybrid_search('reviews', 'text', 'sunscreen that does not leave a white cast',
                   'embedding', '{query_vector}', 300) AS h
JOIN products AS p ON p.parent_asin = h.parent_asin
WHERE h.rating >= 4 AND h.store IS NOT NULL AND p.store IN ('SKIN AQUA', 'OZ Naturals')
GROUP BY p.title, p.average_rating, p.rating_number
productoverall ratingratingspraising reviews
SKIN AQUA UV Super Moisture Gel4.72,13627
OZ Naturals Tinted Moisturizer SPF 303.41859
OZ Naturals Facial Sunscreen SPF 303.7764

There it is. The reviewers who write about white cast love OZ Naturals. Everyone else rates its sunscreens 3.4 and 3.7. SKIN AQUA holds 4.7 across more than two thousand ratings.

That’s the difference between “reviewers like it” and “buy it”. No amount of reading the top five reviews would have found it. It took search and a join, and in Infino that’s one query.

We checked the other side as well. Among the 300 most relevant one and two star reviews complaining about a white cast, neither brand appears once.

Filter inside the search, or after it

Look closely at those two queries and you’ll see the filters doing different jobs.

A WHERE on the search function’s own columns runs inside the search. Infino ranks within the rows that pass, so rating >= 4 never leaves you with fewer results than you asked for. A WHERE on a joined table runs after the search, on exactly the results it returned. That’s why the catalog query filters brands on products.store: it keeps the same 300 reviews behind the brand panel and asks how their products rate.

You choose per filter, in plain SQL. We put that rule in the SQL tool’s description, and the model uses it.

Questions nobody built an index for

Once search and SQL live together, the same rows answer questions that have nothing to do with the search box. Are complaints about fake products getting more common?

fakes.sql
SELECT year,
       ROUND(1000.0 * SUM(CASE WHEN rating <= 2
                                AND (text ILIKE '%fake%' OR text ILIKE '%counterfeit%')
                               THEN 1 ELSE 0 END) / COUNT(*), 1) AS fake_per_1000
FROM reviews
GROUP BY year
ORDER BY year

Low-star reviews calling a product fake or counterfeit went from 0.8 per 1,000 reviews in 2014 to 5.0 in 2021. Six times as common, from one query over the same table the agent searches.

The agent got there on its own

The agent itself is a standard LlamaIndex FunctionAgent, and any LLM that can call tools will do:

agent.py
agent = FunctionAgent(
    tools=[
        FunctionTool.from_defaults(tools.search_reviews),
        FunctionTool.from_defaults(tools.run_sql),
    ],
    llm=Anthropic(model="claude-sonnet-5-5"),  # or any tool-calling LLM
    system_prompt="You help shoppers using 100,000 Amazon beauty reviews ...",
)

We gave it the OZ Naturals question cold, with none of our queries: “Do reviewers who praise OZ Naturals sunscreens agree with how the products are rated overall?” In the run saved in the example notebook, on gpt-5.4, it made three calls:

tool calls
search_reviews("OZ Naturals sunscreen praise ...", min_rating=4, store="OZ Naturals")
run_sql("SELECT ... FROM products p JOIN reviews r ... WHERE p.store = 'OZ Naturals' ...")
run_sql("SELECT ... FROM reviews r JOIN products p ... WHERE r.rating >= 4 ...")

A search for praise inside the brand, then two joins of its reviews to the catalog. The answer, trimmed:

Mostly no: reviewers who praise OZ Naturals sunscreens are more positive than the products’ overall ratings suggest.

  • OZNaturals Tinted Moisturizer, SPF 30 Sunscreen. Overall product rating: 3.4 stars from 185 ratings. In the review dataset: 20 reviews averaging 4.75 stars.
  • OZNaturals Facial Sunscreen Anti Aging SPF 30. Overall product rating: 3.7 stars from 76 ratings. In the review dataset: 11 reviews averaging 4.18 stars.

That gap suggests the glowing reviewers are not representative of the full rating picture.

It wrote different SQL from ours and reached the same finding, with nothing to go on but the two tool descriptions.

There’s no second database to keep in sync and no router guessing which system to ask. Postgres-backed stores can join too, if you run Postgres and add an extension for keyword search. Stores that only hold vectors can’t, so the join ends up in your Python code.

With Infino it’s one engine, one copy of the data, and the tables live wherever you want them: a folder on a laptop, your own bucket, or Infino Cloud. Only the connect() URL changes.

Try it

The full example loads the reviews and catalog, runs every query in this post without a model, and then hands the questions to the agent. It’s in examples/shopping-agent.

install.sh
pip install llama-index-vector-stores-infino

Common questions

Can a LlamaIndex agent count and group search results?

Yes, with Infino as the vector store. Infino’s hybrid_search is a SQL table function, so an agent’s SQL tool can group, join and filter search results in one statement against the same table LlamaIndex searches. The shopping agent example.

Do I need a separate SQL database next to my LlamaIndex vector store?

Not with Infino. The reviews and the catalog in this post are two Infino tables in one engine, and one query joins search results from one to rows of the other.

Do metadata filters return fewer results than top-k?

Not in Infino. A filter on the searched table runs inside the search, so the engine ranks within the rows that pass and returns the full top-k when that many rows match.

Where do the tables live?

Anywhere infino.connect() points: a local folder, an S3, GCS or Azure bucket, or Infino Cloud. The LlamaIndex code is the same in every case. llama-index-vector-stores-infino on PyPI.

Search your agent can join, filter and count, in one SQL query.

or run it yourself: pip install infino · Apache-2.0 · quickstart →

Deeper: one query answers the agent’s whole question.