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.');
|
||||
@@ -197,7 +198,8 @@ final class NdjsonHybridRetriever implements RetrieverInterface
|
||||
ModelGenerationConfig $config,
|
||||
bool $withScores,
|
||||
string $salesIntent
|
||||
): array {
|
||||
): array
|
||||
{
|
||||
$limit = max(1, min($config->getRetrievalMaxChunks(), self::HARD_MAX_CHUNKS));
|
||||
$vectorTopKBase = max(1, min($config->getRetrievalVectorTopK(), self::HARD_MAX_VECTORK));
|
||||
|
||||
@@ -340,7 +342,8 @@ final class NdjsonHybridRetriever implements RetrieverInterface
|
||||
float $threshold,
|
||||
bool $boostScoped,
|
||||
bool $captureRaw
|
||||
): array {
|
||||
): array
|
||||
{
|
||||
$rrfScores = [];
|
||||
$rawScores = [];
|
||||
|
||||
|
||||
@@ -74,7 +74,7 @@ final class ModelGenerationConfigAdminService
|
||||
return [];
|
||||
}
|
||||
|
||||
return $this->retriever->retrieveDebug($prompt);
|
||||
return $this->retriever->retrieveDebug($prompt,$config);
|
||||
}
|
||||
|
||||
private function requireString(mixed $value, string $field): string
|
||||
|
||||
@@ -89,10 +89,11 @@
|
||||
href="{{ path('admin_document_show', { id: chunk.document_id }) }}">
|
||||
{{ chunk.document_id }}
|
||||
</a></span> |
|
||||
<span><strong>raw_score:</strong> {{ chunk.raw_score|number_format(6, '.', '') }}</span>
|
||||
|
|
||||
<span><strong>rrf_score:</strong> {{ chunk.rrf_score|number_format(6, '.', '') }}</span>
|
||||
|
|
||||
<span><strong>raw_score:</strong> {{ chunk.raw_score|number_format(6, '.', '') }}</span>
|
||||
|
|
||||
|
||||
<span><strong>threshold:</strong> {{ chunk.threshold }}</span> |
|
||||
<span><strong>intent:</strong> {{ chunk.intent }}</span> |
|
||||
<span>
|
||||
|
||||
Reference in New Issue
Block a user