Skip to main content

RMH search API

POST /search/rmh runs hybrid search (vector + keyword), then optionally expands with same-file neighbors and a second hybrid pass seeded from the top hit. Responses match the normal search payload plus an rmh metadata object describing what ran. Requires the same authentication and search quota as GET/POST /search.

Endpoint

POST /search/rmh

Request body

All fields from POST /search are supported, plus:
max_rounds
integer
default:"2"
Number of hybrid search rounds (1–3)
neighbor_line_radius
integer
default:"80"
Lines around each hit to pull additional chunks from the same file (0–500)
expand_neighbors
boolean
default:"true"
When true, merge overlapping chunks from the same file as neighbors
When true, run a second hybrid search using the original query plus terms from the top hit
curl -X POST https://api.trygroundai.com/search/rmh \
  -H "Authorization: Bearer gnd_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "query": "How does authentication work?",
    "top_k": 10,
    "max_tokens": 4000,
    "max_rounds": 2,
    "expand_neighbors": true,
    "secondary_search": true
  }'

Response

Same as Search API SearchResponse, with an extra top-level object:
"rmh": {
  "rounds_executed": 2,
  "seed_result_count": 8,
  "neighbors_added": 12,
  "secondary_search_ran": true,
  "merged_chunk_count": 18
}
If no evidence is found, the API may return the same no evidence payload as /search.