init project
This commit is contained in:
35
database/factories/EmbeddingUsageEventFactory.php
Normal file
35
database/factories/EmbeddingUsageEventFactory.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\EmbeddingUsageEvent;
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends Factory<EmbeddingUsageEvent>
|
||||
*/
|
||||
class EmbeddingUsageEventFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
$tool = fake()->randomElement(['embed', 'search', 'compare']);
|
||||
$inputCount = fake()->numberBetween(1, 8);
|
||||
|
||||
return [
|
||||
'user_id' => User::factory(),
|
||||
'tool' => $tool,
|
||||
'provider' => 'ollama',
|
||||
'model' => config('ai.providers.ollama.models.embeddings.default', 'nomic-embed-text'),
|
||||
'embedding_dimensions' => (int) config('ai.providers.ollama.models.embeddings.dimensions', 768),
|
||||
'input_count' => $inputCount,
|
||||
'result_count' => $tool === 'search' ? fake()->numberBetween(0, 10) : $inputCount,
|
||||
'tokens' => fake()->optional()->numberBetween(5, 500),
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user