fix(prisma): extract prompt qwen-silence restructure; notebook methods disclose 32B stage-3 escalation (refs P43)

This commit is contained in:
kert
2026-08-21 10:15:12 -04:00
parent 6c43383946
commit 6c561ad580
2 changed files with 24 additions and 11 deletions

View File

@@ -160,9 +160,12 @@ def _(mo):
> project criteria. **Stage-3 full-text eligibility** runs locally > project criteria. **Stage-3 full-text eligibility** runs locally
> (qwen2.5:14b, 32k context, per-item markdown capped at 60k chars > (qwen2.5:14b, 32k context, per-item markdown capped at 60k chars
> with an explicit truncation marker — the criteria stay in > with an explicit truncation marker — the criteria stay in
> window). Full-text retrieval: Unpaywall → PMC OA (S3) → Europe > window); items the 14B persistently returned empty responses for
> PMC → mirror fallback; items with no retrievable full text > were escalated to **qwen2.5:32b** (20k-char cap to fit its
> resolve `uncertain / unavailable-fulltext` rather than silently > context), mirroring the stage-2 adjudication pattern. Full-text
> retrieval: Unpaywall → PMC OA (S3) → Europe PMC → mirror
> fallback; items with no retrievable full text resolve
> `uncertain / unavailable-fulltext` rather than silently
> dropping. The flow diagram above reflects whatever stage the > dropping. The flow diagram above reflects whatever stage the
> pipeline has reached — it is computed live. > pipeline has reached — it is computed live.
""") """)

View File

@@ -28,13 +28,22 @@ if TYPE_CHECKING:
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
_SYSTEM = """\ # One-sentence system message — longer system prompts make qwen models
You are extracting structured data from a clinical study for a # served by Ollama return an EMPTY response (no text, no tool call);
systematic review. Fill the `extract_study_data` tool fields using # same quirk screen.py and eligibility.py hit. Guidance lives in the
values reported in the paper. If a field is not reported, return an # cached first user message.
empty string — never invent values. Preserve original units. Use the _SYSTEM = (
enum values exactly as specified; leave the field empty if no enum "You are extracting structured data from a clinical study for a systematic review."
member fits. )
_GUIDANCE = """\
## Task
Fill the `extract_study_data` tool fields using values reported in the
paper (next message). If a field is not reported, return an empty
string — never invent values. Preserve original units. Use the enum
values exactly as specified; leave the field empty if no enum member
fits.
Put any noteworthy observations, caveats, or uncertainty about the Put any noteworthy observations, caveats, or uncertainty about the
extraction into `extraction_notes` (one to three sentences max). extraction into `extraction_notes` (one to three sentences max).
@@ -48,7 +57,8 @@ def _build_call(project: Project, item_markdown: str, tool: LLMTool) -> LLMCall:
LLMMessage( LLMMessage(
role="user", role="user",
content=( content=(
"## Extraction template (reference)\n\n" _GUIDANCE
+ "\n## Extraction template (reference)\n\n"
+ project.extraction_template + project.extraction_template
), ),
cache=True, cache=True,