Skip to content

Replace Claude with Gemini 3.1 Pro#1

Open
heisninja wants to merge 5 commits intodabit3:mainfrom
heisninja:main
Open

Replace Claude with Gemini 3.1 Pro#1
heisninja wants to merge 5 commits intodabit3:mainfrom
heisninja:main

Conversation

@heisninja
Copy link
Copy Markdown

@heisninja heisninja commented Mar 19, 2026

Overview

This pull request migrates Fabricate from Anthropic's Claude to Google's Gemini 3.1 Pro for code generation while keeping all other functionality identical.

Changes Made

1. Dependencies (requirements.txt)

  • Removed: anthropic>=0.39.0
  • Added: google-generativeai>=0.8.0

2. Code Generator (fabricate/generator.py)

  • Replaced import anthropic with import google.generativeai as genai
  • Updated class docstring from "using Claude" to "using Gemini 3.1 Pro"
  • Changed initialization:
    • From: self.client = anthropic.Anthropic(api_key=api_key)
    • To: genai.configure(api_key=api_key) and self.client = genai.GenerativeModel(model)
  • Renamed method _call_claude() to _call_gemini()
  • Updated Gemini API call to use generate_content() with GenerationConfig
  • Default model: gemini-3.1-pro-preview
  • Kept JSON extraction logic and fallback mechanisms unchanged

3. Configuration (fabricate/config.py)

  • Changed field name: anthropic_api_keygemini_api_key
  • Updated field description to reference Google Gemini
  • Kept all other configuration unchanged

4. CLI (fabricate/cli.py)

  • Renamed option: --anthropic-key--gemini-key (short form -g)
  • Updated environment variable: FABRICATE_ANTHROPIC_API_KEYFABRICATE_GEMINI_API_KEY
  • Updated error messages to reference Gemini API key
  • Updated parameter name in function calls from anthropic_api_key to gemini_api_key

5. Persona Fabricator (fabricate/persona.py)

  • Updated parameter name: anthropic_api_keygemini_api_key in PersonaFabricator.__init__()
  • Updated run_fabrication() function signature to use gemini_api_key
  • Updated docstrings to reference Google Gemini

Behavior

✅ Repository concept generation
✅ Initial commit generation
✅ Subsequent commit generation
✅ Commit history generation and backdating
✅ GitHub repository creation and pushing
✅ All fallback mechanisms
✅ Output formatting and JSON handling

Testing

Users should set the environment variable and run:

export FABRICATE_GEMINI_API_KEY="your-gemini-api-key"
export FABRICATE_GITHUB_TOKEN="your-github-token"
fabricate generate -l python -r 2

Or use the command-line option:

fabricate generate --gemini-key your-key --github-token your-token -l python -r 2

Notes

  • The Gemini API requires the generation config to be explicitly set for max tokens and temperature
  • All prompt structures remain identical - only the API integration changed
  • Fallback mechanisms ensure graceful degradation if API calls fail
  • The model can be customized via the model parameter (defaults to gemini-3.1-pro-preview)

Open with Devin

Copy link
Copy Markdown

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

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

Devin Review found 1 potential issue.

View 4 additional findings in Devin Review.

Open in Devin Review

@@ -1,9 +1,8 @@
anthropic>=0.39.0
google-generativeai>=0.8.0
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔴 pyproject.toml still declares anthropic dependency instead of google-generativeai

The migration from Anthropic to Gemini updated requirements.txt (line 1) but did not update pyproject.toml:27, which still declares "anthropic>=0.39.0" as a dependency. Since pyproject.toml is the authoritative dependency specification used by pip install ., pip install -e ., and package builds, anyone installing the package via the standard Python packaging flow will get anthropic installed but not google-generativeai. This causes an immediate ModuleNotFoundError at runtime when import google.generativeai as genai executes in fabricate/generator.py:10.

Prompt for agents
In pyproject.toml, line 27, change the dependency from "anthropic>=0.39.0" to "google-generativeai>=0.8.0" to match the requirements.txt update and the actual import used in fabricate/generator.py.
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

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