This commit is contained in:
team 1
2026-05-06 17:23:57 +02:00
parent 81ae3c3902
commit e9c464c057
8 changed files with 399 additions and 40 deletions

View File

@@ -12,6 +12,7 @@ final class AgentRunnerConfig
public function __construct(
private readonly array $config = [],
private readonly ?DomainVocabularyConfig $vocabulary = null,
private readonly ?GenreConfig $genreConfig = null,
) {
}
@@ -290,6 +291,27 @@ final class AgentRunnerConfig
);
}
/** @return string[] */
private function genreStringList(string $path): array
{
return $this->genreConfig?->getValueStringList($path) ?? [];
}
private function genreString(string $path): string
{
return $this->genreConfig?->getValueString($path) ?? '';
}
private function genreBool(string $path): ?bool
{
return $this->genreConfig?->getValueBool($path);
}
private function genreInt(string $path): ?int
{
return $this->genreConfig?->getValueInt($path);
}
private function getRequiredInt(string $key): int
{
$value = $this->requiredValue($key);
@@ -749,37 +771,44 @@ final class AgentRunnerConfig
public function isDirectShopResultAnswerEnabled(): bool
{
return $this->getRequiredBool('shop_runtime.direct_answer.enabled');
return $this->genreBool('shop_query_runtime.direct_answer.enabled')
?? $this->getRequiredBool('shop_runtime.direct_answer.enabled');
}
public function getDirectShopResultAnswerMaxResults(): int
{
return $this->getRequiredInt('shop_runtime.direct_answer.max_results');
return $this->genreInt('shop_query_runtime.direct_answer.max_results')
?? $this->getRequiredInt('shop_runtime.direct_answer.max_results');
}
public function getDirectShopResultAnswerIntro(): string
{
return $this->getRequiredString('shop_runtime.direct_answer.intro');
return $this->genreString('shop_query_runtime.direct_answer.intro')
?: $this->getRequiredString('shop_runtime.direct_answer.intro');
}
public function getDirectShopResultAnswerNoResultsMessage(): string
{
return $this->getRequiredString('shop_runtime.direct_answer.no_results');
return $this->genreString('shop_query_runtime.direct_answer.no_results')
?: $this->getRequiredString('shop_runtime.direct_answer.no_results');
}
public function getDirectShopResultAnswerSortedByLengthNote(): string
{
return $this->getRequiredString('shop_runtime.direct_answer.sorted_by_length_note');
return $this->genreString('shop_query_runtime.direct_answer.sorted_by_length_note')
?: $this->getRequiredString('shop_runtime.direct_answer.sorted_by_length_note');
}
public function getDirectShopResultAnswerMinLengthFilterNote(): string
{
return $this->getRequiredString('shop_runtime.direct_answer.min_length_filter_note');
return $this->genreString('shop_query_runtime.direct_answer.min_length_filter_note')
?: $this->getRequiredString('shop_runtime.direct_answer.min_length_filter_note');
}
public function getDirectShopResultAnswerMaxLengthFilterNote(): string
{
return $this->getRequiredString('shop_runtime.direct_answer.max_length_filter_note');
return $this->genreString('shop_query_runtime.direct_answer.max_length_filter_note')
?: $this->getRequiredString('shop_runtime.direct_answer.max_length_filter_note');
}
public function getNoLlmFallbackMaxShopResults(): int
@@ -1073,7 +1102,8 @@ final class AgentRunnerConfig
*/
public function getShopQueryContextUsageReferentialTerms(): array
{
return $this->getRequiredStringList('shop_runtime.context_resolution.context_usage.referential_terms');
return $this->genreStringList('context_resolution.referential_terms.terms')
?: $this->getRequiredStringList('shop_runtime.context_resolution.context_usage.referential_terms');
}
public function isShopQueryCurrentInputPreservationEnabled(): bool
@@ -1129,7 +1159,8 @@ final class AgentRunnerConfig
*/
public function getShopQueryProductAttributeCleanupComparativeConstraintPatterns(): array
{
return $this->getRequiredStringList('shop_runtime.attribute_cleanup.comparative_constraint_patterns');
return $this->genreStringList('product_attributes.direct_attribute_cleanup.comparative_constraint_patterns')
?: $this->getRequiredStringList('shop_runtime.attribute_cleanup.comparative_constraint_patterns');
}
public function isShopQueryStopwordCleanupEnabled(): bool
@@ -1147,7 +1178,8 @@ final class AgentRunnerConfig
*/
public function getShopQueryStopwordCleanupTerms(): array
{
return $this->getRequiredStringList('shop_runtime.query_cleanup.stopword_cleanup.terms');
return $this->genreStringList('shop_query_runtime.stopword_cleanup.terms')
?: $this->getRequiredStringList('shop_runtime.query_cleanup.stopword_cleanup.terms');
}
public function isDirectShopResultGuardEnabled(): bool
@@ -1170,7 +1202,8 @@ final class AgentRunnerConfig
*/
public function getDirectShopResultGuardCompoundPrefixTerms(): array
{
return $this->getOptionalStringList('shop_runtime.result_identity.compound_prefix_match.terms');
return $this->genreStringList('shop_query_runtime.compound_prefix_match.terms')
?: $this->getOptionalStringList('shop_runtime.result_identity.compound_prefix_match.terms');
}
public function isDirectShopResultGuardPrimaryIdentityRepairEnabled(): bool
@@ -1188,7 +1221,8 @@ final class AgentRunnerConfig
*/
public function getDirectShopResultGuardPrimaryIdentityRepairStopTerms(): array
{
return $this->getOptionalStringList('shop_runtime.result_identity.primary_identity_repair.stop_terms');
return $this->genreStringList('shop_query_runtime.primary_identity_repair.stop_terms')
?: $this->getOptionalStringList('shop_runtime.result_identity.primary_identity_repair.stop_terms');
}
public function isShopResultLengthSortEnabled(): bool
@@ -1201,7 +1235,8 @@ final class AgentRunnerConfig
*/
public function getShopResultLengthSortTriggerPatterns(): array
{
return $this->getRequiredStringList('shop_runtime.answer_constraints.length_sort.trigger_patterns');
return $this->genreStringList('product_attributes.numeric_length_constraints.length_sort.trigger_patterns')
?: $this->getRequiredStringList('shop_runtime.answer_constraints.length_sort.trigger_patterns');
}
/**
@@ -1209,7 +1244,8 @@ final class AgentRunnerConfig
*/
public function getShopResultLengthSortValuePatterns(): array
{
return $this->getRequiredStringList('shop_runtime.answer_constraints.length_sort.value_patterns');
return $this->genreStringList('product_attributes.numeric_length_constraints.length_sort.value_patterns')
?: $this->getRequiredStringList('shop_runtime.answer_constraints.length_sort.value_patterns');
}
public function isShopResultLengthFilterEnabled(): bool
@@ -1222,7 +1258,8 @@ final class AgentRunnerConfig
*/
public function getShopResultMinLengthFilterPatterns(): array
{
return $this->getRequiredStringList('shop_runtime.answer_constraints.length_filter.min_patterns');
return $this->genreStringList('product_attributes.numeric_length_constraints.length_filter.min_patterns')
?: $this->getRequiredStringList('shop_runtime.answer_constraints.length_filter.min_patterns');
}
/**
@@ -1230,7 +1267,8 @@ final class AgentRunnerConfig
*/
public function getShopResultMaxLengthFilterPatterns(): array
{
return $this->getRequiredStringList('shop_runtime.answer_constraints.length_filter.max_patterns');
return $this->genreStringList('product_attributes.numeric_length_constraints.length_filter.max_patterns')
?: $this->getRequiredStringList('shop_runtime.answer_constraints.length_filter.max_patterns');
}
public function getShopPromptIntro(): string
@@ -1323,7 +1361,8 @@ final class AgentRunnerConfig
*/
public function getShopQueryMetaOnlyTerms(): array
{
return $this->getRequiredStringList('shop_runtime.context_resolution.meta_query_guard.meta_only_terms');
return $this->genreStringList('context_resolution.meta_query_guard.meta_only_terms')
?: $this->getRequiredStringList('shop_runtime.context_resolution.meta_query_guard.meta_only_terms');
}
public function isShopQueryContextFallbackEnabled(): bool
@@ -1356,7 +1395,8 @@ final class AgentRunnerConfig
*/
public function getShopQueryContextFallbackFilterTerms(): array
{
return $this->getRequiredStringList('shop_runtime.context_resolution.meta_query_guard.context_fallback_filter_terms');
return $this->genreStringList('context_resolution.meta_query_guard.context_fallback_filter_terms')
?: $this->getRequiredStringList('shop_runtime.context_resolution.meta_query_guard.context_fallback_filter_terms');
}
public function isShopQueryContextAnchorEnrichmentEnabled(): bool
@@ -1385,12 +1425,14 @@ final class AgentRunnerConfig
*/
public function getShopQueryContextAnchorEnrichmentPatterns(): array
{
return $this->getRequiredStringList('shop_runtime.context_resolution.history_anchor_enrichment.anchor_patterns');
return $this->genreStringList('context_resolution.history_anchor_enrichment.anchor_patterns')
?: $this->getRequiredStringList('shop_runtime.context_resolution.history_anchor_enrichment.anchor_patterns');
}
public function getShopQueryContextAnchorEnrichmentTemplate(): string
{
return $this->getRequiredString('shop_runtime.context_resolution.history_anchor_enrichment.template');
return $this->genreString('context_resolution.history_anchor_enrichment.template')
?: $this->getRequiredString('shop_runtime.context_resolution.history_anchor_enrichment.template');
}
public function isShopQueryRagAnchorEnrichmentEnabled(): bool
{
@@ -1437,7 +1479,8 @@ final class AgentRunnerConfig
*/
public function getShopQueryRagAnchorEnrichmentNumericFocusPatterns(): array
{
return $this->getRequiredStringList('shop_runtime.context_resolution.rag_anchor_enrichment.numeric_focus_patterns');
return $this->genreStringList('context_resolution.rag_anchor_enrichment.numeric_focus_patterns')
?: $this->getRequiredStringList('shop_runtime.context_resolution.rag_anchor_enrichment.numeric_focus_patterns');
}
/**
@@ -1445,7 +1488,8 @@ final class AgentRunnerConfig
*/
public function getShopQueryRagAnchorEnrichmentProductTitlePatterns(): array
{
return $this->getRequiredStringList('shop_runtime.context_resolution.rag_anchor_enrichment.product_title_patterns');
return $this->genreStringList('context_resolution.rag_anchor_enrichment.product_title_patterns')
?: $this->getRequiredStringList('shop_runtime.context_resolution.rag_anchor_enrichment.product_title_patterns');
}
/**
@@ -1453,7 +1497,8 @@ final class AgentRunnerConfig
*/
public function getShopQueryRagAnchorEnrichmentAnchorBonusPatterns(): array
{
return $this->getRequiredStringList('shop_runtime.context_resolution.rag_anchor_enrichment.anchor_bonus_patterns');
return $this->genreStringList('context_resolution.rag_anchor_enrichment.anchor_bonus_patterns')
?: $this->getRequiredStringList('shop_runtime.context_resolution.rag_anchor_enrichment.anchor_bonus_patterns');
}
/**
@@ -1461,7 +1506,8 @@ final class AgentRunnerConfig
*/
public function getShopQueryRagAnchorEnrichmentSubjectTerms(): array
{
return $this->getRequiredStringList('shop_runtime.context_resolution.rag_anchor_enrichment.subject_terms');
return $this->genreStringList('context_resolution.rag_anchor_enrichment.subject_terms')
?: $this->getRequiredStringList('shop_runtime.context_resolution.rag_anchor_enrichment.subject_terms');
}
public function getShopQueryTranslationReplacements(string $language): array