Search¶
search ¶
Typed search spaces and the deterministic random strategy.
Parameter ¶
SearchSpace
dataclass
¶
SearchSpace(parameters: dict[str, Parameter])
Named typed parameters from which candidates can be sampled.
validate ¶
validate(parameters: Mapping[str, Any]) -> Candidate
Validate an exact candidate mapping against every parameter.
Source code in src/tunarag/search.py
describe ¶
Return a provider-safe structured search-space description.
RandomSearch ¶
RandomSearch(space: SearchSpace, *, seed: int | None = None)
Seeded random strategy implementing the common search contract.
Source code in src/tunarag/search.py
replay
async
¶
replay(candidate: Candidate, metrics: Any, usage: Any) -> None
Advance and verify deterministic generator state during resume.
Source code in src/tunarag/search.py
SearchObservation
dataclass
¶
SearchObservation(candidate: Candidate, metrics: tuple[MetricValue, ...])
A prior reserved candidate and any committed metrics.
LLMSuggestionRequest
dataclass
¶
LLMSuggestionRequest(search_space: Mapping[str, Mapping[str, Any]], observations: tuple[SearchObservation, ...], suggestion_number: int, attempt_number: int)
Provider-neutral structured input for one suggestion attempt.
LLMSearchProvider ¶
Bases: Protocol
Produce one structured candidate proposal without provider coupling.
suggest
async
¶
suggest(request: LLMSuggestionRequest) -> Mapping[str, Any]
Source code in src/tunarag/search.py
LLMSearch ¶
LLMSearch(space: SearchSpace, provider: LLMSearchProvider, *, max_suggestion_attempts: int = 3, fallback_seed: int = 0, fallback: bool = True)
Validate bounded provider suggestions with deterministic random fallback.
Source code in src/tunarag/search.py
suggest
async
¶
suggest() -> Candidate
Source code in src/tunarag/search.py
observe
async
¶
observe(candidate: Candidate, metrics: Sequence[MetricValue], usage: Sequence[UsageRecord]) -> None
replay
async
¶
replay(candidate: Candidate, metrics: Sequence[MetricValue], usage: Sequence[UsageRecord]) -> None