Google Manifold pipeline needs to be updated to use native system instructions on models other than Gemini 1.5 #173

Open
opened 2026-02-15 19:16:29 -05:00 by yindo · 1 comment
Owner

Originally created by @rotemdan on GitHub (Dec 14, 2024).

Pull request #194 added conservative logic to use the native system instructions only when the model name includes the substring gemini-1.5, since gemini-1.0 doesn't support it:

if "gemini-1.5" in model_id:
    model = genai.GenerativeModel(model_name=model_id, system_instruction=system_message)
else:
    if system_message:
        contents.insert(0, {"role": "user", "parts": [{"text": f"System: {system_message}"}]})
    
    model = genai.GenerativeModel(model_name=model_id)

This doesn't apply to newer Gemini versions like gemini-2.0, gemini-exp and learnlm.

In my own local usage I don't care about using the old 1.0 models and simply changed to always use system_instruction=system_message.

In general, I can't really give a 100% robust solution that would be guaranteed to work on all future versions and variants of Gemini, but it's likely they will allow native system instructions for future models.

Less conservative approach would be to use native system instructions by default, unless it's Gemini 1.0. Something like:

if model_id.startswith("gemini-1.0") or model_id.startswith("gemini-pro"):
    if system_message:
        contents.insert(0, {"role": "user", "parts": [{"text": f"System: {system_message}"}]})

    model = genai.GenerativeModel(model_name=model_id)
else:
    model = genai.GenerativeModel(model_name=model_id, system_instruction=system_message)

I can't make a pull request unless I know exactly what approach the developer prefers. In any case, I don't think that anybody seriously uses Gemini 1.0 anymore, unless for comparison with older models, maybe.

Originally created by @rotemdan on GitHub (Dec 14, 2024). Pull request #194 added conservative logic to use the native system instructions only when the model name includes the substring `gemini-1.5`, since `gemini-1.0` doesn't support it: ```py if "gemini-1.5" in model_id: model = genai.GenerativeModel(model_name=model_id, system_instruction=system_message) else: if system_message: contents.insert(0, {"role": "user", "parts": [{"text": f"System: {system_message}"}]}) model = genai.GenerativeModel(model_name=model_id) ``` This doesn't apply to newer Gemini versions like `gemini-2.0`, `gemini-exp` and `learnlm`. In my own local usage I don't care about using the old `1.0` models and simply changed to always use `system_instruction=system_message`. In general, I can't really give a 100% robust solution that would be guaranteed to work on all future versions and variants of Gemini, but it's likely they will allow native system instructions for future models. Less conservative approach would be to use native system instructions by default, unless it's Gemini 1.0. Something like: ```py if model_id.startswith("gemini-1.0") or model_id.startswith("gemini-pro"): if system_message: contents.insert(0, {"role": "user", "parts": [{"text": f"System: {system_message}"}]}) model = genai.GenerativeModel(model_name=model_id) else: model = genai.GenerativeModel(model_name=model_id, system_instruction=system_message) ``` I can't make a pull request unless I know exactly what approach the developer prefers. In any case, I don't think that anybody seriously uses Gemini 1.0 anymore, unless for comparison with older models, maybe.
Author
Owner

@rotemdan commented on GitHub (Dec 14, 2024):

Update: trying to use gemini-1.0-pro-latest currently gives the error:

An error occurred: 404 Gemini 1.0 Pro will be discontinued on February 15th, 2025. Move to a newer Gemini version.

Other model identifiers for Gemini 1.0 still work.

I've submitted a pull request.

@rotemdan commented on GitHub (Dec 14, 2024): **Update**: trying to use `gemini-1.0-pro-latest` currently gives the error: ``` An error occurred: 404 Gemini 1.0 Pro will be discontinued on February 15th, 2025. Move to a newer Gemini version. ``` Other model identifiers for Gemini 1.0 still work. I've submitted a pull request.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: open-webui/pipelines#173