Skip to content

feat: Gemini Deep Research client (Task 3)#625

Merged
codercatdev merged 1 commit intodevfrom
feat/gemini-deep-research-client
Mar 5, 2026
Merged

feat: Gemini Deep Research client (Task 3)#625
codercatdev merged 1 commit intodevfrom
feat/gemini-deep-research-client

Conversation

@codercatdev
Copy link
Contributor

Summary

New service at lib/services/gemini-research.ts that uses the @google/genai Interactions API for autonomous web research, replacing the NotebookLM-based research pipeline.

What Changed

Single new file: lib/services/gemini-research.ts

Exports

Function Description
submitResearch(topic, config?) Submit a research query → returns interaction ID
pollResearch(interactionId) Check status of a research interaction
parseResearchReport(topic, report) Parse markdown report → structured ResearchPayload
conductGeminiResearch(topic, config?) Full pipeline: submit → poll → parse

Types (re-exported for backward compat)

  • ResearchPayload, ResearchSource, CodeExample, ComparisonData, SceneHint
  • New: GeminiResearchConfig, ResearchStatus

SDK API Shape (verified against @google/genai v1.44.0)

The Interactions API uses:

  • ai.interactions.create({ agent, input, background: true })Interaction
  • ai.interactions.get(id)Interaction
  • Interaction.status: 'in_progress' | 'completed' | 'failed' | 'cancelled' | 'incomplete'
  • Interaction.outputs: Array<Content> (TextContent with .text field)

Design Decisions

  1. All config from Sanity — agent model, prompt template, parsing model all via getConfigValue() with sensible defaults
  2. Two-phase parsing — Gemini Flash extracts structured JSON from the report; falls back to regex-based extraction if parsing fails
  3. Backward compatible — output matches existing ResearchPayload interface exactly
  4. Fallback helpers — includes extractTalkingPoints, extractCodeExamples, classifyScene, generateSceneHints, classifySourceType copied from research.ts for the fallback path

Verification

  • npx tsc --noEmit — zero errors on gemini-research.ts
  • ✅ All imports resolve (@google/genai, @/lib/config, @/lib/gemini, ./research)
  • ✅ No hardcoded model strings (all from config)
  • ✅ No hardcoded prompt text (all from config with fallback defaults)
  • ✅ Single file, single commit

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>
@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:19pm

@codercatdev codercatdev merged commit 06ecabb into dev Mar 5, 2026
2 of 3 checks passed
@codercatdev codercatdev deleted the feat/gemini-deep-research-client branch March 5, 2026 19:21
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