optimize data retrieve by customfields und enricher

This commit is contained in:
team 1
2026-04-13 16:11:19 +02:00
parent 0a05ccaee3
commit f7685c6fb5
10 changed files with 234 additions and 32 deletions

View File

@@ -41,8 +41,11 @@ final class NdjsonHybridRetriever implements RetrieverInterface
private readonly SalesIntentLite $salesIntentLite,
private readonly CatalogIntentLite $catalogIntent,
private readonly IntentRouteResolver $routeResolver,
private readonly EntityCatalogService $entityCatalogService
) {}
private readonly EntityCatalogService $entityCatalogService,
private readonly QueryEnricher $queryEnricher,
)
{
}
// =========================================================
// PUBLIC API
@@ -126,10 +129,11 @@ final class NdjsonHybridRetriever implements RetrieverInterface
// =========================================================
private function execute(
string $prompt,
string $prompt,
ModelGenerationConfig $config,
bool $withScores
): array {
bool $withScores
): array
{
$entityLabel = $this->catalogIntent->detect($prompt);
$salesIntent = $this->detectSalesIntent($prompt);
@@ -195,11 +199,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));
@@ -207,6 +212,7 @@ final class NdjsonHybridRetriever implements RetrieverInterface
$isListQuery = $this->intentLite->isListQuery($prompt);
$cleanQuery = $this->queryCleaner->clean($prompt);
$cleanQuery = $this->queryEnricher->enrichPrompt($cleanQuery);
if ($cleanQuery === '') {
return [
@@ -316,9 +322,10 @@ final class NdjsonHybridRetriever implements RetrieverInterface
private function computeThresholdAndTopK(
string $salesIntent,
bool $isListQuery,
int $vectorTopKBase
): array {
bool $isListQuery,
int $vectorTopKBase
): array
{
$threshold = self::VECTOR_SCORE_THRESHOLD;
$topK = $vectorTopKBase;
@@ -344,9 +351,10 @@ final class NdjsonHybridRetriever implements RetrieverInterface
array $globalHits,
array $scopedHits,
float $threshold,
bool $boostScoped,
bool $captureRaw
): array {
bool $boostScoped,
bool $captureRaw
): array
{
$rrfScores = [];
$rawScores = [];