Multi-source import: multiple images + PDFs → multiple recipes#84
Merged
Conversation
New POST /v1/recipes/import/files accepts several files at once (a mix of images and PDF documents) and extracts EVERY distinct recipe found across them, saving each. First phase of unified multi-source import. - ai: VisionProvider.ExtractRecipesFromMedia builds one Claude (Sonnet) request with N image blocks + native PDF document blocks and a new extract_recipes tool that returns an array of recipes. The single-recipe schema is now shared via recipeProperties() between create_recipe and extract_recipes. Invalid entries are dropped; PromptVersion stamped. - service: ImportFromFiles classifies each upload by magic bytes (image vs PDF), extracts, caps at 20 recipes, saves each via createImportedRecipe. - handler/router: multipart endpoint with per-file (10MB), total (<32MB, under Claude's request ceiling), and file-count (10) limits. Routed through Sonnet (1M ctx, 600-page PDFs) rather than Haiku (100-page cap). Tests: detectMediaKind, ImportFromFiles (multi/unsupported/empty), and multipart handler (success/no-files). Full suite green. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BU4UWZutHd1AnK3XAf7H19
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
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.
What
First phase of unified multi-source import —
POST /v1/recipes/import/files. Send several files in one request (a mix of images and PDF documents) and it extracts every distinct recipe found across all of them, saving each. This closes the core gaps from the import gap-analysis: multi-recipe-per-image, multiple files at once, and document/PDF import.How
ai(Anthropic provider) — newVisionProvider.ExtractRecipesFromMedia: one Claude request with N image content blocks + native PDFdocumentblocks and a newextract_recipestool returning arecipes[]array. The single-recipe schema is now shared viarecipeProperties()betweencreate_recipeandextract_recipes(no duplication). Invalid entries are skipped;PromptVersionstamped per recipe.service—ImportFromFilesclassifies each upload by magic bytes (JPEG/PNG/GIF/WebP → image,%PDF→ PDF), rejects unsupported types, caps at 20 recipes, and saves each via the existingcreateImportedRecipe.handler+router— multipart endpoint (filesfield) with per-file (10 MB), total (<32 MB — under Claude's request ceiling), and count (10) limits;ExtractionErrorcodes mapped to 400/422.Decisions
ExtractRecipesFromMedia.stricttool schema — matches the existing forced-tool_choicepattern the codebase already relies on, avoiding anadditionalProperties:false/requiredoverhaul of the shared recipe schema.Tests
detectMediaKind(pdf/jpeg/png/gif/garbage/empty),ImportFromFilesservice (multi-recipe, unsupported file, no files), and multipart handler (success, no-files).go test ./... -count=1→ green (11 packages, 0 failures).Follow-ups (not in this PR)
🤖 Generated with Claude Code
https://claude.ai/code/session_01BU4UWZutHd1AnK3XAf7H19