This commit is contained in:
@@ -57,7 +57,13 @@ def _schema() -> dict[str, Any]:
|
||||
"seniority": {"type": "string"},
|
||||
"evidence": {"type": "array", "items": {"type": "string"}},
|
||||
},
|
||||
"required": ["support_ratio", "consultancy_ratio", "travel_ratio", "seniority", "evidence"],
|
||||
"required": [
|
||||
"support_ratio",
|
||||
"consultancy_ratio",
|
||||
"travel_ratio",
|
||||
"seniority",
|
||||
"evidence",
|
||||
],
|
||||
},
|
||||
"warnings": {"type": "array", "items": {"type": "string"}},
|
||||
},
|
||||
@@ -73,8 +79,8 @@ def _normalize_text(title: str, description: str) -> str:
|
||||
def _coerce_ratio(name: str, value: Any) -> float:
|
||||
try:
|
||||
ratio = float(value)
|
||||
except (TypeError, ValueError):
|
||||
raise ValueError(f"ratio:{name}")
|
||||
except (TypeError, ValueError) as exc:
|
||||
raise ValueError(f"ratio:{name}") from exc
|
||||
if not (MIN_FEATURE_VALUE <= ratio <= MAX_FEATURE_VALUE):
|
||||
raise ValueError(f"ratio:{name}")
|
||||
return round(ratio, 6)
|
||||
@@ -108,7 +114,9 @@ def _parse_and_validate_payload(payload: Any, *, title: str, description: str) -
|
||||
evidence_values = features.get("evidence")
|
||||
if not isinstance(evidence_values, list):
|
||||
raise ValueError("evidence")
|
||||
normalized_evidence = [normalize_token(item) for item in evidence_values if isinstance(item, str)]
|
||||
normalized_evidence = [
|
||||
normalize_token(item) for item in evidence_values if isinstance(item, str)
|
||||
]
|
||||
normalized_evidence = [item for item in normalized_evidence if item]
|
||||
if not normalized_evidence:
|
||||
raise ValueError("evidence")
|
||||
@@ -289,7 +297,9 @@ def analyze_job_text(
|
||||
)
|
||||
|
||||
try:
|
||||
return _cache_get(content_hash=content_hash, model=model_name, prompt_version=prompt_version)
|
||||
return _cache_get(
|
||||
content_hash=content_hash, model=model_name, prompt_version=prompt_version
|
||||
)
|
||||
except AiUnavailable:
|
||||
pass
|
||||
|
||||
|
||||
Reference in New Issue
Block a user