This commit is contained in:
team 1
2026-05-05 12:12:51 +02:00
parent da374edcf4
commit 2c041a88c0
12 changed files with 429 additions and 282 deletions

View File

@@ -1238,7 +1238,7 @@ final readonly class AgentRunner
* These anchors are only used to resolve follow-up references such as
* "der Wert" or "welcher Indikator". They are not factual evidence for
* the final answer. To avoid propagating wrong earlier answers, only the
* first explicit Testomat model reference and the first explicit °dH value
* first explicit product-model reference and the first explicit measurement value
* are kept. Indicator names, reagent codes, prices, URLs and product
* numbers are intentionally ignored here.
*
@@ -1261,12 +1261,12 @@ final readonly class AgentRunner
$anchors = [];
$model = $this->extractFirstTestomatModelAnchor($answer);
$model = $this->extractFirstProductModelAnchor($answer);
if ($model !== '') {
$anchors[] = $model;
}
$hardnessValue = $this->extractFirstHardnessValueAnchor($answer);
$hardnessValue = $this->extractFirstMeasurementValueAnchor($answer);
if ($hardnessValue !== '') {
$anchors[] = $hardnessValue;
}
@@ -1325,9 +1325,9 @@ final readonly class AgentRunner
return array_reverse($turns);
}
private function extractFirstTestomatModelAnchor(string $text): string
private function extractFirstProductModelAnchor(string $text): string
{
if (preg_match($this->agentRunnerConfig->getFollowUpReferenceAnchorTestomatModelPattern(), $text, $matches) !== 1) {
if (preg_match($this->agentRunnerConfig->getFollowUpReferenceAnchorProductModelPattern(), $text, $matches) !== 1) {
return '';
}
@@ -1337,9 +1337,9 @@ final readonly class AgentRunner
return trim(str_replace('®', '', $value));
}
private function extractFirstHardnessValueAnchor(string $text): string
private function extractFirstMeasurementValueAnchor(string $text): string
{
if (preg_match($this->agentRunnerConfig->getFollowUpReferenceAnchorHardnessValuePattern(), $text, $matches) !== 1) {
if (preg_match($this->agentRunnerConfig->getFollowUpReferenceAnchorMeasurementValuePattern(), $text, $matches) !== 1) {
return '';
}
@@ -1500,7 +1500,7 @@ final readonly class AgentRunner
return true;
}
if ($this->extractFirstTestomatModelAnchor($prompt) !== '') {
if ($this->extractFirstProductModelAnchor($prompt) !== '') {
return false;
}
@@ -1564,7 +1564,7 @@ final readonly class AgentRunner
private function hasStandaloneConcreteShopSubject(string $prompt): bool
{
if ($this->extractFirstTestomatModelAnchor($prompt) !== '') {
if ($this->extractFirstProductModelAnchor($prompt) !== '') {
return true;
}
@@ -1622,7 +1622,7 @@ final readonly class AgentRunner
return $prompt;
}
if ($this->extractFirstTestomatModelAnchor($prompt) === '') {
if ($this->extractFirstProductModelAnchor($prompt) === '') {
return $optimizedShopQuery;
}
@@ -2249,7 +2249,7 @@ final readonly class AgentRunner
continue;
}
$model = $this->extractFirstTestomatModelAnchor($turn);
$model = $this->extractFirstProductModelAnchor($turn);
if ($model !== '') {
$query = str_replace(
@@ -2334,7 +2334,7 @@ final readonly class AgentRunner
}
}
$modelAnchor = $this->extractFirstTestomatModelAnchor($turn);
$modelAnchor = $this->extractFirstProductModelAnchor($turn);
if ($modelAnchor !== '' && !$this->isMetaOnlyShopQuery($modelAnchor)) {
return mb_strtolower($modelAnchor, 'UTF-8');