patch 7
This commit is contained in:
76
RETRIEX_PATCH_6_2_CONSTRUCTOR_AUDIT_CLEANUP_README.md
Normal file
76
RETRIEX_PATCH_6_2_CONSTRUCTOR_AUDIT_CLEANUP_README.md
Normal file
@@ -0,0 +1,76 @@
|
||||
# RetrieX Patch 6.2 – Constructor-Default-Audit-Cleanup
|
||||
|
||||
## Ziel
|
||||
|
||||
Dieser Patch bereinigt die verbleibende Audit-Warnung zu Constructor-Defaults, ohne Laufzeitlogik zu ändern.
|
||||
|
||||
Nach Patch 6.1 waren alle Fallback-Accessors YAML-gemappt, aber der Audit meldete weiterhin:
|
||||
|
||||
```text
|
||||
constructor_defaults_without_yaml_mapping: 9
|
||||
```
|
||||
|
||||
Diese 9 Defaults stammen aus `ModelGenerationDefaultsConfig`. Die Werte sind bereits in `config/retriex/model.yaml` vorhanden und werden in `config/services.yaml` als Service-Argumente injiziert. Der Audit kannte dieses Mapping bisher nur nicht.
|
||||
|
||||
## Änderung
|
||||
|
||||
Geändert wurde nur:
|
||||
|
||||
```text
|
||||
src/Config/ConfigSourceAuditProvider.php
|
||||
```
|
||||
|
||||
Ergänzt wurde das Audit-Mapping für:
|
||||
|
||||
```text
|
||||
ModelGenerationDefaultsConfig::$modelName
|
||||
ModelGenerationDefaultsConfig::$stream
|
||||
ModelGenerationDefaultsConfig::$temperature
|
||||
ModelGenerationDefaultsConfig::$topK
|
||||
ModelGenerationDefaultsConfig::$topP
|
||||
ModelGenerationDefaultsConfig::$repeatPenalty
|
||||
ModelGenerationDefaultsConfig::$numCtx
|
||||
ModelGenerationDefaultsConfig::$retrievalMaxChunks
|
||||
ModelGenerationDefaultsConfig::$retrievalVectorTopK
|
||||
```
|
||||
|
||||
auf die bestehenden YAML-Parameter:
|
||||
|
||||
```text
|
||||
retriex.model.default_name
|
||||
retriex.model.default_stream
|
||||
retriex.model.default_temperature
|
||||
retriex.model.default_top_k
|
||||
retriex.model.default_top_p
|
||||
retriex.model.default_repeat_penalty
|
||||
retriex.model.default_num_ctx
|
||||
retriex.model.default_retrieval_max_chunks
|
||||
retriex.model.default_retrieval_vector_top_k
|
||||
```
|
||||
|
||||
## Wichtig
|
||||
|
||||
Dieser Patch entfernt noch keine Constructor-Defaults aus `ModelGenerationDefaultsConfig`.
|
||||
|
||||
Er klassifiziert sie nur korrekt als YAML-/Service-Parameter-gemappt. Die eigentliche Entfernung von PHP-Defaults kann später in der finalen YAML-only-Phase erfolgen.
|
||||
|
||||
## Nach dem Einspielen testen
|
||||
|
||||
```bash
|
||||
php bin/console cache:clear
|
||||
php bin/console mto:agent:config:validate
|
||||
php bin/console mto:agent:config:audit-source --details
|
||||
php bin/console mto:agent:regression:test
|
||||
```
|
||||
|
||||
Erwartung im Audit:
|
||||
|
||||
```text
|
||||
constructor_defaults_without_yaml_mapping: 0
|
||||
```
|
||||
|
||||
Wenn Patch 6.1 bereits eingespielt ist, sollte außerdem weiterhin gelten:
|
||||
|
||||
```text
|
||||
fallback_accessors_missing_yaml: 0
|
||||
```
|
||||
39
RETRIEX_PATCH_7_0A_AGENT_BASIS_YAML_ONLY_README.md
Normal file
39
RETRIEX_PATCH_7_0A_AGENT_BASIS_YAML_ONLY_README.md
Normal file
@@ -0,0 +1,39 @@
|
||||
# RetrieX Patch 7.0a - AgentRunnerConfig basis values YAML-only
|
||||
|
||||
Scope: small first AgentRunnerConfig migration step.
|
||||
|
||||
Changed:
|
||||
- `AgentRunnerConfig` no longer uses PHP fallback defaults for the five simple basis values:
|
||||
- `commerce_history_budget_chars`
|
||||
- `product_search_knowledge_chunk_limit`
|
||||
- `advisory_product_search_knowledge_chunk_limit`
|
||||
- `optimized_shop_query_prefix_pattern`
|
||||
- `optimized_shop_query_trim_characters`
|
||||
- Added required typed accessors for these values.
|
||||
- Missing or invalid YAML values now raise a clear `InvalidArgumentException` instead of silently using PHP fallback defaults.
|
||||
|
||||
Not changed:
|
||||
- Agent messages
|
||||
- source labels
|
||||
- HTML templates
|
||||
- No-LLM fallback texts
|
||||
- shop prompt / meta guard rules
|
||||
- retrieval
|
||||
- PromptBuilder
|
||||
- CommerceQueryParser
|
||||
- Shop matching
|
||||
|
||||
Prerequisite:
|
||||
- Patch 6.1 must already be applied, because it adds `optimized_shop_query_trim_characters` to `config/retriex/agent.yaml`.
|
||||
|
||||
Recommended checks after applying:
|
||||
```bash
|
||||
php bin/console cache:clear
|
||||
php bin/console mto:agent:config:validate
|
||||
php bin/console mto:agent:config:audit-source --details
|
||||
php bin/console mto:agent:regression:test
|
||||
```
|
||||
|
||||
Expected audit direction:
|
||||
- `fallback_accessors` should decrease by 5.
|
||||
- The five basis keys above should no longer appear as `yaml_with_php_fallback` in `AgentRunnerConfig`.
|
||||
@@ -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