Documentation Index
Fetch the complete documentation index at: https://smithers.sh/llms.txt
Use this file to discover all available pages before exploring further.
// Props
import { Optimizer } from "smithers-orchestrator";
type OptimizerProps = {
id?: string; // default "optimizer"; task ids {id}-generate, {id}-evaluate
generator: AgentLike;
evaluator: AgentLike | ((candidate: unknown) => unknown); // function = compute task
generateOutput: OutputTarget;
evaluateOutput: OutputTarget; // must include `score: number`
targetScore?: number; // omit to run all iterations
maxIterations?: number; // default 10
onMaxReached?: "return-last" | "fail"; // default "return-last"
skipIf?: boolean;
children: string | ReactNode; // initial generation prompt
};
export default smithers(() => (
<Workflow name="prompt-optimizer">
<Optimizer
generator={promptEngineer}
evaluator={evaluator}
generateOutput={outputs.prompt}
evaluateOutput={outputs.evaluation}
targetScore={90}
maxIterations={5}
>
Generate a prompt for summarizing legal documents.
</Optimizer>
</Workflow>
));
Notes
score drives convergence against targetScore.
- A function
evaluator renders as a compute task rather than an agent task.