optimize debug retrieval

This commit is contained in:
team2
2026-03-02 07:20:48 +01:00
parent e6858d51d4
commit a1acc3e106
2 changed files with 217 additions and 246 deletions

View File

@@ -18,18 +18,15 @@ final class NdjsonHybridRetriever implements RetrieverInterface
{ {
private const VECTOR_SCORE_THRESHOLD = 0.82; private const VECTOR_SCORE_THRESHOLD = 0.82;
// Guardrails
private const HARD_MAX_CHUNKS = 90; private const HARD_MAX_CHUNKS = 90;
private const HARD_MAX_VECTORK = 250; private const HARD_MAX_VECTORK = 250;
private const LIST_BONUS = 1.25; private const LIST_BONUS = 1.25;
// Selection / Fusion
private const MAX_CHUNKS_PER_DOC = 2; private const MAX_CHUNKS_PER_DOC = 2;
private const MIN_CHUNK_DISTANCE = 2; private const MIN_CHUNK_DISTANCE = 2;
private const RRF_K = 60; private const RRF_K = 60;
// Hardening (nur Edge-Cases; Standardverhalten bleibt gleich)
private const THRESHOLD_FLOOR = 0.65; private const THRESHOLD_FLOOR = 0.65;
private const THRESHOLD_CEIL = 0.90; private const THRESHOLD_CEIL = 0.90;
private const EMPTY_RRF_FALLBACK_TOPN = 5; private const EMPTY_RRF_FALLBACK_TOPN = 5;
@@ -45,161 +42,140 @@ final class NdjsonHybridRetriever implements RetrieverInterface
private readonly CatalogIntentLite $catalogIntent, private readonly CatalogIntentLite $catalogIntent,
private readonly IntentRouteResolver $routeResolver, private readonly IntentRouteResolver $routeResolver,
private readonly EntityCatalogService $entityCatalogService private readonly EntityCatalogService $entityCatalogService
) ) {}
{
}
// ========================================================= // =========================================================
// PRODUCTION // PUBLIC API
// ========================================================= // =========================================================
public function retrieve(string $prompt): array public function retrieve(string $prompt): array
{ {
$config = $this->configRepository->findActiveForModel(); $config = $this->requireConfig();
$result = $this->execute($prompt, $config, false);
if ($config === null) { if ($result['catalogBlock'] !== null) {
throw new \RuntimeException('No active ModelGenerationConfig found.'); return [$result['catalogBlock']];
} }
return $this->retrieveInternal($prompt, $config); return $this->collectTextsFromIds(
$result['selectedChunkIds'],
$result['rows']
);
} }
public function retrieveInternal(string $prompt, ModelGenerationConfig $config): array
{
// ------------------------------------------------------------
// ROUTING-MATRIX (minimal, ohne Core zu zerlegen)
// ------------------------------------------------------------
// 1) Entity (semantisch über Tag-Vektor)
$entityLabel = $this->catalogIntent->detect($prompt);
// 2) Intent (regelbasiert)
$salesIntent = $this->detectSalesIntent($prompt);
// 3) Route bestimmen (Intent + Entity)
$route = $this->routeResolver->resolve($salesIntent, $entityLabel);
// 4) Early Exit nur für catalog_list
if ($route === IntentRouteResolver::ROUTE_CATALOG_LIST && $entityLabel !== null) {
$catalogBlock = $this->entityCatalogService->listByTerm($entityLabel);
if ($catalogBlock !== null) {
return [$catalogBlock];
}
}
// ------------------------------------------------------------
// NORMALER CORE
// ------------------------------------------------------------
$core = $this->runCore($prompt, $config, false, $salesIntent);
if ($core['ranked_chunk_ids'] === [] || $core['rows'] === []) {
return [];
}
if (!$core['is_list_query']) {
$selectedIds = $this->selectSalesChunkIds($core['ranked_chunk_ids'], $core['rows'], $core['limit']);
return $this->collectTextsFromIds($selectedIds, $core['rows']);
}
$selectedIds = $this->selectListChunkIds($core['ranked_chunk_ids'], $core['rows'], $core['limit']);
return $this->collectTextsFromIds($selectedIds, $core['rows']);
}
// =========================================================
// DEBUG (deterministisch: gleiche Intent-Bestimmung wie Prod)
// =========================================================
/**
* @return array<int, array{
* rank:int,
* chunk_id:string,
* document_id:(string|null),
* raw_score:(float|null),
* rrf_score:(float|null),
* threshold:float,
* intent:string,
* is_list_query:bool,
* text:string
* }>
*/
public function retrieveDebug(string $prompt, ?ModelGenerationConfig $config = null): array public function retrieveDebug(string $prompt, ?ModelGenerationConfig $config = null): array
{ {
$config = $config ?? $this->configRepository->findActiveForModel(); $config = $config ?? $this->requireConfig();
$result = $this->execute($prompt, $config, true);
if ($config === null) { if ($result['catalogBlock'] !== null) {
throw new \RuntimeException('No active ModelGenerationConfig found.'); return [[
} 'rank' => 1,
'chunk_id' => '__CATALOG_LIST__',
$salesIntent = $this->detectSalesIntent($prompt); 'document_id' => null,
'raw_score' => null,
// Debug zeigt Core ohne Early Exit, aber mit identischem Intent-Input. 'rrf_score' => null,
$core = $this->runCore($prompt, $config, true, $salesIntent); 'threshold' => 0.0,
'intent' => $result['intent'],
if ($core['ranked_chunk_ids'] === [] || $core['rows'] === []) { 'route' => $result['route'],
return []; 'entity_label' => $result['entityLabel'],
} 'is_list_query' => true,
'text' => $result['catalogBlock'],
$selectedChunkIds = $core['is_list_query'] ]];
? $this->selectListChunkIds($core['ranked_chunk_ids'], $core['rows'], $core['limit'])
: $this->selectSalesChunkIds($core['ranked_chunk_ids'], $core['rows'], $core['limit']);
if ($selectedChunkIds === []) {
return [];
} }
$out = []; $out = [];
$rank = 0; $rank = 0;
foreach ($selectedChunkIds as $chunkId) { foreach ($result['selectedChunkIds'] as $chunkId) {
if (!isset($core['rows'][$chunkId])) { if (!isset($result['rows'][$chunkId])) {
continue; continue;
} }
$rank++; $rank++;
$text = trim((string)($core['rows'][$chunkId]['text'] ?? ''));
$out[] = [ $out[] = [
'rank' => $rank, 'rank' => $rank,
'chunk_id' => (string)$chunkId, 'chunk_id' => $chunkId,
'document_id' => isset($core['rows'][$chunkId]['document_id']) ? (string)$core['rows'][$chunkId]['document_id'] : null, 'document_id' => $result['rows'][$chunkId]['document_id'] ?? null,
'raw_score' => isset($core['raw_scores'][$chunkId]) ? (float)$core['raw_scores'][$chunkId] : null, 'raw_score' => $result['rawScores'][$chunkId] ?? null,
'rrf_score' => isset($core['rrf_scores'][$chunkId]) ? (float)$core['rrf_scores'][$chunkId] : null, 'rrf_score' => $result['rrfScores'][$chunkId] ?? null,
'threshold' => (float)$core['threshold'], 'threshold' => $result['threshold'],
'intent' => (string)$core['sales_intent'], 'intent' => $result['intent'],
'is_list_query' => (bool)$core['is_list_query'], 'route' => $result['route'],
'text' => $text, 'entity_label' => $result['entityLabel'],
'is_list_query' => $result['isListQuery'],
'text' => trim((string)$result['rows'][$chunkId]['text']),
]; ];
} }
return $out; return $out;
} }
// =========================================================
// CENTRAL ORCHESTRATION
// =========================================================
private function execute(
string $prompt,
ModelGenerationConfig $config,
bool $withScores
): array {
$entityLabel = $this->catalogIntent->detect($prompt);
$salesIntent = $this->detectSalesIntent($prompt);
$route = $this->routeResolver->resolve($salesIntent, $entityLabel);
if ($route === IntentRouteResolver::ROUTE_CATALOG_LIST && $entityLabel !== null) {
$catalogBlock = $this->entityCatalogService->listByTerm($entityLabel);
if ($catalogBlock !== null) {
return [
'route' => $route,
'entityLabel' => $entityLabel,
'intent' => $salesIntent,
'isListQuery' => true,
'selectedChunkIds' => [],
'rows' => [],
'rrfScores' => [],
'rawScores' => [],
'threshold' => 0.0,
'catalogBlock' => trim($catalogBlock),
];
}
}
$core = $this->runCore($prompt, $config, $withScores, $salesIntent);
$selectedChunkIds = $core['is_list_query']
? $this->selectListChunkIds($core['ranked_chunk_ids'], $core['rows'], $core['limit'])
: $this->selectSalesChunkIds($core['ranked_chunk_ids'], $core['rows'], $core['limit']);
return [
'route' => $route,
'entityLabel' => $entityLabel,
'intent' => $salesIntent,
'isListQuery' => $core['is_list_query'],
'selectedChunkIds' => $selectedChunkIds,
'rows' => $core['rows'],
'rrfScores' => $core['rrf_scores'],
'rawScores' => $core['raw_scores'],
'threshold' => $core['threshold'],
'catalogBlock' => null,
];
}
// ========================================================= // =========================================================
// CORE PIPELINE // CORE PIPELINE
// ========================================================= // =========================================================
/**
* @return array{
* limit:int,
* is_list_query:bool,
* sales_intent:string,
* threshold:float,
* topk:int,
* ranked_chunk_ids:string[],
* rows:array<string, array<string,mixed>>,
* rrf_scores:array<string,float>,
* raw_scores:array<string,float>
* }
*/
private function runCore( private function runCore(
string $prompt, string $prompt,
ModelGenerationConfig $config, ModelGenerationConfig $config,
bool $withScores, bool $withScores,
string $salesIntent string $salesIntent
): array ): array {
{
$limit = max(1, min($config->getRetrievalMaxChunks(), self::HARD_MAX_CHUNKS)); $limit = max(1, min($config->getRetrievalMaxChunks(), self::HARD_MAX_CHUNKS));
$vectorTopKBase = max(1, min($config->getRetrievalVectorTopK(), self::HARD_MAX_VECTORK)); $vectorTopKBase = max(1, min($config->getRetrievalVectorTopK(), self::HARD_MAX_VECTORK));
@@ -210,33 +186,24 @@ final class NdjsonHybridRetriever implements RetrieverInterface
$cleanQuery = $prompt; $cleanQuery = $prompt;
} }
[$threshold, $topK] = $this->computeThresholdAndTopK($salesIntent, $isListQuery, $vectorTopKBase); [$threshold, $topK] = $this->computeThresholdAndTopK(
$salesIntent,
$isListQuery,
$vectorTopKBase
);
// Candidate Routing (keine Set-Map nötig; scoped nur wenn IDs existieren)
$candidateDocIds = $this->tagRouting->route($cleanQuery); $candidateDocIds = $this->tagRouting->route($cleanQuery);
$candidateDocIds = is_array($candidateDocIds) ? array_values(array_unique(array_filter($candidateDocIds, 'is_string'))) : []; $candidateDocIds = is_array($candidateDocIds)
? array_values(array_unique(array_filter($candidateDocIds, 'is_string')))
: [];
$globalHits = $this->vectorClient->search($cleanQuery, $topK); $globalHits = $this->vectorClient->search($cleanQuery, $topK);
$scopedHits = []; $scopedHits = [];
if ($candidateDocIds !== []) { if (!empty($candidateDocIds)) {
$scopedHits = $this->vectorClient->searchScoped($cleanQuery, $topK, $candidateDocIds); $scopedHits = $this->vectorClient->searchScoped($cleanQuery, $topK, $candidateDocIds);
} }
if ($globalHits === [] && $scopedHits === []) {
return [
'limit' => $limit,
'is_list_query' => $isListQuery,
'sales_intent' => $salesIntent,
'threshold' => $threshold,
'topk' => $topK,
'ranked_chunk_ids' => [],
'rows' => [],
'rrf_scores' => [],
'raw_scores' => [],
];
}
$fused = $this->fuseHits( $fused = $this->fuseHits(
$globalHits, $globalHits,
$scopedHits, $scopedHits,
@@ -248,37 +215,19 @@ final class NdjsonHybridRetriever implements RetrieverInterface
$rrfScores = $fused['rrf_scores']; $rrfScores = $fused['rrf_scores'];
$rawScores = $fused['raw_scores']; $rawScores = $fused['raw_scores'];
// 🛡 Hardening: wenn Threshold alles rausfiltert, aber globale Hits existieren,
// nehmen wir Top-N als minimalen Kontext. Greift nur in Edge-Cases.
if ($rrfScores === [] && $globalHits !== []) { if ($rrfScores === [] && $globalHits !== []) {
$rrfScores = $this->fallbackRrfFromHits($globalHits, self::EMPTY_RRF_FALLBACK_TOPN); $rrfScores = $this->fallbackRrfFromHits($globalHits, self::EMPTY_RRF_FALLBACK_TOPN);
} }
if ($rrfScores === []) {
return [
'limit' => $limit,
'is_list_query' => $isListQuery,
'sales_intent' => $salesIntent,
'threshold' => $threshold,
'topk' => $topK,
'ranked_chunk_ids' => [],
'rows' => [],
'rrf_scores' => [],
'raw_scores' => $rawScores,
];
}
arsort($rrfScores); arsort($rrfScores);
$rankedChunkIds = array_keys($rrfScores);
$rankedChunkIds = array_keys($rrfScores);
$rows = $this->lookup->findByChunkIds($rankedChunkIds); $rows = $this->lookup->findByChunkIds($rankedChunkIds);
return [ return [
'limit' => $limit, 'limit' => $limit,
'is_list_query' => $isListQuery, 'is_list_query' => $isListQuery,
'sales_intent' => $salesIntent,
'threshold' => $threshold, 'threshold' => $threshold,
'topk' => $topK,
'ranked_chunk_ids' => $rankedChunkIds, 'ranked_chunk_ids' => $rankedChunkIds,
'rows' => $rows, 'rows' => $rows,
'rrf_scores' => $rrfScores, 'rrf_scores' => $rrfScores,
@@ -286,36 +235,33 @@ final class NdjsonHybridRetriever implements RetrieverInterface
]; ];
} }
/** // =========================================================
* @return array{0: float, 1: int} threshold, topK // SUPPORT
*/ // =========================================================
private function requireConfig(): ModelGenerationConfig
{
$config = $this->configRepository->findActiveForModel();
if ($config === null) {
throw new \RuntimeException('No active ModelGenerationConfig found.');
}
return $config;
}
private function detectSalesIntent(string $prompt): string
{
$data = $this->salesIntentLite->detect($prompt);
return (string)($data['intent'] ?? SalesIntentLite::DISCOVERY);
}
private function computeThresholdAndTopK(string $salesIntent, bool $isListQuery, int $vectorTopKBase): array private function computeThresholdAndTopK(string $salesIntent, bool $isListQuery, int $vectorTopKBase): array
{ {
$threshold = self::VECTOR_SCORE_THRESHOLD; $threshold = self::VECTOR_SCORE_THRESHOLD;
$topK = $vectorTopKBase; $topK = $vectorTopKBase;
switch ($salesIntent) { if ($salesIntent === SalesIntentLite::OBJECTION ||
case SalesIntentLite::OBJECTION: $salesIntent === SalesIntentLite::PRICING) {
case SalesIntentLite::PRICING: $threshold += 0.02;
$threshold += 0.02;
break;
case SalesIntentLite::COMPARISON:
$topK = (int)round($vectorTopKBase * 1.4);
break;
case SalesIntentLite::IMPLEMENTATION:
$topK = (int)round($vectorTopKBase * 1.3);
break;
case SalesIntentLite::ROI:
$topK = (int)round($vectorTopKBase * 1.2);
break;
case SalesIntentLite::DISCOVERY:
default:
$threshold += 0;
break;
} }
if ($isListQuery) { if ($isListQuery) {
@@ -323,39 +269,34 @@ final class NdjsonHybridRetriever implements RetrieverInterface
} }
$topK = max(1, min($topK, self::HARD_MAX_VECTORK)); $topK = max(1, min($topK, self::HARD_MAX_VECTORK));
// Enterprise clamp: verhindert Drift, ohne den aktuellen Normalfall zu ändern.
$threshold = max(self::THRESHOLD_FLOOR, min(self::THRESHOLD_CEIL, $threshold)); $threshold = max(self::THRESHOLD_FLOOR, min(self::THRESHOLD_CEIL, $threshold));
return [$threshold, $topK]; return [$threshold, $topK];
} }
/**
* @return array{
* rrf_scores: array<string,float>,
* raw_scores: array<string,float>
* }
*/
private function fuseHits( private function fuseHits(
array $globalHits, array $globalHits,
array $scopedHits, array $scopedHits,
float $threshold, float $threshold,
bool $boostScoped, bool $boostScoped,
bool $captureRaw bool $captureRaw
): array ): array {
{
$rrfScores = []; $rrfScores = [];
$rawScores = []; $rawScores = [];
$apply = function (array $hits, bool $boost) use (&$rrfScores, &$rawScores, $threshold, $captureRaw): void { $apply = function (array $hits, bool $boost) use (&$rrfScores, &$rawScores, $threshold, $captureRaw): void {
$rank = 0; $rank = 0;
foreach ($hits as $hit) { foreach ($hits as $hit) {
if (!isset($hit['chunk_id'], $hit['score'])) { if (!isset($hit['chunk_id'], $hit['score'])) {
continue; continue;
} }
$raw = (float)$hit['score']; $raw = (float)$hit['score'];
if ($raw < $threshold) { if ($raw < $threshold) {
continue; continue;
} }
@@ -386,12 +327,6 @@ final class NdjsonHybridRetriever implements RetrieverInterface
]; ];
} }
/**
* Minimaler Fallback: baut RRF nur aus der Reihenfolge (ohne Threshold),
* damit Edge-Cases nicht leer laufen.
*
* @return array<string,float>
*/
private function fallbackRrfFromHits(array $hits, int $topN): array private function fallbackRrfFromHits(array $hits, int $topN): array
{ {
$rrf = []; $rrf = [];
@@ -403,8 +338,7 @@ final class NdjsonHybridRetriever implements RetrieverInterface
} }
$rank++; $rank++;
$chunkId = (string)$hit['chunk_id']; $rrf[(string)$hit['chunk_id']] = 1.0 / (self::RRF_K + $rank);
$rrf[$chunkId] = 1.0 / (self::RRF_K + $rank);
if ($rank >= $topN) { if ($rank >= $topN) {
break; break;
@@ -414,16 +348,6 @@ final class NdjsonHybridRetriever implements RetrieverInterface
return $rrf; return $rrf;
} }
private function detectSalesIntent(string $prompt): string
{
$data = $this->salesIntentLite->detect($prompt);
return (string)($data['intent'] ?? SalesIntentLite::DISCOVERY);
}
// =========================================================
// SELECTION (shared)
// =========================================================
private function selectListChunkIds(array $chunkIds, array $rows, int $limit): array private function selectListChunkIds(array $chunkIds, array $rows, int $limit): array
{ {
$seen = []; $seen = [];
@@ -439,7 +363,6 @@ final class NdjsonHybridRetriever implements RetrieverInterface
continue; continue;
} }
// Dedupe Key (billig & stabil)
$key = md5(mb_strtolower((string)preg_replace('/\s+/u', ' ', $chunk))); $key = md5(mb_strtolower((string)preg_replace('/\s+/u', ' ', $chunk)));
if (isset($seen[$key])) { if (isset($seen[$key])) {
@@ -449,7 +372,7 @@ final class NdjsonHybridRetriever implements RetrieverInterface
$seen[$key] = true; $seen[$key] = true;
$out[] = (string)$id; $out[] = (string)$id;
if (\count($out) >= $limit) { if (count($out) >= $limit) {
break; break;
} }
} }
@@ -464,6 +387,7 @@ final class NdjsonHybridRetriever implements RetrieverInterface
$docChunkPositions = []; $docChunkPositions = [];
foreach ($chunkIds as $chunkId) { foreach ($chunkIds as $chunkId) {
if (!isset($rows[$chunkId]['text'])) { if (!isset($rows[$chunkId]['text'])) {
continue; continue;
} }
@@ -480,8 +404,7 @@ final class NdjsonHybridRetriever implements RetrieverInterface
} }
if (is_int($chunkIndex)) { if (is_int($chunkIndex)) {
$prev = $docChunkPositions[$docId] ?? []; foreach ($docChunkPositions[$docId] ?? [] as $prevIdx) {
foreach ($prev as $prevIdx) {
if (abs($prevIdx - $chunkIndex) < self::MIN_CHUNK_DISTANCE) { if (abs($prevIdx - $chunkIndex) < self::MIN_CHUNK_DISTANCE) {
continue 2; continue 2;
} }
@@ -497,7 +420,7 @@ final class NdjsonHybridRetriever implements RetrieverInterface
$out[] = (string)$chunkId; $out[] = (string)$chunkId;
$docCounter[$docId] = ($docCounter[$docId] ?? 0) + 1; $docCounter[$docId] = ($docCounter[$docId] ?? 0) + 1;
if (\count($out) >= $limit) { if (count($out) >= $limit) {
break; break;
} }
} }
@@ -505,10 +428,6 @@ final class NdjsonHybridRetriever implements RetrieverInterface
return $out; return $out;
} }
// =========================================================
// COLLECT (shared)
// =========================================================
private function collectTextsFromIds(array $chunkIds, array $rows): array private function collectTextsFromIds(array $chunkIds, array $rows): array
{ {
$out = []; $out = [];
@@ -519,11 +438,9 @@ final class NdjsonHybridRetriever implements RetrieverInterface
} }
$text = trim((string)$rows[$id]['text']); $text = trim((string)$rows[$id]['text']);
if ($text === '') { if ($text !== '') {
continue; $out[] = $text;
} }
$out[] = $text;
} }
return $out; return $out;

View File

@@ -21,19 +21,16 @@
<div class="card bg-black border-secondary text-light mb-4"> <div class="card bg-black border-secondary text-light mb-4">
<div class="card-body small"> <div class="card-body small">
<div class="row"> <div class="row">
<div class="col-md-6"> <div class="col-md-6">
<strong>Max Chunks:</strong> <strong>Max Chunks:</strong>
{{ config.retrievalMaxChunks }} {{ config.retrievalMaxChunks }}
</div> </div>
<div class="col-md-6"> <div class="col-md-6">
<strong>Vector Top K:</strong> <strong>Vector Top K:</strong>
{{ config.retrievalVectorTopK }} {{ config.retrievalVectorTopK }}
</div> </div>
</div> </div>
</div> </div>
</div> </div>
@@ -77,38 +74,95 @@
</h5> </h5>
<div style="max-height: 500px; overflow-y: auto;"> <div style="max-height: 500px; overflow-y: auto;">
{% for chunk in results %} {% for chunk in results %}
<div class="border border-secondary p-3 mb-3 small"> <div class="border border-secondary p-3 mb-3 small">
{# ================= META-ZEILE ================= #} {# ================= META-ZEILE ================= #}
<div class="mb-2 text-warning" style="font-size: 11px; line-height: 1.4;"> <div class="mb-2 text-warning"
<span class="text-info"><strong>rank:</strong> {{ chunk.rank }}</span> | style="font-size: 11px; line-height: 1.5; word-break: break-all;">
<span class="text-info"><strong>chunk_id:</strong> {{ chunk.chunk_id }}</span> |
<span class="text-info"><strong>document_id:</strong> <a <span class="text-info">
class="text-info" <strong>rank:</strong> {{ chunk.rank }}
href="{{ path('admin_document_show', { id: chunk.document_id }) }}"> </span> |
{{ chunk.document_id }}
</a></span> | <span class="text-info">
<span><strong>rrf_score:</strong> {{ chunk.rrf_score|number_format(6, '.', '') }}</span> <strong>chunk_id:</strong> {{ chunk.chunk_id }}
| </span> |
<span><strong>raw_score:</strong> {{ chunk.raw_score|number_format(6, '.', '') }}</span>
| <span class="text-info">
<strong>document_id:</strong>
{% if chunk.document_id %}
<a class="text-info"
href="{{ path('admin_document_show', { id: chunk.document_id }) }}">
{{ chunk.document_id }}
</a>
{% else %}
{% endif %}
</span> |
<span><strong>threshold:</strong> {{ chunk.threshold }}</span> |
<span><strong>intent:</strong> {{ chunk.intent }}</span> |
<span> <span>
<strong>is_list_query:</strong> <strong>route:</strong>
{{ chunk.is_list_query ? 'true' : 'false' }} <span class="
</span> {% if chunk.route == 'catalog_list' %}
text-primary
{% elseif chunk.route starts with 'catalog' %}
text-info
{% elseif chunk.route starts with 'sales' %}
text-success
{% else %}
text-secondary
{% endif %}
">
{{ chunk.route ?? '—' }}
</span>
</span> |
<span>
<strong>entity:</strong>
{{ chunk.entity_label ?? '—' }}
</span> |
<span>
<strong>intent:</strong>
{{ chunk.intent ?? '—' }}
</span> |
<span>
<strong>rrf:</strong>
{{ chunk.rrf_score is not null
? chunk.rrf_score|number_format(6, '.', '')
: '—' }}
</span> |
<span>
<strong>raw:</strong>
{{ chunk.raw_score is not null
? chunk.raw_score|number_format(6, '.', '')
: '—' }}
</span> |
<span>
<strong>threshold:</strong>
{{ chunk.threshold ?? '—' }}
</span> |
<span>
<strong>list:</strong>
{{ chunk.is_list_query ? 'true' : 'false' }}
</span>
</div> </div>
{# ================= CHUNK TEXT ================= #} {# ================= CHUNK TEXT ================= #}
<div> <div class="text-light">
{{ chunk.text }} {{ chunk.text }}
</div> </div>
</div> </div>
{% endfor %} {% endfor %}
</div> </div>
</div> </div>