first update to external config values

This commit is contained in:
team 1
2026-04-24 13:13:56 +02:00
parent 868f9a8857
commit 26ec0afc5c
11 changed files with 292 additions and 187 deletions

View File

@@ -9,17 +9,6 @@ use Symfony\Contracts\HttpClient\HttpClientInterface;
final class VectorSearchClient
{
/**
* Soft minimum similarity threshold.
* Lower than tag gate to allow broader recall.
*/
private const MIN_SCORE = 0.30;
/**
* Hard limit clamp to avoid abusive queries.
*/
private const MAX_LIMIT = 200;
private HttpClientInterface $http;
private string $serviceUrl;
private LoggerInterface $agentLogger;
@@ -27,7 +16,10 @@ final class VectorSearchClient
public function __construct(
HttpClientInterface $http,
string $serviceUrl,
LoggerInterface $agentLogger
LoggerInterface $agentLogger,
private readonly float $minScore = 0.30,
private readonly int $maxLimit = 200,
private readonly int $timeoutSeconds = 10,
) {
$this->http = $http;
$this->serviceUrl = rtrim($serviceUrl, '/');
@@ -100,7 +92,7 @@ final class VectorSearchClient
$this->serviceUrl . '/search-chunks',
[
'json' => $payload,
'timeout' => 10,
'timeout' => $this->timeoutSeconds,
]
);
@@ -143,8 +135,7 @@ final class VectorSearchClient
$score = (float)$score;
// 🔥 Soft Confidence Gate
if ($score < self::MIN_SCORE) {
if ($score < $this->minScore) {
continue;
}
@@ -179,10 +170,10 @@ final class VectorSearchClient
return 1;
}
if ($limit > self::MAX_LIMIT) {
return self::MAX_LIMIT;
if ($limit > $this->maxLimit) {
return $this->maxLimit;
}
return $limit;
}
}
}