optimize weigths by rag and shop
This commit is contained in:
@@ -228,7 +228,9 @@ final readonly class PromptBuilder
|
||||
"Use these results as the primary source for current price, availability, URL, and current shop-visible product naming.\n" .
|
||||
"If retrieved documents conflict with shop data on price, availability, URL, or current naming, prefer the shop data.\n" .
|
||||
"Output real URL values exactly as provided in the shop results. Do not replace them with placeholders, link labels, or product names.\n" .
|
||||
"Do not infer undocumented technical specifications from shop data.";
|
||||
"Do not infer undocumented technical specifications from shop data.\n" .
|
||||
"Commercial fields from shop data may only be assigned to a product if the shop item clearly matches the same product identity.\n" .
|
||||
"Do not merge a device identified in retrieved knowledge with price, URL, product number, or availability from a different shop item such as a reagent, accessory, kit, consumable, or service item.";
|
||||
|
||||
if ($totalCount > count($limitedShopResults)) {
|
||||
$header .= "\n" .
|
||||
@@ -268,16 +270,27 @@ final readonly class PromptBuilder
|
||||
"- Use short, clean paragraphs or short labeled sections.",
|
||||
"- Do not use persuasive or promotional wording.",
|
||||
"- Do not repeat the same fact in slightly different wording.",
|
||||
"- Never mention brands, manufacturers, model names, or product families that do not appear in the provided shop results, retrieved knowledge, URL content, or conversation context.",
|
||||
"- If no suitable product is explicitly grounded in the provided sources, say that plainly instead of inventing alternatives.",
|
||||
"- Do not generate external alternative lists, vendor suggestions, or purchase recommendations unless they are explicitly present in the provided sources.",
|
||||
"- Do not combine technical identity from one source with commercial fields from a different product.",
|
||||
"- Product number, price, availability, and URL must belong to the same explicitly grounded product.",
|
||||
];
|
||||
|
||||
if ($hasShopResults) {
|
||||
$rules[] = "- If a product is identified, prefer this structure per product: product name, product number, price, availability, URL, then only the most relevant technical facts.";
|
||||
$rules[] = "- Keep price, availability, and URL on separate lines when they are present.";
|
||||
$rules[] = "- Only use shop price, URL, product number, or availability for the main product when the shop result clearly matches that same main product.";
|
||||
$rules[] = "- If the matching shop item appears to be an accessory, reagent, consumable, set, or kit, keep it separate and do not present its commercial fields as the main device.";
|
||||
$rules[] = "- If the commercial match is uncertain, say that commercial details for the main product are not clearly available in the provided shop results.";
|
||||
} else {
|
||||
$rules[] = "- If no shop results are present, do not compensate by inventing external products or external manufacturers.";
|
||||
}
|
||||
|
||||
if ($isTechnicalProductQuestion) {
|
||||
$rules[] = "- Write like technical documentation: precise, neutral, and source-close.";
|
||||
$rules[] = "- Prefer exact values, ranges, thresholds, compatibility notes, and application areas over general explanation.";
|
||||
$rules[] = "- If the sources only support a negative finding, output only that negative finding and do not add speculative alternatives.";
|
||||
}
|
||||
|
||||
if ($this->asksForAccessoryOrBundle($prompt)) {
|
||||
@@ -407,6 +420,8 @@ final readonly class PromptBuilder
|
||||
"- Clearly separate explicit facts from inferences.",
|
||||
"- If a conclusion goes beyond the source wording, label it exactly as 'Inference:'.",
|
||||
"- If a sentence cannot be traced to the provided sources, do not write it.",
|
||||
"- Never mention external manufacturers, external brands, or external products unless they are explicitly present in the provided sources.",
|
||||
"- If the sources do not identify a suitable product, do not invent one.",
|
||||
];
|
||||
|
||||
if ($hasShopResults) {
|
||||
@@ -417,9 +432,13 @@ final readonly class PromptBuilder
|
||||
"- Do not let accessories, bundles, or service items override a technically better product match unless the user explicitly asks for them.",
|
||||
"- Do not call accessories, indicators, reagents, kits, sets, or consumables a device, measuring device, or main product unless the source explicitly says so.",
|
||||
"- Do not claim that an accessory is required, necessary, used for calibration, or sets the measurement range unless this is explicitly stated in the provided sources.",
|
||||
"- Do not assign the product number, price, URL, or availability of a reagent, accessory, kit, set, consumable, or service item to a device identified in retrieved knowledge.",
|
||||
"- Only use commercial fields for the main product when the shop item and the technically identified product clearly refer to the same product identity.",
|
||||
"- If the shop match is ambiguous, keep the technical identification and commercial details separate.",
|
||||
]);
|
||||
} else {
|
||||
$rules[] = "- Use retrieved knowledge as authoritative for factual answers.";
|
||||
$rules[] = "- If no shop results are present, do not compensate with external recommendations or external product suggestions.";
|
||||
}
|
||||
|
||||
if ($isTechnicalProductQuestion) {
|
||||
@@ -440,6 +459,7 @@ final readonly class PromptBuilder
|
||||
"- If the source states only a threshold function, do not expand it into broader control logic.",
|
||||
"- If a detail is not explicitly stated in the provided sources, say so plainly.",
|
||||
"- Prefer short, source-close sentences over explanatory expansion.",
|
||||
"- If the sources only support that a product family is not suitable, output only that unsuitability and stop there.",
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user