classifiers.build_tool_index module

Build the tool index used by the vector classifier.

Auto-discovers every registered tool via tool_loader, then calls an LLM to generate 50 diverse synthetic user queries per tool (reverse-HyDE). Results are saved to tool_index_data.json in this directory.

Usage:

python -m classifiers.build_tool_index [--tools-dir tools]
async classifiers.build_tool_index.generate_synthetic_queries(client, base_url, api_key, tool_name, tool_description, count=50, model='gemini-3.1-flash-lite-preview')[source]

Call the Gemini API directly to produce count synthetic queries.

Uses the shared flash-lite key pool for authentication. base_url and api_key are accepted for backward compatibility but ignored – all calls go through the Gemini API.

Return type:

list[str]

Parameters:
  • client (httpx.AsyncClient)

  • base_url (str | None)

  • api_key (str | None)

  • tool_name (str)

  • tool_description (str)

  • count (int)

  • model (str)

async classifiers.build_tool_index.build_index(tools_dir='tools')[source]

Discover tools and generate synthetic queries.

Return type:

None

Parameters:

tools_dir (str)