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
> (qwen2.5:14b, 32k context, per-item markdown capped at 60k chars
> with an explicit truncation marker — the criteria stay in
> window). Full-text retrieval: Unpaywall → PMC OA (S3) → Europe
> PMC → mirror fallback; items with no retrievable full text
> resolve `uncertain / unavailable-fulltext` rather than silently
> window); items the 14B persistently returned empty responses for
> were escalated to **qwen2.5:32b** (20k-char cap to fit its
> 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
> pipeline has reached — it is computed live.
""")

View File

@@ -28,13 +28,22 @@ if TYPE_CHECKING:
log = logging.getLogger(__name__)
_SYSTEM = """\
You are extracting structured data from a clinical study for a
systematic review. Fill the `extract_study_data` tool fields using
values reported in the paper. 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.
# One-sentence system message — longer system prompts make qwen models
# served by Ollama return an EMPTY response (no text, no tool call);
# same quirk screen.py and eligibility.py hit. Guidance lives in the
# cached first user message.
_SYSTEM = (
"You are extracting structured data from a clinical study for a systematic review."
)
_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
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(
role="user",
content=(
"## Extraction template (reference)\n\n"
_GUIDANCE
+ "\n## Extraction template (reference)\n\n"
+ project.extraction_template
),
cache=True,