alpha new hybridretriver line

This commit is contained in:
team2
2026-02-26 07:02:07 +01:00
parent c12ae8b45e
commit df97f9314b
9 changed files with 460 additions and 152 deletions

View File

@@ -9,9 +9,15 @@ use Symfony\Component\Uid\Uuid;
#[ORM\Entity(repositoryClass: \App\Repository\ModelGenerationConfigRepository::class)]
#[ORM\Table(name: 'model_generation_config')]
#[ORM\Index(columns: ['model_name', 'active'], name: 'idx_model_active')]
#[ORM\Index(name: 'idx_model_active', columns: ['model_name', 'active'])]
class ModelGenerationConfig
{
// -----------------------------
// Hard Guardrails
// -----------------------------
private const MAX_RETRIEVAL_CHUNKS = 200;
private const MAX_VECTOR_TOPK = 200;
#[ORM\Id]
#[ORM\Column(type: 'uuid', unique: true)]
private Uuid $id;
@@ -37,6 +43,16 @@ class ModelGenerationConfig
#[ORM\Column(name: 'num_ctx', type: 'integer')]
private int $numCtx;
// -------------------------------------
// Retrieval-Parameter (NEU)
// -------------------------------------
#[ORM\Column(name: 'retrieval_max_chunks', type: 'integer')]
private int $retrievalMaxChunks;
#[ORM\Column(name: 'retrieval_vector_top_k', type: 'integer')]
private int $retrievalVectorTopK;
#[ORM\Column(type: 'boolean')]
private bool $active;
@@ -55,7 +71,9 @@ class ModelGenerationConfig
float $topP = 0.8,
float $repeatPenalty = 1.05,
int $numCtx = 4096,
bool $active = false
bool $active = false,
int $retrievalMaxChunks = 25,
int $retrievalVectorTopK = 25,
) {
$this->id = Uuid::v4();
$this->modelName = $modelName;
@@ -68,8 +86,15 @@ class ModelGenerationConfig
$this->numCtx = $numCtx;
$this->active = $active;
$this->createdAt = new \DateTimeImmutable();
$this->setRetrievalMaxChunks($retrievalMaxChunks);
$this->setRetrievalVectorTopK($retrievalVectorTopK);
}
// -----------------------------
// Getter
// -----------------------------
public function getId(): Uuid { return $this->id; }
public function getModelName(): string { return $this->modelName; }
public function isStream(): bool { return $this->stream; }
@@ -82,9 +107,35 @@ class ModelGenerationConfig
public function getVersion(): int { return $this->version; }
public function getCreatedAt(): \DateTimeImmutable { return $this->createdAt; }
public function getRetrievalMaxChunks(): int
{
return $this->retrievalMaxChunks;
}
public function getRetrievalVectorTopK(): int
{
return $this->retrievalVectorTopK;
}
// -----------------------------
// Controlled Mutators
// -----------------------------
// Nur vom Manager nutzen
public function setActive(bool $active): void
{
$this->active = $active;
}
}
public function setRetrievalMaxChunks(int $value): void
{
$value = max(1, min($value, self::MAX_RETRIEVAL_CHUNKS));
$this->retrievalMaxChunks = $value;
}
public function setRetrievalVectorTopK(int $value): void
{
$value = max(1, min($value, self::MAX_VECTOR_TOPK));
$this->retrievalVectorTopK = $value;
}
}