p98
This commit is contained in:
@@ -49,7 +49,6 @@ final readonly class RetriexEffectiveConfigProvider
|
||||
'llm' => [
|
||||
'timeout_seconds' => $this->param('retriex.llm.timeout_seconds'),
|
||||
'num_predict' => $this->param('retriex.llm.num_predict'),
|
||||
'call_models' => $this->param('retriex.llm.call_models'),
|
||||
],
|
||||
'retrieval' => $this->retrievalConfig(),
|
||||
'prompt' => $this->promptConfig(),
|
||||
@@ -86,7 +85,6 @@ final readonly class RetriexEffectiveConfigProvider
|
||||
$this->validateRuntime($config['runtime'], $errors, $warnings);
|
||||
$this->validateIndex($config['index'], $errors, $warnings);
|
||||
$this->validateModel($config['model_generation'], $errors, $warnings);
|
||||
$this->validateLlm($config['llm'], $errors, $warnings);
|
||||
$this->validateRetrieval($config['retrieval'], $errors, $warnings);
|
||||
$this->validatePrompt($config['prompt'], $errors, $warnings);
|
||||
$this->validateAgent($config['agent'], $errors, $warnings);
|
||||
@@ -1716,46 +1714,6 @@ final readonly class RetriexEffectiveConfigProvider
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<string, mixed> $llm
|
||||
* @param list<string> $errors
|
||||
* @param list<string> $warnings
|
||||
*/
|
||||
private function validateLlm(array $llm, array &$errors, array &$warnings): void
|
||||
{
|
||||
$callModels = $llm['call_models'] ?? [];
|
||||
if (!is_array($callModels)) {
|
||||
$errors[] = 'llm.call_models must be a map.';
|
||||
return;
|
||||
}
|
||||
|
||||
$knownCalls = [
|
||||
'input_normalization',
|
||||
'shop_query_optimization',
|
||||
'final_answer',
|
||||
];
|
||||
|
||||
foreach ($callModels as $callName => $modelName) {
|
||||
if (!is_string($callName) || trim($callName) === '') {
|
||||
$errors[] = 'llm.call_models contains an invalid call name.';
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!in_array($callName, $knownCalls, true)) {
|
||||
$warnings[] = 'llm.call_models contains an unknown call name: ' . $callName . '.';
|
||||
}
|
||||
|
||||
if ($modelName !== null && !is_string($modelName)) {
|
||||
$errors[] = 'llm.call_models.' . $callName . ' must be null or a string model name.';
|
||||
continue;
|
||||
}
|
||||
|
||||
if (is_string($modelName) && trim($modelName) === '') {
|
||||
$warnings[] = 'llm.call_models.' . $callName . ' is empty and will use the default model.';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<string, mixed> $retrieval
|
||||
* @param list<string> $errors
|
||||
@@ -1782,6 +1740,13 @@ final readonly class RetriexEffectiveConfigProvider
|
||||
$errors[] = 'retrieval.generic_exact_selection_cleanup_profile references unknown language cleanup profile: ' . trim($cleanupProfile) . '.';
|
||||
}
|
||||
|
||||
$queryCleanupProfile = $retrieval['query_cleanup_profile'] ?? null;
|
||||
if (!is_string($queryCleanupProfile) || trim($queryCleanupProfile) === '') {
|
||||
$errors[] = 'retrieval.query_cleanup_profile must be a non-empty string.';
|
||||
} elseif (!in_array(trim($queryCleanupProfile), $this->languageCleanupConfig->getCleanupProfileNames(), true)) {
|
||||
$errors[] = 'retrieval.query_cleanup_profile references unknown language cleanup profile: ' . trim($queryCleanupProfile) . '.';
|
||||
}
|
||||
|
||||
$this->validateStringListMap($retrieval['vocabulary'] ?? [], 'retrieval.vocabulary', $errors, $warnings);
|
||||
|
||||
$inventory = $retrieval['inventory_parameter'] ?? [];
|
||||
|
||||
Reference in New Issue
Block a user