harden token config
This commit is contained in:
@@ -295,6 +295,18 @@ final class PromptBuilderConfig
|
||||
'- Do not let bundles, accessories, or service items override a better technical match unless the user explicitly asks for them.',
|
||||
]);
|
||||
}
|
||||
/**
|
||||
* @return string[]
|
||||
*/
|
||||
public function getOutputPriorityTechnicalRules(): array
|
||||
{
|
||||
return $this->getStringList('output_priority.technical_rules', [
|
||||
'- For technical questions, answer the exact requested fact first and keep it as the main answer.',
|
||||
'- If one source chunk contains both the best matching value and nearby comparison values, use the nearby values only as context and do not include them unless the user asks for comparison or alternatives.',
|
||||
'- For lowest/highest/minimum/maximum questions, answer only the requested extreme value and the product/device explicitly connected to it.',
|
||||
'- Do not add runner-up products, second-lowest values, adjacent ranges, broader tables, or explanatory comparisons unless explicitly requested.',
|
||||
]);
|
||||
}
|
||||
|
||||
public function getResponseFormatSectionLabel(): string
|
||||
{
|
||||
|
||||
@@ -140,6 +140,17 @@ final readonly class RetriexEffectiveConfigProvider
|
||||
$errors[] = 'Missing technical prompt keyword: ' . $term;
|
||||
}
|
||||
}
|
||||
$technicalPriorityRules = implode("\n", $this->promptConfig->getOutputPriorityTechnicalRules());
|
||||
$checks['technical_priority_rules_present'] = trim($technicalPriorityRules) !== '';
|
||||
$checks['technical_priority_prevents_runner_up'] = str_contains($technicalPriorityRules, 'runner-up')
|
||||
|| str_contains($technicalPriorityRules, 'second-lowest')
|
||||
|| str_contains($technicalPriorityRules, 'comparison');
|
||||
if (!$checks['technical_priority_rules_present']) {
|
||||
$errors[] = 'Missing technical output priority rules.';
|
||||
}
|
||||
if (!$checks['technical_priority_prevents_runner_up']) {
|
||||
$errors[] = 'Technical output priority no longer guards against runner-up/comparison expansion.';
|
||||
}
|
||||
|
||||
$accessoryKeywords = $this->promptConfig->getAccessoryRequestKeywords();
|
||||
foreach (['indikator', 'reagenz'] as $term) {
|
||||
@@ -304,6 +315,7 @@ final readonly class RetriexEffectiveConfigProvider
|
||||
'conversation_context_intro_lines' => $this->promptConfig->getConversationContextIntroLines(),
|
||||
'live_shop_results_header_lines' => $this->promptConfig->getLiveShopResultsHeaderLines(),
|
||||
'output_priority' => $this->promptConfig->getOutputPriorityRules(),
|
||||
'output_priority_technical' => $this->promptConfig->getOutputPriorityTechnicalRules(),
|
||||
'response_format_base' => $this->promptConfig->getResponseFormatBaseRules(),
|
||||
'response_format_with_shop' => $this->promptConfig->getResponseFormatWithShopRules(),
|
||||
'response_format_without_shop' => $this->promptConfig->getResponseFormatWithoutShopRules(),
|
||||
|
||||
Reference in New Issue
Block a user