Preserve bootstrap schema error paths for targeted correction
This commit is contained in:
1 parent
af2ee6cb91
commit
d957974498
7 files changed
+114
-5
No files matched your search
@@ -618,6 +618,12 @@ class Investigator:
|
||||
'oneOf':'choose_one_valid_next_action',
|
||||
'anyOf':'match_an_allowed_shape',
|
||||
}.get(info.get('validation_keyword'),'match_schema_at_validation_path')
|
||||
if context.get('bootstrap_json_framing'):
|
||||
context['previous_rejection_details']['requirement']={
|
||||
'type':'match_expected_type_at_validation_path',
|
||||
'enum':'use_allowed_value_at_validation_path',
|
||||
'const':'use_allowed_value_at_validation_path',
|
||||
}.get(info.get('validation_keyword'),context['previous_rejection_details']['requirement'])
|
||||
elif code == 'LLM_RESPONSE' and context.get('prompt_version') in {'investigation_project_v16','investigation_project_v17','investigation_project_v18'}:
|
||||
with PackageReader(self._latest(state['case_id'],state['package_id']),self.store.limits) as reader:
|
||||
call=self._read(reader,llm_ref,'llm-call')
|
||||
|
||||
@@ -11,7 +11,7 @@ VALIDATION_FIELDS = frozenset({'retire','finding_id','intent','hypothesis_id','a
|
||||
'prerequisites','requested_observations','environment','countercheck_refs','path',
|
||||
'start_line','end_line','limit','offset','table','columns','filters','column','operator',
|
||||
'value','text','case_sensitive','path_prefix','source_ref','source_refs','note','causal_review',
|
||||
'next_step','goal','supports_if','weakens_if','investigate_if'})
|
||||
'next_step','goal','supports_if','weakens_if','investigate_if','profile','entity_refs'})
|
||||
|
||||
|
||||
def schema_feedback(error, _depth=0, *, include_keyword=False):
|
||||
|
||||
@@ -155,7 +155,7 @@ class LLMGateway:
|
||||
LOGGER.warning("LLM endpoint unavailable provider=%s code=%s", provider.id, code)
|
||||
except ValidationError as invalid:
|
||||
info={'validation_keyword':invalid.validator}
|
||||
if request['prompt_version'] in {'investigation_project_v14','investigation_project_v15','investigation_project_v16','investigation_project_v17','investigation_project_v18','investigation_project_v19','investigation_project_v20'}:
|
||||
if request['prompt_version'] in {'investigation_bootstrap_v21','investigation_project_v14','investigation_project_v15','investigation_project_v16','investigation_project_v17','investigation_project_v18','investigation_project_v19','investigation_project_v20'}:
|
||||
from .diagnostics import schema_feedback
|
||||
info.update(schema_feedback(invalid,include_keyword=True))
|
||||
error = LLMError("LLM_OUTPUT_SCHEMA",diagnostics=info)
|
||||
|
||||
Reference in new issue
Block a user