Skip to content

add the zero_shot method - #45

Merged
AnnaWegmann merged 2 commits into
incontext-structurefrom
35-zero-shot
Aug 7, 2026
Merged

add the zero_shot method#45
AnnaWegmann merged 2 commits into
incontext-structurefrom
35-zero-shot

Conversation

@AnnaWegmann

Copy link
Copy Markdown
Owner

Adds the zero_shot method: styles are defined by rewrite instructions instead of example texts. It plugs into everything the previous PRs prepared — same generate(texts, style_dict, ...) interface and labeled output, its own style_bank (so styles and n select instruction styles like formal, simple, complex, caps, lowercase, ...), the shared causal LM base class (same model/precision options, shared loaded model with prompting), and _run_prompts for generation.

The bank restores the previously deleted zero-shot prompts from git history under clean style names (curation note from the #35 spec: the one-line "more simple" prompt is dropped in favour of the detailed simplification prompt). With this method, style_texts are instructions — exactly one per style (more errors, naming the style). An instruction may place the input text itself via [DOCUMENT SEGMENT]; otherwise the text is appended at the end with a fixed "output only the rewrite" ending.

The method itself is ~30 lines of logic; the rest of the diff is the instruction bank (restored data), three tests, and the README/methods docs sections.

Closes #35. Part of #13.

Written by Claude and Anna

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings August 7, 2026 10:05

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@AnnaWegmann AnnaWegmann left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix comment

Comment thread tests/test_zero_shot.py Outdated
…tive mock for generate

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@AnnaWegmann

Copy link
Copy Markdown
Owner Author

Restructured the test: the placeholder/scaffold behavior is now tested directly on _fill_instruction with plain strings and no mock at all, and the generate test uses the same intuitive mock style as the prompting test — the fake model answers each prompt with a reply named after its style, so the assertion reads as [["formal reply", "pirate reply"]].

Written by Claude and Anna

@AnnaWegmann AnnaWegmann left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok!

@AnnaWegmann
AnnaWegmann merged commit ba86017 into incontext-structure Aug 7, 2026
7 of 8 checks passed
@AnnaWegmann
AnnaWegmann deleted the 35-zero-shot branch August 7, 2026 10:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants