Fix LLM GIF parsing robustness and add CLI producer#3
Open
apshoemaker wants to merge 2 commits into
Open
Conversation
… effectively become gifs as another mechanism by which gifs are pushed to the keyboard screen
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
json.loadsto fail withJSONDecodeError; the project needs a producer that tolerates those formats and emits ND75-ready GIF bytes.Description
nd75_screen/llm_gif.pywhich extracts text from mixed Anthropic response blocks, scans and decodes embedded/fenced JSON payloads, validates storyboard shape, renders ND75-sized frames with PIL, and serializes them to an animated GIF viaframes_to_gif.nd75_screen/cli/llm.pyCLI (nd75-llm-gif) that creates an Anthropic client fromANTHROPIC_API_KEY, accepts a prompt and--modeloverride, and writes generated GIF bytes tostdout.bufferfor pipe composition.tests/test_llm_gif.pyandtests/test_cli_llm.pycovering fenced JSON parsing, ignoring non-text blocks, clearValueErroron missing JSON payloads, CLI stdout emission, and model override behavior.anthropic>=0.84.0and and75-llm-gifscript entry inpyproject.toml, and adding usage/examples for the new CLI toREADME.md.Testing
uv run pytest tests/test_llm_gif.py tests/test_cli_llm.py -qand the new tests passed.uv run pytest tests/ -qand the full test suite passed (81 passed).uv run python -m nd75_screen.cli.llm --helpwhich printed the expected usage information.Codex Task