p61 new
This commit is contained in:
@@ -962,11 +962,6 @@ final class AgentRunnerConfig
|
||||
*/
|
||||
public function getNoLlmMainDeviceRequestRoleKeywords(): array
|
||||
{
|
||||
$terms = $this->genreStringList('product_roles.no_llm_fallback_terms.main_device_request_keywords');
|
||||
if ($terms !== []) {
|
||||
return $terms;
|
||||
}
|
||||
|
||||
return $this->getConfiguredStringListOrVocabularyView(
|
||||
'no_llm_fallback.product_roles.main_device_request_keywords',
|
||||
'no_llm_fallback.product_roles.vocabulary_views.main_device_request_keywords'
|
||||
@@ -978,11 +973,6 @@ final class AgentRunnerConfig
|
||||
*/
|
||||
public function getNoLlmAccessoryProductRoleKeywords(): array
|
||||
{
|
||||
$terms = $this->genreStringList('product_roles.no_llm_fallback_terms.accessory_product_keywords');
|
||||
if ($terms !== []) {
|
||||
return $terms;
|
||||
}
|
||||
|
||||
return $this->getConfiguredStringListOrVocabularyView(
|
||||
'no_llm_fallback.product_roles.accessory_product_keywords',
|
||||
'no_llm_fallback.product_roles.vocabulary_views.accessory_product_keywords'
|
||||
@@ -1196,6 +1186,90 @@ final class AgentRunnerConfig
|
||||
?: $this->getRequiredStringList('shop_runtime.query_cleanup.stopword_cleanup.terms');
|
||||
}
|
||||
|
||||
public function isShopQueryPositiveTokenFilterEnabled(): bool
|
||||
{
|
||||
return $this->genreBool('shop_query_runtime.positive_token_filter.enabled')
|
||||
?? $this->getOptionalBool('shop_runtime.query_cleanup.positive_token_filter.enabled', false);
|
||||
}
|
||||
|
||||
public function getShopQueryPositiveTokenFilterMinTokens(): int
|
||||
{
|
||||
return $this->genreInt('shop_query_runtime.positive_token_filter.min_query_tokens_after_filter')
|
||||
?? $this->getOptionalInt('shop_runtime.query_cleanup.positive_token_filter.min_query_tokens_after_filter', 2);
|
||||
}
|
||||
|
||||
public function shouldShopQueryPositiveTokenFilterIncludeCurrentInputPreservationTerms(): bool
|
||||
{
|
||||
return $this->genreBool('shop_query_runtime.positive_token_filter.include_current_input_preservation_terms')
|
||||
?? $this->getOptionalBool('shop_runtime.query_cleanup.positive_token_filter.include_current_input_preservation_terms', true);
|
||||
}
|
||||
|
||||
public function shouldShopQueryPositiveTokenFilterIncludeSemanticShopSearchTokens(): bool
|
||||
{
|
||||
return $this->genreBool('shop_query_runtime.positive_token_filter.include_semantic_shop_search_tokens')
|
||||
?? $this->getOptionalBool('shop_runtime.query_cleanup.positive_token_filter.include_semantic_shop_search_tokens', true);
|
||||
}
|
||||
|
||||
public function shouldShopQueryPositiveTokenFilterIncludeProductRoleTerms(): bool
|
||||
{
|
||||
return $this->genreBool('shop_query_runtime.positive_token_filter.include_product_role_terms')
|
||||
?? $this->getOptionalBool('shop_runtime.query_cleanup.positive_token_filter.include_product_role_terms', true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string[]
|
||||
*/
|
||||
public function getShopQueryPositiveTokenFilterAllowedTerms(): array
|
||||
{
|
||||
return $this->genreStringList('shop_query_runtime.positive_token_filter.allowed_terms')
|
||||
?: $this->getOptionalStringList('shop_runtime.query_cleanup.positive_token_filter.allowed_terms');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string[]
|
||||
*/
|
||||
public function getShopQueryPositiveTokenFilterBlockedTerms(): array
|
||||
{
|
||||
return $this->genreStringList('shop_query_runtime.positive_token_filter.blocked_terms')
|
||||
?: $this->getOptionalStringList('shop_runtime.query_cleanup.positive_token_filter.blocked_terms');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string[]
|
||||
*/
|
||||
public function getShopQueryPositiveTokenFilterCodePatterns(): array
|
||||
{
|
||||
return $this->genreStringList('shop_query_runtime.positive_token_filter.code_patterns')
|
||||
?: $this->getOptionalStringList('shop_runtime.query_cleanup.positive_token_filter.code_patterns');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string[]
|
||||
*/
|
||||
public function getShopQueryPositiveTokenFilterSemanticShopSearchTokens(): array
|
||||
{
|
||||
return $this->genreStringList('shop_query_runtime.semantic_shop_search_tokens.terms');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string[]
|
||||
*/
|
||||
public function getShopQueryPositiveTokenFilterProductRoleTerms(): array
|
||||
{
|
||||
return array_values(array_unique(array_merge(
|
||||
$this->genreStringList('product_roles.primary_product_terms.terms'),
|
||||
$this->genreStringList('product_roles.accessory_product_terms.terms'),
|
||||
$this->genreStringList('product_roles.shop_views.device_query_terms'),
|
||||
$this->genreStringList('product_roles.shop_views.accessory_query_terms'),
|
||||
$this->genreStringList('product_roles.shop_views.device_product_terms'),
|
||||
$this->genreStringList('product_roles.shop_views.accessory_product_terms'),
|
||||
$this->genreStringList('product_roles.shop_views.device_focus_terms'),
|
||||
$this->genreStringList('product_roles.shop_views.accessory_focus_terms'),
|
||||
$this->genreStringList('product_roles.no_llm_fallback_terms.main_device_request_keywords'),
|
||||
$this->genreStringList('product_roles.no_llm_fallback_terms.accessory_product_keywords')
|
||||
)));
|
||||
}
|
||||
|
||||
public function isDirectShopResultGuardEnabled(): bool
|
||||
{
|
||||
return $this->getRequiredBool('shop_runtime.result_identity.enabled');
|
||||
@@ -1434,24 +1508,6 @@ final class AgentRunnerConfig
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string[]
|
||||
*/
|
||||
public function getShopQueryContextAnchorEnrichmentQueryTerms(): array
|
||||
{
|
||||
return $this->genreStringList('context_resolution.history_anchor_enrichment.query_terms')
|
||||
?: $this->getOptionalStringList('shop_runtime.context_resolution.history_anchor_enrichment.query_terms');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string[]
|
||||
*/
|
||||
public function getShopQueryContextAnchorEnrichmentQueryNoiseTerms(): array
|
||||
{
|
||||
return $this->genreStringList('context_resolution.history_anchor_enrichment.query_noise_terms')
|
||||
?: $this->getOptionalStringList('shop_runtime.context_resolution.history_anchor_enrichment.query_noise_terms');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string[]
|
||||
*/
|
||||
|
||||
@@ -687,6 +687,16 @@ final readonly class RetriexEffectiveConfigProvider
|
||||
'min_query_tokens_after_cleanup' => $this->agentRunnerConfig->getShopQueryStopwordCleanupMinTokens(),
|
||||
'terms' => $this->agentRunnerConfig->getShopQueryStopwordCleanupTerms(),
|
||||
],
|
||||
'positive_token_filter' => [
|
||||
'enabled' => $this->agentRunnerConfig->isShopQueryPositiveTokenFilterEnabled(),
|
||||
'min_query_tokens_after_filter' => $this->agentRunnerConfig->getShopQueryPositiveTokenFilterMinTokens(),
|
||||
'include_current_input_preservation_terms' => $this->agentRunnerConfig->shouldShopQueryPositiveTokenFilterIncludeCurrentInputPreservationTerms(),
|
||||
'include_semantic_shop_search_tokens' => $this->agentRunnerConfig->shouldShopQueryPositiveTokenFilterIncludeSemanticShopSearchTokens(),
|
||||
'include_product_role_terms' => $this->agentRunnerConfig->shouldShopQueryPositiveTokenFilterIncludeProductRoleTerms(),
|
||||
'allowed_terms' => $this->agentRunnerConfig->getShopQueryPositiveTokenFilterAllowedTerms(),
|
||||
'blocked_terms' => $this->agentRunnerConfig->getShopQueryPositiveTokenFilterBlockedTerms(),
|
||||
'code_patterns' => $this->agentRunnerConfig->getShopQueryPositiveTokenFilterCodePatterns(),
|
||||
],
|
||||
],
|
||||
'attribute_cleanup' => [
|
||||
'enabled' => $this->agentRunnerConfig->isShopQueryProductAttributeCleanupEnabled(),
|
||||
@@ -703,8 +713,6 @@ final readonly class RetriexEffectiveConfigProvider
|
||||
'enabled' => $this->agentRunnerConfig->isShopQueryContextAnchorEnrichmentEnabled(),
|
||||
'max_query_terms' => $this->agentRunnerConfig->getShopQueryContextAnchorEnrichmentMaxQueryTerms(),
|
||||
'trigger_terms' => $this->agentRunnerConfig->getShopQueryContextAnchorEnrichmentTriggerTerms(),
|
||||
'query_terms' => $this->agentRunnerConfig->getShopQueryContextAnchorEnrichmentQueryTerms(),
|
||||
'query_noise_terms' => $this->agentRunnerConfig->getShopQueryContextAnchorEnrichmentQueryNoiseTerms(),
|
||||
'anchor_patterns' => $this->agentRunnerConfig->getShopQueryContextAnchorEnrichmentPatterns(),
|
||||
'template' => $this->agentRunnerConfig->getShopQueryContextAnchorEnrichmentTemplate(),
|
||||
],
|
||||
@@ -1314,6 +1322,33 @@ final readonly class RetriexEffectiveConfigProvider
|
||||
}
|
||||
}
|
||||
|
||||
$shopQueryRuntime = is_array($configurationValues['shop_query_runtime'] ?? null)
|
||||
? $configurationValues['shop_query_runtime']
|
||||
: [];
|
||||
$positiveTokenFilter = is_array($shopQueryRuntime['positive_token_filter'] ?? null)
|
||||
? $shopQueryRuntime['positive_token_filter']
|
||||
: [];
|
||||
if ($positiveTokenFilter !== []) {
|
||||
foreach ([
|
||||
'enabled',
|
||||
'include_current_input_preservation_terms',
|
||||
'include_semantic_shop_search_tokens',
|
||||
'include_product_role_terms',
|
||||
] as $boolKey) {
|
||||
if (array_key_exists($boolKey, $positiveTokenFilter) && !is_bool($positiveTokenFilter[$boolKey])) {
|
||||
$errors[] = sprintf('genre.configuration_values.shop_query_runtime.positive_token_filter.%s must be boolean.', $boolKey);
|
||||
}
|
||||
}
|
||||
|
||||
if (array_key_exists('min_query_tokens_after_filter', $positiveTokenFilter) && !is_numeric($positiveTokenFilter['min_query_tokens_after_filter'])) {
|
||||
$errors[] = 'genre.configuration_values.shop_query_runtime.positive_token_filter.min_query_tokens_after_filter must be numeric.';
|
||||
}
|
||||
|
||||
$this->validateStringList($this->toList($positiveTokenFilter['allowed_terms'] ?? []), 'genre.configuration_values.shop_query_runtime.positive_token_filter.allowed_terms', $errors, $warnings);
|
||||
$this->validateStringList($this->toList($positiveTokenFilter['blocked_terms'] ?? []), 'genre.configuration_values.shop_query_runtime.positive_token_filter.blocked_terms', $errors, $warnings);
|
||||
$this->validateRegexPatternList($positiveTokenFilter['code_patterns'] ?? [], 'genre.configuration_values.shop_query_runtime.positive_token_filter.code_patterns', $errors);
|
||||
}
|
||||
|
||||
foreach ($this->collectGenreConfigurationValueSourcePaths($configurationValues) as $valuePath => $sourcePaths) {
|
||||
foreach ($sourcePaths as $sourcePath) {
|
||||
if (!isset($flattened[$sourcePath])) {
|
||||
@@ -1836,8 +1871,6 @@ final readonly class RetriexEffectiveConfigProvider
|
||||
$anchorEnrichment = $contextResolution['history_anchor_enrichment'] ?? [];
|
||||
if (is_array($anchorEnrichment)) {
|
||||
$this->validateStringList($this->toList($anchorEnrichment['trigger_terms'] ?? []), 'agent.shop_runtime.context_resolution.history_anchor_enrichment.trigger_terms', $errors, $warnings);
|
||||
$this->validateStringList($this->toList($anchorEnrichment['query_terms'] ?? []), 'agent.shop_runtime.context_resolution.history_anchor_enrichment.query_terms', $errors, $warnings);
|
||||
$this->validateStringList($this->toList($anchorEnrichment['query_noise_terms'] ?? []), 'agent.shop_runtime.context_resolution.history_anchor_enrichment.query_noise_terms', $errors, $warnings);
|
||||
$this->validateRegexPatternList($anchorEnrichment['anchor_patterns'] ?? [], 'agent.shop_runtime.context_resolution.history_anchor_enrichment.anchor_patterns', $errors);
|
||||
if (trim((string) ($anchorEnrichment['template'] ?? '')) === '') {
|
||||
$errors[] = 'agent.shop_runtime.context_resolution.history_anchor_enrichment.template must not be empty.';
|
||||
|
||||
Reference in New Issue
Block a user