Skip to content

feat: Gemini infographic generation service (Task 4 — Imagen 4 Fast)#626

Closed
codercatdev wants to merge 3 commits intodevfrom
feat/gemini-infographics
Closed

feat: Gemini infographic generation service (Task 4 — Imagen 4 Fast)#626
codercatdev wants to merge 3 commits intodevfrom
feat/gemini-infographics

Conversation

@codercatdev
Copy link
Contributor

Task 4: Gemini Infographic Generation Service

New file: lib/services/gemini-infographics.ts (~280 lines)

API Surface

Function Purpose
generateInfographic(request, model?) Generate a single infographic image via Imagen
generateInfographicBatch(requests, options?) Generate multiple infographics with per-item error handling
generateInfographicsForTopic(topic, briefing?) Main entry point — reads instructions from contentConfig.infographicInstructions, generates all infographics for a topic with deterministic seeds
buildInfographicPrompt(topic, style?) Build a brand-consistent prompt from a topic string

Config Integration

  • Model: pipelineConfig.infographicModel (default: imagen-4-fast, $0.02/image)
  • Instructions: contentConfig.infographicInstructions (default: 5 blueprint-style prompts from spec)
  • Both use getConfigValue() with env var fallbacks

Key Features

  • Deterministic seeds from topic + index hash — same topic always produces same seeds for brand consistency
  • Fault isolation — each image in its own try/catch, failures collected in errors array
  • Lazy SDK initGoogleGenAI client created on first use, not at import time
  • Blueprint-style defaults — 5 hand-drawn/whiteboard prompts matching the CodingCat.dev brand spec
  • 16:9 aspect ratio default — matches video pipeline output

Cost

$0.02/image × 5 instructions = **$0.10 per topic**

Types Exported

InfographicResult, InfographicRequest, InfographicBatchOptions, InfographicBatchResult

Not Changed

No other files modified. This is a new standalone service file. Sprint 3 (check-research route rewrite) will consume this.

Miriad and others added 3 commits March 5, 2026 19:17
New service at lib/services/gemini-research.ts that uses the
@google/genai Interactions API for autonomous web research.

Exports:
- submitResearch(topic, config?) → interactionId
- pollResearch(interactionId) → ResearchStatus
- parseResearchReport(topic, report) → ResearchPayload
- conductGeminiResearch(topic, config?) → ResearchPayload (full pipeline)

All models and prompts configurable via Sanity pipelineConfig.
Output matches existing ResearchPayload interface for backward compat.

Co-authored-by: research <research@miriad.systems>
…nistic seeds

- generateInfographicsForTopic() reads instructions from contentConfig
- Deterministic seeds from topic+index for brand consistency
- DEFAULT_INSTRUCTIONS with blueprint-style prompts from spec
- Appends topic context to each instruction prompt
@vercel
Copy link

vercel bot commented Mar 5, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
codingcat-dev Ignored Ignored Mar 5, 2026 7:20pm

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.

1 participant