PAIR-code / PAIR-code/deliberate-lab

use Gemma 4 in DL

Open
#1,223 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
96
Forks
40
Avg merge
2d 11h
Merged PRs (30d)
20

Description

For users wishing to use Gemma 4 (or future Gemma models with native system prompt support) via the Gemini API or Vertex AI.

Issue:
The backend relies on the Vercel AI SDK, which incorrectly assumes Gemma models do not support system instructions (Gemma 1-3 do not support system instructions). The SDK identifies Gemma models using a simple prefix check:
const isGemmaModel = this.modelId.toLowerCase().startsWith('gemma-'); ([Source](https://github.com/vercel/ai/blob/a983d06996ec688b45e0ae177c431a4c994c51fc/packages/google/src/google-language-model.ts#L260))

When a Gemma model is detected, the SDK forces one of two behaviors:

Workaround:
You can bypass this by formatting the model ID as models/{gemma-model-name}. This avoids the hardcoded logic and ensures system instructions are processed correctly.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the backend's Vercel AI SDK model configuration and how Gemini API or Vertex AI model IDs are passed through. Compare the SDK behavior in google-language-model.ts and convert-to-google-messages.ts for Gemma system instructions, then verify that Gemma 4 receives them without relying on the models/{gemma-model-name} workaround.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.