54 lines
1.9 KiB
PHP
54 lines
1.9 KiB
PHP
<?php
|
|
|
|
namespace Database\Factories;
|
|
|
|
use App\Models\BenchmarkRun;
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
|
|
/** @extends Factory<RunResult> */
|
|
class RunResultFactory extends Factory
|
|
{
|
|
public function definition(): array
|
|
{
|
|
$visible = $this->faker->numberBetween(20, 400);
|
|
$reasoning = $this->faker->numberBetween(0, 2000);
|
|
$ttft = round($this->faker->randomFloat(2, 0.1, 4), 2);
|
|
$wall = round($ttft + $this->faker->randomFloat(2, 0.5, 60), 2);
|
|
$ok = $this->faker->boolean(70);
|
|
|
|
$payload = [
|
|
'level' => null, 'section' => null, 'name' => null, 'ok' => $ok,
|
|
'ttft' => $ttft, 'wall' => $wall,
|
|
];
|
|
|
|
return [
|
|
'benchmark_run_id' => BenchmarkRun::factory(),
|
|
'suite' => 'softbench',
|
|
'section' => $this->faker->randomElement(['code', 'reasoning', 'constraints', null]),
|
|
'task' => $this->faker->randomElement([
|
|
'first_occurrence', 'merge_intervals', 'version_compare', 'rbac_missing_verb', 'oom_innocent_victim',
|
|
]),
|
|
'level' => $this->faker->randomElement(['off', 'low', 'medium', 'xhigh']),
|
|
'ok' => $ok,
|
|
'decode' => round($this->faker->randomFloat(2, 10, 150), 2),
|
|
'user_tps' => round($this->faker->randomFloat(2, 5, 100), 2),
|
|
'ttft' => $ttft,
|
|
't_answer' => $ttft,
|
|
'wall' => $wall,
|
|
'reasoning' => $reasoning,
|
|
'visible' => $visible,
|
|
'total' => $visible + $reasoning,
|
|
'tool_calls' => null,
|
|
'checks_passed' => null,
|
|
'checks_total' => null,
|
|
'finish' => $ok ? 'stop' : $this->faker->randomElement(['stop', 'length']),
|
|
'detail' => null,
|
|
'payload' => $payload,
|
|
];
|
|
}
|
|
|
|
public function forSuite(string $suite): static
|
|
{
|
|
return $this->state(fn () => ['suite' => $suite]);
|
|
}
|
|
}
|