Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
rotemdan opened this issue Dec 14, 2024 · 1 comment · May be fixed by #372

Comments

@rotemdan
Copy link
Contributor

rotemdan commented 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.

@rotemdan
Copy link
Contributor Author

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 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 a pull request may close this issue.

1 participant