v1

latestOpenAPI 3.0.32026-07-22194221292.5 KB
codegen

Code reranking/semantic search

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.

get/codegen/reranking/{path}

Path parameters

pathstring required

Path to search in (relative to workspace)

Query parameters

querystring required

Natural language query to search for

scoreThresholdnumber

Minimum relevance score (default: 0.5)

tokenLimitinteger

Maximum tokens to return (default: 30000)

filePatternstring

Regex pattern to filter files (e.g., .*\.ts$ for TypeScript files)

Response

Relevant files found

messagestring
successboolean

Example response

{
  "message": "Found 5 relevant files",
  "success": true
}