harden token config
This commit is contained in:
@@ -52,7 +52,10 @@ final readonly class PromptBuilder
|
||||
|
||||
$systemBlock = $this->buildSystemBlock();
|
||||
$shopBlock = $this->buildShopBlock($shopResults, $swagFullOutPut);
|
||||
$outputPriorityBlock = $this->buildOutputPriorityBlock($hasShopResults);
|
||||
$outputPriorityBlock = $this->buildOutputPriorityBlock(
|
||||
hasShopResults: $hasShopResults,
|
||||
isTechnicalProductQuestion: $isTechnicalProductQuestion
|
||||
);
|
||||
$responseFormatBlock = $this->buildResponseFormatBlock(
|
||||
hasShopResults: $hasShopResults,
|
||||
isTechnicalProductQuestion: $isTechnicalProductQuestion,
|
||||
@@ -214,15 +217,25 @@ final readonly class PromptBuilder
|
||||
/**
|
||||
* Build a small priority block that tells the model what to surface first.
|
||||
*/
|
||||
private function buildOutputPriorityBlock(bool $hasShopResults): string
|
||||
private function buildOutputPriorityBlock(bool $hasShopResults, bool $isTechnicalProductQuestion): string
|
||||
{
|
||||
if (!$hasShopResults) {
|
||||
$rules = [];
|
||||
|
||||
if ($isTechnicalProductQuestion) {
|
||||
$rules = array_merge($rules, $this->config->getOutputPriorityTechnicalRules());
|
||||
}
|
||||
|
||||
if ($hasShopResults) {
|
||||
$rules = array_merge($rules, $this->config->getOutputPriorityRules());
|
||||
}
|
||||
|
||||
if ($rules === []) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return $this->buildRuleBlock(
|
||||
$this->config->getOutputPrioritySectionLabel(),
|
||||
$this->config->getOutputPriorityRules()
|
||||
$rules
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user