optimize debug retrieval
This commit is contained in:
@@ -16,7 +16,7 @@ use App\Vector\VectorSearchClient;
|
||||
|
||||
final class NdjsonHybridRetriever implements RetrieverInterface
|
||||
{
|
||||
private const VECTOR_SCORE_THRESHOLD = 0.72;
|
||||
private const VECTOR_SCORE_THRESHOLD = 0.82;
|
||||
|
||||
// Guardrails
|
||||
private const HARD_MAX_CHUNKS = 90;
|
||||
@@ -45,7 +45,8 @@ final class NdjsonHybridRetriever implements RetrieverInterface
|
||||
private readonly CatalogIntentLite $catalogIntent,
|
||||
private readonly IntentRouteResolver $routeResolver,
|
||||
private readonly EntityCatalogService $entityCatalogService
|
||||
) {
|
||||
)
|
||||
{
|
||||
}
|
||||
|
||||
// =========================================================
|
||||
@@ -123,9 +124,9 @@ final class NdjsonHybridRetriever implements RetrieverInterface
|
||||
* text:string
|
||||
* }>
|
||||
*/
|
||||
public function retrieveDebug(string $prompt): array
|
||||
public function retrieveDebug(string $prompt, ?ModelGenerationConfig $config = null): array
|
||||
{
|
||||
$config = $this->configRepository->findActiveForModel();
|
||||
$config = $config ?? $this->configRepository->findActiveForModel();
|
||||
|
||||
if ($config === null) {
|
||||
throw new \RuntimeException('No active ModelGenerationConfig found.');
|
||||
@@ -193,11 +194,12 @@ final class NdjsonHybridRetriever implements RetrieverInterface
|
||||
* }
|
||||
*/
|
||||
private function runCore(
|
||||
string $prompt,
|
||||
string $prompt,
|
||||
ModelGenerationConfig $config,
|
||||
bool $withScores,
|
||||
string $salesIntent
|
||||
): array {
|
||||
bool $withScores,
|
||||
string $salesIntent
|
||||
): array
|
||||
{
|
||||
$limit = max(1, min($config->getRetrievalMaxChunks(), self::HARD_MAX_CHUNKS));
|
||||
$vectorTopKBase = max(1, min($config->getRetrievalVectorTopK(), self::HARD_MAX_VECTORK));
|
||||
|
||||
@@ -338,9 +340,10 @@ final class NdjsonHybridRetriever implements RetrieverInterface
|
||||
array $globalHits,
|
||||
array $scopedHits,
|
||||
float $threshold,
|
||||
bool $boostScoped,
|
||||
bool $captureRaw
|
||||
): array {
|
||||
bool $boostScoped,
|
||||
bool $captureRaw
|
||||
): array
|
||||
{
|
||||
$rrfScores = [];
|
||||
$rawScores = [];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user