---
title: "Code reranking/semantic search"
method: GET
path: "/codegen/reranking/{path}"
tags: ["codegen"]
---

# Code reranking/semantic search

`GET /codegen/reranking/{path}`

Uses Relace's code reranking model to find the most relevant files for a given query. This is useful as a first pass in agentic exploration to narrow down the search space.

Based on: https://docs.relace.ai/docs/code-reranker/agent

Query Construction: The query can be a short question or a more detailed conversation with the user request included. For a first pass, use the full conversation; for subsequent calls, use more targeted questions.

Token Limit and Score Threshold: For 200k token context models like Claude 4 Sonnet, recommended defaults are scoreThreshold=0.5 and tokenLimit=30000.

The response will be a list of file paths and contents ordered from most relevant to least relevant.

## Path parameters

- `path` string, required

## Query parameters

- `query` string, required
- `scoreThreshold` number
- `tokenLimit` integer
- `filePattern` string

## Response `200`

Relevant files found

- RerankingResponse
  - `files` RankedFile[]
    - `content` string
    - `path` string
    - `score` number
  - `message` string
  - `success` boolean

## Other responses

- `400` — Invalid request
- `422` — Unprocessable entity - failed to process the request
- `503` — Service unavailable - Relace not configured

---

[API](https://skmtc.net/blaxel/apis/blaxel-control-plane.md) · [All operations](https://skmtc.net/blaxel/apis/blaxel-control-plane/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/blaxel/blaxel-control-plane/revisions/dfa264bc72ee/schema)
