p43H
This commit is contained in:
@@ -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'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user