remove direct chnuk search. only vector search
This commit is contained in:
@@ -4,6 +4,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace App\Knowledge\Retrieval;
|
||||
|
||||
use App\Knowledge\QueryCleaner;
|
||||
use App\Vector\VectorSearchClient;
|
||||
|
||||
final class NdjsonHybridRetriever implements RetrieverInterface
|
||||
@@ -11,10 +12,11 @@ final class NdjsonHybridRetriever implements RetrieverInterface
|
||||
private const VECTOR_SCORE_THRESHOLD = 0.25;
|
||||
|
||||
public function __construct(
|
||||
private readonly NdjsonChunkLookup $lookup,
|
||||
private readonly VectorSearchClient $vectorClient,
|
||||
private readonly int $maxChunks = 10,
|
||||
private readonly int $vectorTopK = 10,
|
||||
private readonly NdjsonChunkLookup $lookup,
|
||||
private readonly VectorSearchClient $vectorClient,
|
||||
private readonly QueryCleaner $queryCleaner,
|
||||
private readonly int $maxChunks = 25,
|
||||
private readonly int $vectorTopK = 10,
|
||||
)
|
||||
{
|
||||
}
|
||||
@@ -23,9 +25,10 @@ final class NdjsonHybridRetriever implements RetrieverInterface
|
||||
{
|
||||
$limit = $this->maxChunks;
|
||||
$keywordChunks = [];
|
||||
$query = $this->queryCleaner->clean($prompt);
|
||||
|
||||
// Vector / enrichment
|
||||
$hits = $this->vectorClient->search($prompt, $this->vectorTopK);
|
||||
$hits = $this->vectorClient->search($query, $this->vectorTopK);
|
||||
if ($hits === []) {
|
||||
return $this->diversifyByDevice($keywordChunks, $limit, 1);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user