This commit is contained in:
team 1
2026-05-05 18:12:44 +02:00
parent faa0377697
commit 8977cac8df
4 changed files with 155 additions and 45 deletions

View File

@@ -450,6 +450,35 @@ final class AgentRunnerConfig
return $terms;
}
/**
* @return array<string, string[]>
*/
private function getConfiguredStringListMapOrVocabularyMap(string $configPath, string $mapPathConfigPath): array
{
if ($this->optionalValue($configPath) !== null) {
return $this->getRequiredStringListMap($configPath);
}
if ($this->vocabulary === null) {
throw new \InvalidArgumentException(sprintf(
'RetrieX agent config path "%s" is missing and no vocabulary resolver is available.',
$configPath
));
}
$mapPath = $this->getRequiredString($mapPathConfigPath);
$terms = $this->vocabulary->map($mapPath, []);
if ($terms === []) {
throw new \InvalidArgumentException(sprintf(
'RetrieX agent vocabulary map "%s" resolved to an empty map.',
$mapPath
));
}
return $terms;
}
/**
* @return array<int, array{label:string, prompt:string}>
*/
@@ -672,7 +701,10 @@ final class AgentRunnerConfig
*/
public function getRagEvidenceSynonyms(): array
{
return $this->getRequiredStringListMap('rag_evidence_guard.synonyms');
return $this->getConfiguredStringListMapOrVocabularyMap(
'rag_evidence_guard.synonyms',
'rag_evidence_guard.vocabulary_maps.synonyms'
);
}
/**