QueryAgentGym / README.md
CShorten's picture
Update README.md
bbb131a verified
|
Raw History Blame Contribute Delete
11.7 kB
metadata
license: cc-by-4.0
pretty_name: Query Agent Gym
language:
  - en
size_categories:
  - 10K<n<100K
task_categories:
  - question-answering
  - table-question-answering
tags:
  - weaviate
  - query-agent
  - function-calling
  - text-to-query
  - database
  - retrieval
  - agents
  - synthetic
configs:
  - config_name: queries
    default: true
    data_files:
      - split: test
        path:
          - public-transit/queries.parquet
          - tattoo-studios/queries.parquet
          - nonprofits/queries.parquet
          - surf-schools/queries.parquet
          - childcare/queries.parquet
  - config_name: environments
    data_files:
      - split: test
        path: environments.parquet
  - config_name: public-transit_TransitRoutes
    data_files:
      - split: test
        path: public-transit/objects/TransitRoutes.parquet
  - config_name: public-transit_RidershipReports
    data_files:
      - split: test
        path: public-transit/objects/RidershipReports.parquet
  - config_name: tattoo-studios_TattooArtists
    data_files:
      - split: test
        path: tattoo-studios/objects/TattooArtists.parquet
  - config_name: tattoo-studios_TattooDesigns
    data_files:
      - split: test
        path: tattoo-studios/objects/TattooDesigns.parquet
  - config_name: nonprofits_Charities
    data_files:
      - split: test
        path: nonprofits/objects/Charities.parquet
  - config_name: nonprofits_Campaigns
    data_files:
      - split: test
        path: nonprofits/objects/Campaigns.parquet
  - config_name: nonprofits_GivingPrograms
    data_files:
      - split: test
        path: nonprofits/objects/GivingPrograms.parquet
  - config_name: nonprofits_Donations
    data_files:
      - split: test
        path: nonprofits/objects/Donations.parquet
  - config_name: surf-schools_SurfBeaches
    data_files:
      - split: test
        path: surf-schools/objects/SurfBeaches.parquet
  - config_name: surf-schools_SurfInstructors
    data_files:
      - split: test
        path: surf-schools/objects/SurfInstructors.parquet
  - config_name: surf-schools_LessonPrograms
    data_files:
      - split: test
        path: surf-schools/objects/LessonPrograms.parquet
  - config_name: surf-schools_SurfEquipment
    data_files:
      - split: test
        path: surf-schools/objects/SurfEquipment.parquet
  - config_name: childcare_DaycareCenters
    data_files:
      - split: test
        path: childcare/objects/DaycareCenters.parquet
  - config_name: childcare_ChildcareStaff
    data_files:
      - split: test
        path: childcare/objects/ChildcareStaff.parquet
  - config_name: childcare_ChildEnrollments
    data_files:
      - split: test
        path: childcare/objects/ChildEnrollments.parquet

Query Agent Gym

Query Agent Gym is a set of procedurally generated database environments and natural-language queries with exactly known ground-truth queries.

This release holds five held-out test environments containing 15 collections with 1,000 objects each (15,000 objects, 18,000 searchable documents) and 250 queries, 50 per environment. Every entity, name, and document is synthetic.

Environment Collections (kind) Objects Queries
Public Transit TransitRoutes (knowledge_base), RidershipReports (transactional) 2,000 50
Tattoo Studios TattooArtists, TattooDesigns (knowledge_base) 2,000 50
Nonprofits Charities, Campaigns, GivingPrograms (knowledge_base), Donations (transactional) 4,000 50
Surf Schools SurfBeaches, SurfInstructors, LessonPrograms, SurfEquipment (knowledge_base) 4,000 50
Childcare DaycareCenters, ChildcareStaff (knowledge_base), ChildEnrollments (transactional) 3,000 50

Quick start

from datasets import load_dataset
import json

queries = load_dataset("weaviate/QueryAgentGym", "queries", split="test")
surf = queries.filter(lambda r: r["environment"] == "surf-schools")
q = queries[0]
print(q["command"])                     # the natural-language request
print(q["ground_truth_sql"])            # readable ground truth, one entry per sub-query
plan = json.loads(q["ground_truth"])    # exact ground truth (query_database arguments)

routes = load_dataset("weaviate/QueryAgentGym", "public-transit_TransitRoutes", split="test")

Layout

Each environment has its own folder.

environments.parquet                   one row per environment
<environment>/schema.json              the schema exactly as generated
<environment>/queries.parquet          the environment's 50 queries
<environment>/objects/<Collection>.parquet   1,000 objects per collection
Config Rows Contents
queries (default) 250 All five environments' queries, with an environment column
environments 5 One row per environment
<environment>_<Collection> 1,000 each The objects of one collection, one typed column per property

To work with one environment, filter the queries config on environment, or read <environment>/queries.parquet directly.

queries

Field Type Description
query_id string e.g. public-transit-013
environment string Environment id, e.g. public-transit
environment_name string e.g. Public Transit
command string The natural-language request given to the agent
phrasing string explicit (names properties and values plainly) or conversational (a scenario, with values still verbatim)
plan string The operators of the plan, sub-queries separated by ;
num_sub_queries int 1 to 3. Sub-queries are independent, never multi-hop
operator_classes list of strings Operator classes the plan features (search, each filter kind, each aggregation kind, group-by, multi-query)
ground_truth string (JSON) List of query_database argument objects, one per sub-query (format below)
ground_truth_sql list of strings A SQL-like rendering of each sub-query, for reading only
search_grounds list of structs For each sub-query with a search, its relevance-labeled result set (below)
reference_results string (JSON) Each sub-query's ground truth executed on the objects (below)

Objects

Each <environment>_<Collection> config has a uuid column followed by one column per property, in schema order. The uuid is the object's id and is what search_grounds and reference_results refer to. Property types map to columns and to Weaviate data types as follows.

Property type Column type Weaviate data type
searchable_text string text (the prose a search should match)
filterable_text string text (identifiers, references, categories)
int / number int64 / float64 int / number
boolean bool boolean
date string, YYYY-MM-DD date (send as RFC 3339, e.g. 2025-11-16T00:00:00Z)
text_array, int_array, number_array, boolean_array, date_array list text[], int[], number[], boolean[], date[]

Each collection has exactly one identifier property (is_identifier in schema.json): an invented, unique name in a knowledge_base collection, a code in a transactional one. A transactional collection's reference properties (references in schema.json) hold the identifier of a knowledge_base record, stored directly in the row, so no query needs a join. No value is null.

Ground truth format

A ground truth is a list of sub-queries, each a query_database function-call argument object.

[{"collection_name": "TransitRoutes",
  "search_query": "observatory and weather access",
  "numeric_array_property_filters": [
    {"property_name": "stopSequenceNumbers", "operator": "CONTAINS_ALL", "values": [1, 8]}]}]
Argument Items Operators or metrics
collection_name The target collection
search_query string A relevance search over the collection's searchable text
text_property_filters property_name, operator, value =, LIKE (pattern uses %, e.g. Nerith%)
numeric_property_filters property_name, operator, value =, <, >, <=, >=
date_property_filters property_name, operator, value (ISO date) =, <, >, <=, >=
boolean_property_filters property_name, operator, value =, !=
array_property_filters (text arrays), numeric_array_property_filters, boolean_array_property_filters, date_array_property_filters property_name, operator, values CONTAINS_ANY, CONTAINS_ALL
numeric_property_aggregations property_name, metric COUNT, MIN, MAX, MEAN, MEDIAN, MODE, SUM
text_property_aggregations property_name, metric, top_occurrences_limit COUNT, COUNT_DISTINCT, TOP_OCCURRENCES
boolean_property_aggregations property_name, metric COUNT, TOTAL_TRUE, TOTAL_FALSE, PERCENTAGE_TRUE, PERCENTAGE_FALSE
date_property_aggregations property_name, metric COUNT, EARLIEST, LATEST
groupby_property string Groups every aggregation of the sub-query

All filters in a sub-query are combined with AND. A sub-query without aggregations retrieves records, and one with aggregations returns only the statistics.

Searches. The words of search_query are one valid phrasing and are not the target. A search sub-query's correct result is its labeled set: search_grounds[i].candidate_ids are the records the sub-query's filters select (R), and relevant_ids are the records a language model labeled relevant to the topic after reading every document in R (S). The topic and description fields say what the search is about.

Reference results. reference_results[i] is sub-query i executed on the objects, with a search resolving to its relevant_ids. A retrieval is a sorted list of uuids, an aggregation is {"METRIC(property)": value}, and a group-by maps each group value (as a string) to its aggregations. Percentages are on a 0 to 100 scale, and TOP_OCCURRENCES is a list of [value, count] pairs. Ties in MODE and TOP_OCCURRENCES are broken deterministically, which a database may break differently.

Evaluation

Placeholder, see github.com/weaviate/query-agent-benchmarking.

How the data was made

Each environment is a position in a seeded order over 200 domain briefs (seed 380, positions 5 to 9). Its structure is sampled procedurally: the number and kind of collections, property types, references, and each query's operator plan. Language models write the surface: the schema design (GPT-6 Sol), record names and documents (GPT-6 Luna), search topics and their relevance labels, and the natural-language commands (GPT-5.6 Luna). Ground truths are grounded in the saved objects and every command passes mechanical checks and a faithfulness verifier, so the plan can be recovered from the words. Each set of 50 queries is selected from a pool of 200 sampled plans so that every operator class appears at least 3 times, which makes the sets balanced across operators rather than distributed like natural traffic. A seeded coin chose each command's phrasing, giving 113 explicit and 137 conversational commands.

Limitations

  • All data is synthetic and English only. Entities are invented, so an agent cannot answer from world knowledge, and documents are written as a real system of record would write them.
  • Values are drawn independently, so a record can combine values that would rarely co-occur in reality (a fin set tagged for zipper care). Documents are written to stay consistent with each record's values.
  • Public Transit has no group-by queries. Its only groupable properties are references with over 400 distinct values, which yield degenerate groups.
  • Relevance labels for searches come from a language model reading each candidate document, not from human annotation.