r
Rosa Reyes
Get in touch
PythonFastAPIPydantic AINLPLLMsOpenRouter

Semantic Search
Engine

A 3-stage multi-agent pipeline that turns natural language into structured product catalog filters. Built as my CS bachelor thesis in collaboration with Stylib.

Bachelor Thesis · 2026 · UC3M
01 / Problem

Why catalog search is hard

The filter interface users faced
Traditional catalog filter interface with dozens of facets and dropdowns
The problem

Searching a product catalog for architectural materials means wading through hundreds of facets: species, finish, width, thickness, color, supplier. Keyword search fails people who don't know the exact terminology, and filter forms with dozens of dropdowns mostly get ignored.

Example · query to filter string
Input
"red oak flooring wider than 150mm under 50€/m²"
3-agent pipeline
Output
(meta.optionset.type::Color[io]:red
&meta.optionset.type::Species[io]:oak
&meta.optionset.type::Width[ge]:150
&meta.price[le]:50)
The solution

Natural language is the better interface. Users describe what they need the way they would to a colleague, and the system figures out the filters. The hard part is doing that reliably across a taxonomy of thousands of product variants.

This thesis builds and benchmarks a multi-agent solution: one LLM extracts the search intent, a second maps it to catalog filters, and a third validates the result. If the filters are wrong, the pipeline corrects itself and tries again.

02 / Architecture

3-stage multi-agent pipeline

UserFrontendAPIEntity AgentFilter AgentValidator AgentTaxonomyQueryResultsvalidated resultkey errorintent errorValidator routes to the agent responsible for the error

General flow of the multi-agent system

01

Entity Agent

Reads the query against an augmented product taxonomy and returns a product category plus a list of logical conditions. Each condition is a concept paired with an expression, like "Color" / "red OR blue".

inNatural language query
outCategory + LogicalConditions
02

Filter Agent

Takes each logical condition and maps it to a canonical filter key from the product catalog facets. Runs in a loop: if the Validator finds issues with the key resolution, it gets another attempt.

inLogicalConditions
outFilterResult
03

Validator Agent

Checks whether the generated filters actually answer the original query. When they fall short, it routes the issue back to whichever agent is responsible: the Filter Agent if a key mapping is wrong, the Entity Agent if the intent was misread. Up to 3 retries.

inFilterResult + original query
outValidated FilterResult

Validator routes issues to Filter Agent or Entity Agent depending on error source · max 3 retries

03 / Demo

See it in action

Demo coming soon

UI walkthrough: natural language query to filtered catalog results

04 / Pipeline Trace

What the agents
actually produce

Pipeline trace · example run
$ query: "red oak flooring wider than 150mm under 50€/m²"
▸ EntityAgent
category: Wood flooring
conditions:
Color = "red"
Species = "oak"
Width ≥ 150
Price ≤ 50
▸ FilterAgent
resolving 4 conditions…
meta.optionset.type::Color[io]:red
meta.optionset.type::Species[io]:oak
meta.optionset.type::Width[ge]:150
meta.price[le]:50
▸ ValidatorAgent
checking against original query…
✓ valid · no issues found
filter_string: (meta.optionset.type::Color[io]:red&meta.optionset.type::Species[io]:oak&meta.optionset.type::Width[ge]:150&meta.price[le]:50)
F1: 1.00 · 3 agents · 1 pass · 0 retries
05 / Results

Benchmark performance

≥ 0.5
Minimum F1 pass threshold
token-level filter accuracy per query
53
Ground-truth test queries
natural language to filter string pairs
N×M
Model combinations swept
main model × validator model pairs
06 / Stack

Built with

Core
Python 3.13FastAPIPydantic AI
LLMs
OpenRouter
Testing & Eval
pydantic-evalspytestFilter F1
Observability
Logfire
07 / Thesis

Read the full paper

Sistema basado en procesamiento de lenguaje natural para la generación de filtros en sistemas de búsqueda
Rosa Reyes · Bachelor Thesis · Computer Science · UC3M · 2026