Spaces:
Sleeping
Sleeping
Update src/utils/response_verifier.py
Browse files
src/utils/response_verifier.py
CHANGED
|
@@ -1,5 +1,6 @@
|
|
| 1 |
from typing import Dict, Any, List, Optional
|
| 2 |
from ..knowledge_base.grounding_truth import GroundingTruth
|
|
|
|
| 3 |
import logging
|
| 4 |
|
| 5 |
logger = logging.getLogger(__name__)
|
|
@@ -9,6 +10,7 @@ class ResponseVerifier:
|
|
| 9 |
|
| 10 |
def __init__(self):
|
| 11 |
self.grounding_truth = GroundingTruth()
|
|
|
|
| 12 |
self.mode_confidence_thresholds = {
|
| 13 |
"scientific": 0.9,
|
| 14 |
"creative": 0.7,
|
|
@@ -126,6 +128,8 @@ class ResponseVerifier:
|
|
| 126 |
return "It appears that"
|
| 127 |
elif confidence >= 0.4:
|
| 128 |
return "It seems possible that"
|
|
|
|
|
|
|
| 129 |
elif confidence >= 0.2:
|
| 130 |
return "There is a speculation that"
|
| 131 |
else:
|
|
|
|
| 1 |
from typing import Dict, Any, List, Optional
|
| 2 |
from ..knowledge_base.grounding_truth import GroundingTruth
|
| 3 |
+
from .response_templates import get_response_templates
|
| 4 |
import logging
|
| 5 |
|
| 6 |
logger = logging.getLogger(__name__)
|
|
|
|
| 10 |
|
| 11 |
def __init__(self):
|
| 12 |
self.grounding_truth = GroundingTruth()
|
| 13 |
+
self.response_templates = get_response_templates()
|
| 14 |
self.mode_confidence_thresholds = {
|
| 15 |
"scientific": 0.9,
|
| 16 |
"creative": 0.7,
|
|
|
|
| 128 |
return "It appears that"
|
| 129 |
elif confidence >= 0.4:
|
| 130 |
return "It seems possible that"
|
| 131 |
+
uncertain = self.response_templates.get_uncertain_prefix()
|
| 132 |
+
return uncertain.rstrip(',') # Remove trailing comma if present
|
| 133 |
elif confidence >= 0.2:
|
| 134 |
return "There is a speculation that"
|
| 135 |
else:
|