diff --git a/src/Intent/CatalogIntentLite.php b/src/Intent/CatalogIntentLite.php index a879ddf..b8004c3 100644 --- a/src/Intent/CatalogIntentLite.php +++ b/src/Intent/CatalogIntentLite.php @@ -4,6 +4,7 @@ declare(strict_types=1); namespace App\Intent; +use App\Knowledge\Retrieval\QueryCleaner; use App\Tag\TagVectorSearchClient; use App\Tag\TagTypes; @@ -29,7 +30,7 @@ final class CatalogIntentLite * Minimaler Similarity-Score. * Verhindert Rauschen. */ - private const MIN_SCORE = 0.75; + private const MIN_SCORE = 0.72; /** * Differenz zwischen Top1 und Top2, @@ -39,6 +40,7 @@ final class CatalogIntentLite public function __construct( private readonly TagVectorSearchClient $tagVectorClient, + private readonly QueryCleaner $queryCleaner, ) {} /** @@ -52,8 +54,10 @@ final class CatalogIntentLite return null; } - // 1) Vector-Suche - $hits = $this->tagVectorClient->search($prompt, 3); + $promptTag = $this->queryCleaner->clean($prompt); + + // 1) Tag-Vector-Suche + $hits = $this->tagVectorClient->search($promptTag, 3); if ($hits === []) { return null; @@ -62,7 +66,7 @@ final class CatalogIntentLite $best = $hits[0]; $bestScore = (float)($best['score'] ?? 0.0); - // 2) Score-Gate + // 2) Score-Tags if ($bestScore < self::MIN_SCORE) { return null; } diff --git a/src/Service/Admin/ModelGenerationConfigAdminService.php b/src/Service/Admin/ModelGenerationConfigAdminService.php index f1a2015..802b9f2 100644 --- a/src/Service/Admin/ModelGenerationConfigAdminService.php +++ b/src/Service/Admin/ModelGenerationConfigAdminService.php @@ -74,7 +74,7 @@ final class ModelGenerationConfigAdminService return []; } - return $this->retriever->retrieveInternal($prompt, $config); + return $this->retriever->retrieveDebug($prompt); } private function requireString(mixed $value, string $field): string diff --git a/templates/admin/model_config/test_retrieval.html.twig b/templates/admin/model_config/test_retrieval.html.twig index 2d35cba..dd88bd0 100644 --- a/templates/admin/model_config/test_retrieval.html.twig +++ b/templates/admin/model_config/test_retrieval.html.twig @@ -77,13 +77,37 @@
- {% for chunk in results %}
- {{ chunk|nl2br }} + + {# ================= META-ZEILE ================= #} +
+ rank: {{ chunk.rank }} | + chunk_id: {{ chunk.chunk_id }} | + document_id: + {{ chunk.document_id }} + | + raw_score: {{ chunk.raw_score|number_format(6, '.', '') }} + | + rrf_score: {{ chunk.rrf_score|number_format(6, '.', '') }} + | + threshold: {{ chunk.threshold }} | + intent: {{ chunk.intent }} | + + is_list_query: + {{ chunk.is_list_query ? 'true' : 'false' }} + +
+ + {# ================= CHUNK TEXT ================= #} +
+ {{ chunk.text }} +
+
{% endfor %} -