@bavard/agent-config
Advanced tools
Comparing version 0.1.50 to 0.1.51
@@ -50,3 +50,5 @@ "use strict"; | ||
const decisionConfidence = 1 - userAction.oodConfidence - config.intentConfidenceThreshold; | ||
return new services_1.ActionCandidate([agentAction], decisionConfidence); | ||
return decisionConfidence > 0 | ||
? new services_1.ActionCandidate([agentAction], decisionConfidence) | ||
: undefined; | ||
} | ||
@@ -53,0 +55,0 @@ } |
@@ -64,3 +64,5 @@ "use strict"; | ||
const decisionConfidence = result.confidence - config.dpConfidenceThreshold; | ||
return new services_1.ActionCandidate(actions, decisionConfidence); | ||
return decisionConfidence > 0 | ||
? new services_1.ActionCandidate(actions, decisionConfidence) | ||
: undefined; | ||
}); | ||
@@ -67,0 +69,0 @@ } |
@@ -33,3 +33,5 @@ "use strict"; | ||
const action = Object.assign(Object.assign({}, kbPrediction), { name: "kb_search_result", type: enums_1.EAgentActionTypes.KB_SEARCH_RESULT_ACTION }); | ||
return new services_1.ActionCandidate([action], decisionConfidence); | ||
return decisionConfidence > 0 | ||
? new services_1.ActionCandidate([action], decisionConfidence) | ||
: undefined; | ||
}); | ||
@@ -36,0 +38,0 @@ } |
@@ -67,3 +67,3 @@ import { AgentConfig, IAgentAction, IAgentErrorAction, IAgentShopifyActionResult, IAgentUtteranceAction, IZendeskActionResult } from ".."; | ||
/** | ||
* The action candidate's strength, in the range `[0,1]`. A greater strength | ||
* The action candidate's strength, in the range `(0,1]`. A greater strength | ||
* means the candidate is more confident in the agent actions its proposing. | ||
@@ -70,0 +70,0 @@ */ |
@@ -15,5 +15,7 @@ "use strict"; | ||
constructor(actions, strength) { | ||
if (strength <= 0) { | ||
throw Error("actions candidates cannot have negative or zero strength"); | ||
} | ||
this.actions = actions; | ||
// Clip strength to be in the range `[0,1]`. | ||
strength = Math.max(0, strength); | ||
// Clip strength to be in the range `(0,1]`. | ||
this.strength = Math.min(1, strength); | ||
@@ -20,0 +22,0 @@ } |
{ | ||
"name": "@bavard/agent-config", | ||
"version": "0.1.50", | ||
"version": "0.1.51", | ||
"description": "Shared code and single source of truth for Bavard data models.", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
591405
9452