optimize technical truth
This commit is contained in:
@@ -19,6 +19,9 @@ final class AgentRunnerConfig
|
||||
'analyzer',
|
||||
'system',
|
||||
'testomat',
|
||||
'testomaten',
|
||||
'testoamt',
|
||||
'testomate',
|
||||
'pockettester',
|
||||
];
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ final class PromptBuilderConfig
|
||||
'messgeräte', 'messgeraete', 'analysegerät', 'analysegeraet', 'analysegeräte',
|
||||
'analysegeraete', 'analysator', 'analysatoren', 'analyzer', 'gerät', 'geraet',
|
||||
'geräte', 'geraete', 'system', 'systeme', 'monitor', 'monitore', 'controller',
|
||||
'testomat', 'testomaten', 'testoamt', 'testomate', 'pockettester',
|
||||
];
|
||||
|
||||
private const MAIN_DEVICE_PRODUCT_ROLE_KEYWORDS = [
|
||||
@@ -19,6 +20,7 @@ final class PromptBuilderConfig
|
||||
'analysatoren', 'analyzer', 'online-analysator', 'online analysator',
|
||||
'online-analysegerät', 'online analysegeraet', 'gerät', 'geraet', 'geräte',
|
||||
'geraete', 'system', 'systeme', 'monitor', 'monitore', 'controller',
|
||||
'testomat', 'testomaten', 'pockettester',
|
||||
];
|
||||
|
||||
private const ACCESSORY_PRODUCT_ROLE_KEYWORDS = [
|
||||
@@ -27,6 +29,9 @@ final class PromptBuilderConfig
|
||||
'verbrauchsmaterial', 'consumable', 'nachfüll', 'nachfuell', 'refill',
|
||||
'lösung', 'loesung', 'solution', 'teststreifen', 'test strip', 'filter',
|
||||
'pumpenkopf', 'motorblock', 'service set', 'serviceset', 'service-set',
|
||||
'kalibrierlösung', 'kalibrierloesung', 'pufferlösung', 'pufferloesung',
|
||||
'reinigungslösung', 'reinigungsloesung', 'flasche', 'bottle', '100 ml', '500 ml',
|
||||
'100ml', '500ml',
|
||||
];
|
||||
|
||||
private const TECHNICAL_PRODUCT_KEYWORDS = [
|
||||
@@ -77,6 +82,66 @@ final class PromptBuilderConfig
|
||||
'chlormessung',
|
||||
];
|
||||
|
||||
private const MEASUREMENT_EVIDENCE_PARAMETERS = [
|
||||
[
|
||||
'id' => 'ph',
|
||||
'label' => 'pH / pH-Wert',
|
||||
'request_terms' => ['ph', 'pH', 'pH-Wert', 'ph-wert', 'ph wert'],
|
||||
'positive_terms' => [
|
||||
'pH-Messung',
|
||||
'pH Messung',
|
||||
'pH-Messgeraet',
|
||||
'pH Messgeraet',
|
||||
'pH-Wert messen',
|
||||
'pH Wert messen',
|
||||
'pH-Werte messen',
|
||||
'pH Werte messen',
|
||||
'misst pH',
|
||||
'misst den pH',
|
||||
'misst pH-Wert',
|
||||
'misst den pH-Wert',
|
||||
'Messparameter pH',
|
||||
'Messparameter pH-Wert',
|
||||
'Messgroesse pH',
|
||||
'Messgroesse pH-Wert',
|
||||
],
|
||||
'non_equivalent_terms' => [
|
||||
'p-Wert',
|
||||
'p Wert',
|
||||
'm-Wert',
|
||||
'minus m-Wert',
|
||||
'Alkalität',
|
||||
'Säurekapazität',
|
||||
'mmol/l',
|
||||
'pH-Bereich',
|
||||
'Betriebsbereich',
|
||||
'stoerungsfreier Betrieb',
|
||||
'pH-Wert bei',
|
||||
'Reagenz',
|
||||
'Indikator',
|
||||
'4-20 mA Ausgang',
|
||||
'pH-Wertuebertragung',
|
||||
],
|
||||
'safe_no_evidence_answer_de' => 'Ich finde in den bereitgestellten Quellen keinen sicher belegten Testomat, der pH als Messparameter misst.',
|
||||
],
|
||||
[
|
||||
'id' => 'redox',
|
||||
'label' => 'Redox / ORP',
|
||||
'request_terms' => ['redox', 'orp', 'oxidations-reduktionspotential', 'oxidations reduktionspotential'],
|
||||
'positive_terms' => ['Redox', 'ORP', 'Oxidations-Reduktionspotential', 'Oxidations Reduktionspotential'],
|
||||
'non_equivalent_terms' => [],
|
||||
'safe_no_evidence_answer_de' => 'Ich finde in den bereitgestellten Quellen keinen sicher belegten Treffer für Redox-/ORP-Messung.',
|
||||
],
|
||||
[
|
||||
'id' => 'free_chlorine',
|
||||
'label' => 'freies Chlor',
|
||||
'request_terms' => ['freies chlor', 'freiem chlor', 'freien chlor', 'free chlorine'],
|
||||
'positive_terms' => ['freies Chlor', 'freiem Chlor', 'freien Chlor', 'free chlorine'],
|
||||
'non_equivalent_terms' => ['Chlor gesamt', 'Gesamtchlor', 'total chlorine'],
|
||||
'safe_no_evidence_answer_de' => 'Ich finde in den bereitgestellten Quellen keinen sicher belegten Treffer für die Messung von freiem Chlor.',
|
||||
],
|
||||
];
|
||||
|
||||
private const ACCESSORY_REQUEST_KEYWORDS = [
|
||||
'passend',
|
||||
'passende',
|
||||
@@ -537,6 +602,7 @@ final class PromptBuilderConfig
|
||||
'- For product-selection questions, a shop result proves technical suitability only when the same SHOP PRODUCT RECORD explicitly states the requested measurement parameter, application, or compatibility. Search ranking, generated query terms, generic category matches, and similar wording are not proof.',
|
||||
'- If the requested parameter appears only in the generated shop query, metadata, unrelated highlights, or another product record, treat suitability as unverified and say that the shop hit requires technical verification.',
|
||||
'- Do not convert p-Wert, m-Wert, minus m-Wert, alkalinity, acid capacity, or other water-treatment parameters into pH or pH-Wert unless the same source explicitly says pH or pH-Wert.',
|
||||
'- For pH requests, do not treat pH operating ranges, reagent/indicator pH values, output-transfer references, or generic pH mentions as proof that a device measures pH.',
|
||||
'- When shop results are present and relevant, include current price and the actual URL if available.',
|
||||
'- If the shop data does not provide a positive price for a result, do not output any price for that result.',
|
||||
'- Do not let accessories, bundles, or service items override a technically better product match unless the user explicitly asks for them.',
|
||||
@@ -572,6 +638,7 @@ final class PromptBuilderConfig
|
||||
return $this->getStringList('fact_grounding.technical_rules', [
|
||||
'- For technical product questions, answer primarily with explicitly stated facts.',
|
||||
'- For measurement-parameter questions, do not treat similar or neighboring abbreviations as equivalent. In particular, p-Wert is not pH-Wert unless the source explicitly says pH or pH-Wert.',
|
||||
'- For pH requests, do not present products as pH-capable when the source only states an allowable pH operating range, a pH value of a reagent/indicator solution, a 4-20 mA transfer/output reference, or a generic pH mention.',
|
||||
'- Do not invent or infer measurement principles, methods, calibration functions, benefits, advantages, application areas, or alternative products from product family names, search rank, or shop query wording.',
|
||||
'- Behave like a technical documentation assistant, not like a sales advisor.',
|
||||
'- Keep interpretations minimal and do not generalize application areas beyond the provided sources.',
|
||||
@@ -700,6 +767,41 @@ final class PromptBuilderConfig
|
||||
);
|
||||
}
|
||||
|
||||
public function getProductRoleGuardSectionLabel(): string
|
||||
{
|
||||
return $this->getString('sections.product_role_guard_label', 'PRODUCT ROLE GUARD');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string[]
|
||||
*/
|
||||
public function getProductRoleGuardMainDeviceRules(): array
|
||||
{
|
||||
return $this->getStringList('role_guard.main_device_answer_rules', [
|
||||
'- If the user asks for a Testomat, measuring device, analyzer, system, or main device, the answer must be anchored on a compatible main-device record or on a clear no-match statement.',
|
||||
'- Accessories, indicators, reagents, calibration solutions, spare parts, kits, sets, services, or consumables must not be used as the main answer heading for a main-device request.',
|
||||
'- If only accessories or consumables are available in the shop results, start with a negative main-device finding and mention that only accessory/consumable hits were found.',
|
||||
'- Do not provide price, availability, product number, URL, or a recommendation for role-incompatible accessory records unless the user explicitly asks for that accessory.',
|
||||
'- Do not propose alternative devices unless a provided source explicitly proves that exact device is suitable for the requested parameter.',
|
||||
]);
|
||||
}
|
||||
|
||||
public function getProductRoleGuardNoMainDeviceTemplate(): string
|
||||
{
|
||||
return $this->getString(
|
||||
'role_guard.no_main_device_match_template',
|
||||
'No compatible main-device shop record is present for the requested main-device role. Accessory/consumable records must not be presented as the requested solution.'
|
||||
);
|
||||
}
|
||||
|
||||
public function getProductRoleGuardIncompatibleRecordNote(): string
|
||||
{
|
||||
return $this->getString(
|
||||
'shop_results.fields.role_incompatible_record_note',
|
||||
'Role guard: this is an accessory/consumable record for a main-device request. Do not use it as an answer heading, recommendation, or suitable main-device result.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string[]
|
||||
*/
|
||||
@@ -746,6 +848,88 @@ final class PromptBuilderConfig
|
||||
);
|
||||
}
|
||||
|
||||
public function getMeasurementEvidenceSectionLabel(): string
|
||||
{
|
||||
return $this->getString('sections.measurement_evidence_label', 'MEASUREMENT PARAMETER EVIDENCE CHECK');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string[]
|
||||
*/
|
||||
public function getMeasurementEvidenceIntroRules(): array
|
||||
{
|
||||
return $this->getStringList('measurement_evidence_guard.intro_rules', [
|
||||
'- This block is generated from the current user question and is stricter than broad product-selection wording.',
|
||||
'- For measurement-parameter questions, technical suitability requires explicit positive evidence for the requested parameter in the same source record.',
|
||||
'- Similar water-treatment parameters, abbreviations, units, product families, search queries, or ranking positions are not enough.',
|
||||
'- For pH requests, pH operating ranges, pH values of reagents/indicators, pH transfer/output fields, and general pH mentions are not evidence that a device measures pH.',
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<int, array<string, mixed>>
|
||||
*/
|
||||
public function getMeasurementEvidenceParameters(): array
|
||||
{
|
||||
$value = $this->getValue('measurement_evidence_guard.parameters', self::MEASUREMENT_EVIDENCE_PARAMETERS);
|
||||
|
||||
if (!is_array($value)) {
|
||||
return self::MEASUREMENT_EVIDENCE_PARAMETERS;
|
||||
}
|
||||
|
||||
$out = [];
|
||||
|
||||
foreach ($value as $item) {
|
||||
if (!is_array($item)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$id = isset($item['id']) && is_scalar($item['id']) ? trim((string) $item['id']) : '';
|
||||
$label = isset($item['label']) && is_scalar($item['label']) ? trim((string) $item['label']) : '';
|
||||
|
||||
if ($id === '' || $label === '') {
|
||||
continue;
|
||||
}
|
||||
|
||||
$out[] = [
|
||||
'id' => $id,
|
||||
'label' => $label,
|
||||
'request_terms' => $this->normalizeMixedStringList($item['request_terms'] ?? []),
|
||||
'positive_terms' => $this->normalizeMixedStringList($item['positive_terms'] ?? []),
|
||||
'non_equivalent_terms' => $this->normalizeMixedStringList($item['non_equivalent_terms'] ?? []),
|
||||
'safe_no_evidence_answer_de' => isset($item['safe_no_evidence_answer_de']) && is_scalar($item['safe_no_evidence_answer_de'])
|
||||
? trim((string) $item['safe_no_evidence_answer_de'])
|
||||
: '',
|
||||
];
|
||||
}
|
||||
|
||||
return $out !== [] ? $out : self::MEASUREMENT_EVIDENCE_PARAMETERS;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string[]
|
||||
*/
|
||||
private function normalizeMixedStringList(mixed $value): array
|
||||
{
|
||||
if (!is_array($value)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$out = [];
|
||||
foreach ($value as $item) {
|
||||
if (!is_scalar($item)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$item = trim((string) $item);
|
||||
if ($item !== '' && !in_array($item, $out, true)) {
|
||||
$out[] = $item;
|
||||
}
|
||||
}
|
||||
|
||||
return $out;
|
||||
}
|
||||
|
||||
public function getTechnicalProductModelPattern(): string
|
||||
{
|
||||
return $this->getString('technical_product_model_pattern', '/\b[\p{L}]{2,}\s?\d{2,5}\b/u');
|
||||
|
||||
Reference in New Issue
Block a user