This commit is contained in:
team 1
2026-05-05 16:37:27 +02:00
parent 7e868be24e
commit 542b527261
7 changed files with 180 additions and 98 deletions

View File

@@ -573,60 +573,12 @@ parameters:
# search. Example: "Anschlusskabel pH/Redox länger 20m" becomes # search. Example: "Anschlusskabel pH/Redox länger 20m" becomes
# "anschlusskabel redox" so the shop can return 25m/50m/100m cables. # "anschlusskabel redox" so the shop can return 25m/50m/100m cables.
min_query_tokens_after_cleanup: 2 min_query_tokens_after_cleanup: 2
product_type_terms: # Direct product/accessory cleanup terms are resolved from
- anschlusskabel # config/retriex/vocabulary.yaml. Local lists may still be added here
- kabel # as project-specific overrides, but the default source is vocabulary.
- sensorkabel vocabulary_views:
- elektrodenkabel product_type_terms: search_repair.direct_product_type_terms
- elektrodenanschlusskabel stop_terms: search_repair.direct_product_attribute_stop_terms
- messkabel
- verbindungskabel
- steckerkabel
- elektrode
- sensor
- puffer
- kalibrierpuffer
stop_terms:
- zeige
- zeig
- suche
- such
- mir
- bitte
- für
- fuer
- nach
- mit
- ohne
- von
- zum
- zur
- der
- die
- das
- ein
- eine
- einen
- länger
- laenger
- lang
- kürzer
- kuerzer
- größer
- groesser
- kleiner
- über
- ueber
- unter
- mindestens
- maximal
- maximum
- minimum
- ab
- bis
- mehr
- weniger
- als
comparative_constraint_patterns: comparative_constraint_patterns:
- '/\b(?:länger|laenger|kürzer|kuerzer|größer|groesser|kleiner|über|ueber|unter|mindestens|maximal|maximum|minimum|ab|bis|mehr\s+als|weniger\s+als)\s+(?P<value>\d+(?:[,.]\d+)?\s*[\p{L}µ°%]*)\b/iu' - '/\b(?:länger|laenger|kürzer|kuerzer|größer|groesser|kleiner|über|ueber|unter|mindestens|maximal|maximum|minimum|ab|bis|mehr\s+als|weniger\s+als)\s+(?P<value>\d+(?:[,.]\d+)?\s*[\p{L}µ°%]*)\b/iu'

View File

@@ -11,47 +11,9 @@ parameters:
# Query repair must stay on the requested product/accessory type for # Query repair must stay on the requested product/accessory type for
# direct attribute lookups. It may relax comparative constraints, but it # direct attribute lookups. It may relax comparative constraints, but it
# must not expand to unrelated RAG model/device candidates. # must not expand to unrelated RAG model/device candidates.
stop_terms: # Direct product/accessory stop terms are resolved from
- zeige # config/retriex/vocabulary.yaml view search_repair.direct_product_attribute_stop_terms.
- zeig # A local stop_terms list may still be added here as an explicit project override.
- suche
- such
- mir
- bitte
- für
- fuer
- nach
- mit
- ohne
- von
- zum
- zur
- der
- die
- das
- ein
- eine
- einen
- länger
- laenger
- lang
- kürzer
- kuerzer
- größer
- groesser
- kleiner
- über
- ueber
- unter
- mindestens
- maximal
- maximum
- minimum
- ab
- bis
- mehr
- weniger
- als
comparative_constraint_patterns: comparative_constraint_patterns:
- '/\b(?:länger|laenger|kürzer|kuerzer|größer|groesser|kleiner|über|ueber|unter|mindestens|maximal|maximum|minimum|ab|bis|mehr\s+als|weniger\s+als)\s+(?P<value>\d+(?:[,.]\d+)?\s*[\p{L}µ°%]*)\b/iu' - '/\b(?:länger|laenger|kürzer|kuerzer|größer|groesser|kleiner|über|ueber|unter|mindestens|maximal|maximum|minimum|ab|bis|mehr\s+als|weniger\s+als)\s+(?P<value>\d+(?:[,.]\d+)?\s*[\p{L}µ°%]*)\b/iu'

View File

@@ -49,6 +49,47 @@ parameters:
- service set - service set
- serviceset - serviceset
- service-set - service-set
direct_product_attribute_stop_terms:
- zeige
- zeig
- suche
- such
- mir
- bitte
- für
- fuer
- nach
- mit
- ohne
- von
- zum
- zur
- der
- die
- das
- ein
- eine
- einen
- länger
- laenger
- lang
- kürzer
- kuerzer
- größer
- groesser
- kleiner
- über
- ueber
- unter
- mindestens
- maximal
- maximum
- minimum
- ab
- bis
- mehr
- weniger
- als
views: views:
shop: shop:
device_query: device_query:
@@ -416,6 +457,9 @@ parameters:
- sensor - sensor
- puffer - puffer
- kalibrierpuffer - kalibrierpuffer
direct_product_attribute_stop_terms:
include:
- direct_product_attribute_stop_terms
accessory_candidate_terms: accessory_candidate_terms:
add: add:
- indikator - indikator

View File

@@ -136,6 +136,7 @@ services:
App\Config\AgentRunnerConfig: App\Config\AgentRunnerConfig:
arguments: arguments:
$config: '%retriex.agent.config%' $config: '%retriex.agent.config%'
$vocabulary: '@App\Config\DomainVocabularyConfig'
App\Config\NdjsonHybridRetrieverConfig: App\Config\NdjsonHybridRetrieverConfig:
arguments: arguments:

View File

@@ -0,0 +1,84 @@
# RetrieX Patch p43E Direct Attribute Vocabulary View Consolidation
## Ziel
p43E reduziert weitere doppelt gepflegte Direct-Attribute-Begriffe, ohne fachliche Runtime-Logik, Scoring, Prompt-Regeln, Retrieval oder Admin-UI zu verändern.
Der Patch setzt auf dem grünen p43D-Stand auf.
## Änderungen
- `config/retriex/agent.yaml`
- `shop_prompt.product_attribute_query_cleanup.product_type_terms` wird nicht mehr lokal als Liste gepflegt.
- `shop_prompt.product_attribute_query_cleanup.stop_terms` wird nicht mehr lokal als Liste gepflegt.
- Beide Listen werden über `vocabulary_views` aus `config/retriex/vocabulary.yaml` referenziert.
- `config/retriex/search_repair.yaml`
- Lokale `direct_product_attribute_lookup.stop_terms` entfernt.
- SearchRepair nutzt weiterhin lokale Overrides, falls künftig bewusst wieder ein projektspezifischer Override ergänzt wird.
- `config/retriex/vocabulary.yaml`
- Zentrale Klasse `direct_product_attribute_stop_terms` ergänzt.
- Zentrale View `search_repair.direct_product_attribute_stop_terms` ergänzt.
- Bestehende View `search_repair.direct_product_type_terms` bleibt die zentrale Quelle für direkte Produktart-Begriffe.
- `src/Config/AgentRunnerConfig.php`
- `DomainVocabularyConfig` wird optional injiziert.
- Direct-Attribute-Produktart- und Stop-Term-Zugriffe lösen nun lokale Overrides oder Vocabulary-Views auf.
- `src/Config/SearchRepairConfig.php`
- `getDirectProductAttributeLookupStopTerms()` nutzt lokale Overrides oder die neue zentrale Vocabulary-View.
- `config/services.yaml`
- `DomainVocabularyConfig` wird an `AgentRunnerConfig` injiziert.
## Effektive Listen
Die effektiven Listen bleiben gegenüber p43D unverändert:
- AgentRunner Direct-Attribute `product_type_terms`: 12 vorher / 12 nachher, identisch.
- AgentRunner Direct-Attribute `stop_terms`: 40 vorher / 40 nachher, identisch.
- SearchRepair Direct-Attribute `product_type_terms`: 12 vorher / 12 nachher, identisch.
- SearchRepair Direct-Attribute `stop_terms`: 40 vorher / 40 nachher, identisch.
## Bewusst nicht geändert
- Keine neue Fachlogik.
- Keine Scoringänderung.
- Keine Prompt-Regeländerung.
- Keine Retrievaländerung.
- Keine Admin-UI.
- Keine neuen harten Listen im PHP-Core.
## Lokale Checks in dieser Patch-Erstellung
Grün:
```bash
php -l src/Config/AgentRunnerConfig.php
php -l src/Config/SearchRepairConfig.php
```
Zusätzlich wurde per YAML-/Listenvergleich geprüft, dass die effektiven Direct-Attribute-Listen identisch zum p43D-Stand bleiben.
Nicht lokal ausführbar in dieser Umgebung:
```bash
bin/console mto:agent:config:validate
bin/console mto:agent:regression:test
bin/console mto:agent:config:audit-source --details
bin/console mto:agent:config:audit-patterns --details
```
Grund: Der entpackte ZIP-Stand enthält kein `vendor/`; `bin/console` bricht deshalb mit `Dependencies are missing` ab. Ein lokaler `composer install` war in der Ausführungsumgebung nicht möglich, da PHP-Extensions (`curl`, `dom`, `sqlite3`, `xml`) fehlen und externe Downloads nicht aufgelöst werden konnten.
## Empfohlene Pflichtchecks nach Einspielen
```bash
php -l src/Config/AgentRunnerConfig.php
php -l src/Config/SearchRepairConfig.php
bin/console mto:agent:config:validate
bin/console mto:agent:regression:test
bin/console mto:agent:config:audit-source --details
bin/console mto:agent:config:audit-patterns --details
```

View File

@@ -11,6 +11,7 @@ final class AgentRunnerConfig
*/ */
public function __construct( public function __construct(
private readonly array $config = [], private readonly array $config = [],
private readonly ?DomainVocabularyConfig $vocabulary = null,
) { ) {
} }
@@ -420,6 +421,35 @@ final class AgentRunnerConfig
} }
/**
* @return string[]
*/
private function getConfiguredStringListOrVocabularyView(string $configPath, string $viewPathConfigPath): array
{
if ($this->optionalValue($configPath) !== null) {
return $this->getRequiredStringList($configPath);
}
if ($this->vocabulary === null) {
throw new \InvalidArgumentException(sprintf(
'RetrieX agent config path "%s" is missing and no vocabulary resolver is available.',
$configPath
));
}
$viewPath = $this->getRequiredString($viewPathConfigPath);
$terms = $this->vocabulary->view($viewPath, []);
if ($terms === []) {
throw new \InvalidArgumentException(sprintf(
'RetrieX agent vocabulary view "%s" resolved to an empty list.',
$viewPath
));
}
return $terms;
}
/** /**
* @return array<int, array{label:string, prompt:string}> * @return array<int, array{label:string, prompt:string}>
*/ */
@@ -932,7 +962,10 @@ final class AgentRunnerConfig
*/ */
public function getShopQueryProductAttributeCleanupProductTypeTerms(): array public function getShopQueryProductAttributeCleanupProductTypeTerms(): array
{ {
return $this->getRequiredStringList('shop_prompt.product_attribute_query_cleanup.product_type_terms'); return $this->getConfiguredStringListOrVocabularyView(
'shop_prompt.product_attribute_query_cleanup.product_type_terms',
'shop_prompt.product_attribute_query_cleanup.vocabulary_views.product_type_terms'
);
} }
/** /**
@@ -940,7 +973,10 @@ final class AgentRunnerConfig
*/ */
public function getShopQueryProductAttributeCleanupStopTerms(): array public function getShopQueryProductAttributeCleanupStopTerms(): array
{ {
return $this->getRequiredStringList('shop_prompt.product_attribute_query_cleanup.stop_terms'); return $this->getConfiguredStringListOrVocabularyView(
'shop_prompt.product_attribute_query_cleanup.stop_terms',
'shop_prompt.product_attribute_query_cleanup.vocabulary_views.stop_terms'
);
} }
/** /**

View File

@@ -72,7 +72,10 @@ final class SearchRepairConfig
/** @return string[] */ /** @return string[] */
public function getDirectProductAttributeLookupStopTerms(): array public function getDirectProductAttributeLookupStopTerms(): array
{ {
return $this->requiredStringList('direct_product_attribute_lookup.stop_terms'); return $this->configOrVocabularyStringList(
'direct_product_attribute_lookup.stop_terms',
'search_repair.direct_product_attribute_stop_terms'
);
} }
/** @return string[] */ /** @return string[] */