Skip to content

Commit

Permalink
Model can change now.
Browse files Browse the repository at this point in the history
  • Loading branch information
halilcosdu committed May 4, 2024
1 parent 79233de commit cb7994e
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ This is the contents of the published config file:
'model' => SlowLog::class,
],
'ai_recommendation' => env('SLOWER_AI_RECOMMENDATION', true), // You can completely disable AI, and then the package will only log slow queries to the database.
'recommendation_model' => env('SLOWER_AI_RECOMMENDATION_MODEL', 'gpt-4'),
'open_ai' => [
'api_key' => env('OPENAI_API_KEY'),
'organization' => env('OPENAI_ORGANIZATION'),
Expand Down
1 change: 1 addition & 0 deletions config/slower.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
'model' => SlowLog::class,
],
'ai_recommendation' => env('SLOWER_AI_RECOMMENDATION', true),
'recommendation_model' => env('SLOWER_AI_RECOMMENDATION_MODEL', 'gpt-4'),
'open_ai' => [
'api_key' => env('OPENAI_API_KEY'),
'organization' => env('OPENAI_ORGANIZATION'),
Expand Down
2 changes: 1 addition & 1 deletion src/Services/RecommendationService.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public function getRecommendation($record): ?string
{

$result = $this->client->chat()->create([
'model' => 'gpt-4',
'model' => config('slower.recommendation_model', 'gpt-4'),
'messages' => [
['role' => 'system', 'content' => config('slower.prompt')],
['role' => 'user', 'content' => 'The query execution took '.$record->time.' milliseconds.'.PHP_EOL.
Expand Down

0 comments on commit cb7994e

Please sign in to comment.