patch 7
This commit is contained in:
@@ -116,27 +116,27 @@ final class AgentRunnerConfig
|
||||
|
||||
public function getCommerceHistoryBudgetChars(): int
|
||||
{
|
||||
return $this->getInt('commerce_history_budget_chars', 1000);
|
||||
return $this->getRequiredInt('commerce_history_budget_chars');
|
||||
}
|
||||
|
||||
public function getProductSearchKnowledgeChunkLimit(): int
|
||||
{
|
||||
return $this->getInt('product_search_knowledge_chunk_limit', 6);
|
||||
return $this->getRequiredInt('product_search_knowledge_chunk_limit');
|
||||
}
|
||||
|
||||
public function getAdvisoryProductSearchKnowledgeChunkLimit(): int
|
||||
{
|
||||
return $this->getInt('advisory_product_search_knowledge_chunk_limit', 9);
|
||||
return $this->getRequiredInt('advisory_product_search_knowledge_chunk_limit');
|
||||
}
|
||||
|
||||
public function getOptimizedShopQueryPrefixPattern(): string
|
||||
{
|
||||
return $this->getString('optimized_shop_query_prefix_pattern', '/^(?:keywords?|suchquery|search\\s*query|query)\\s*:\\s*/iu');
|
||||
return $this->getRequiredString('optimized_shop_query_prefix_pattern');
|
||||
}
|
||||
|
||||
public function getOptimizedShopQueryTrimCharacters(): string
|
||||
{
|
||||
return $this->getString('optimized_shop_query_trim_characters', " \t\n\r\0\x0B\"'`");
|
||||
return $this->getRequiredString('optimized_shop_query_trim_characters');
|
||||
}
|
||||
|
||||
private function getInt(string $key, int $default): int
|
||||
@@ -176,6 +176,28 @@ final class AgentRunnerConfig
|
||||
return is_string($value) && $value !== '' ? $value : $default;
|
||||
}
|
||||
|
||||
private function getRequiredInt(string $key): int
|
||||
{
|
||||
$value = $this->requiredValue($key);
|
||||
|
||||
if (is_numeric($value)) {
|
||||
return (int) $value;
|
||||
}
|
||||
|
||||
throw new \InvalidArgumentException(sprintf('RetrieX agent config key "%s" must be numeric.', $key));
|
||||
}
|
||||
|
||||
private function getRequiredString(string $key): string
|
||||
{
|
||||
$value = $this->requiredValue($key);
|
||||
|
||||
if (is_string($value) && $value !== '') {
|
||||
return $value;
|
||||
}
|
||||
|
||||
throw new \InvalidArgumentException(sprintf('RetrieX agent config key "%s" must be a non-empty string.', $key));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string[] $default
|
||||
* @return string[]
|
||||
@@ -220,6 +242,21 @@ final class AgentRunnerConfig
|
||||
return $current;
|
||||
}
|
||||
|
||||
private function requiredValue(string $key): mixed
|
||||
{
|
||||
$current = $this->config;
|
||||
|
||||
foreach (explode('.', $key) as $segment) {
|
||||
if (!is_array($current) || !array_key_exists($segment, $current)) {
|
||||
throw new \InvalidArgumentException(sprintf('RetrieX agent config key "%s" is required.', $key));
|
||||
}
|
||||
|
||||
$current = $current[$segment];
|
||||
}
|
||||
|
||||
return $current;
|
||||
}
|
||||
|
||||
public function getEmptyPromptMessage(): string
|
||||
{
|
||||
return $this->getString('messages.empty_prompt', '❌ Empty prompt.');
|
||||
|
||||
@@ -26,6 +26,17 @@ final readonly class ConfigSourceAuditProvider
|
||||
];
|
||||
|
||||
private const CONSTRUCTOR_PARAMETER_BY_CLASS_AND_ARGUMENT = [
|
||||
'ModelGenerationDefaultsConfig' => [
|
||||
'modelName' => 'retriex.model.default_name',
|
||||
'stream' => 'retriex.model.default_stream',
|
||||
'temperature' => 'retriex.model.default_temperature',
|
||||
'topK' => 'retriex.model.default_top_k',
|
||||
'topP' => 'retriex.model.default_top_p',
|
||||
'repeatPenalty' => 'retriex.model.default_repeat_penalty',
|
||||
'numCtx' => 'retriex.model.default_num_ctx',
|
||||
'retrievalMaxChunks' => 'retriex.model.default_retrieval_max_chunks',
|
||||
'retrievalVectorTopK' => 'retriex.model.default_retrieval_vector_top_k',
|
||||
],
|
||||
'SearchRepairConfig' => [
|
||||
'enabled' => 'retriex.commerce.search_repair.enabled',
|
||||
'maxRepairQueries' => 'retriex.commerce.search_repair.max_queries',
|
||||
|
||||
Reference in New Issue
Block a user