p35
This commit is contained in:
@@ -260,6 +260,26 @@ final class AgentRunnerConfig
|
||||
return $this->getRequiredStringList('input_normalization.fuzzy_routing.terms');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string[]
|
||||
*/
|
||||
public function getInputNormalizationPlaceholderOutputs(): array
|
||||
{
|
||||
return $this->getRequiredStringList('input_normalization.placeholder_outputs');
|
||||
}
|
||||
|
||||
/** @return array<string, string> */
|
||||
public function getCommerceFollowUpActions(): array
|
||||
{
|
||||
return $this->getRequiredStringMap('followup_actions.commerce');
|
||||
}
|
||||
|
||||
/** @return array<string, string> */
|
||||
public function getKnowledgeFollowUpActions(): array
|
||||
{
|
||||
return $this->getRequiredStringMap('followup_actions.knowledge');
|
||||
}
|
||||
|
||||
private function getRequiredInt(string $key): int
|
||||
{
|
||||
$value = $this->requiredValue($key);
|
||||
@@ -384,6 +404,39 @@ final class AgentRunnerConfig
|
||||
return $out;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, string>
|
||||
*/
|
||||
private function getRequiredStringMap(string $key): array
|
||||
{
|
||||
$value = $this->requiredValue($key);
|
||||
|
||||
if (!is_array($value)) {
|
||||
throw new \InvalidArgumentException(sprintf('RetrieX agent config key "%s" must be a string map.', $key));
|
||||
}
|
||||
|
||||
$out = [];
|
||||
|
||||
foreach ($value as $mapKey => $mapValue) {
|
||||
if (!is_scalar($mapKey) || !is_scalar($mapValue)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$mapKey = trim((string) $mapKey);
|
||||
$mapValue = trim((string) $mapValue);
|
||||
|
||||
if ($mapKey !== '' && $mapValue !== '') {
|
||||
$out[$mapKey] = $mapValue;
|
||||
}
|
||||
}
|
||||
|
||||
if ($out === []) {
|
||||
throw new \InvalidArgumentException(sprintf('RetrieX agent config key "%s" must contain at least one valid entry.', $key));
|
||||
}
|
||||
|
||||
return $out;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, string>
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user