Update: 2026-05-09 17:09:49
This commit is contained in:
@@ -10,7 +10,7 @@ use App\Services\InvoiceExtractionService;
|
||||
*/
|
||||
class AI
|
||||
{
|
||||
private static string $baseUrl = "https://generativelanguage.googleapis.com/v1beta/models/gemini-flash-lite-latest:generateContent";
|
||||
private static string $baseUrl = "https://generativelanguage.googleapis.com/v1beta/models/" . AIConfig::MODEL_NAME . ":generateContent";
|
||||
|
||||
private static int $maxRetries = 3;
|
||||
|
||||
@@ -25,8 +25,7 @@ class AI
|
||||
return null;
|
||||
}
|
||||
|
||||
$service = new InvoiceExtractionService();
|
||||
$prompt = $service->buildExtractionPrompt();
|
||||
$prompt = AIConfig::getExtractionPrompt();
|
||||
|
||||
$payload = [
|
||||
"contents" => [
|
||||
|
||||
22
app/Core/AIConfig.php
Normal file
22
app/Core/AIConfig.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Core;
|
||||
|
||||
use App\Services\InvoiceExtractionService;
|
||||
|
||||
class AIConfig
|
||||
{
|
||||
/**
|
||||
* The model name preferred by the user
|
||||
*/
|
||||
public const MODEL_NAME = "gemini-flash-lite-latest";
|
||||
|
||||
/**
|
||||
* Centralized prompt for invoice extraction
|
||||
*/
|
||||
public static function getExtractionPrompt(): string
|
||||
{
|
||||
$service = new InvoiceExtractionService();
|
||||
return $service->buildExtractionPrompt();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user