mirror of
https://github.com/open-webui/pipelines.git
synced 2026-07-21 10:05:26 -04:00
[PR #194] [MERGED] Use native system instructions for Gemini 1.5 models #346
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/open-webui/pipelines/pull/194
Author: @rotemdan
Created: 8/2/2024
Status: ✅ Merged
Merged: 8/2/2024
Merged by: @justinh-rahb
Base:
main← Head:use-native-system-message-for-gemini-1.5📝 Commits (2)
a94512dUse native system instructions for Gemini 1.5 modelsaabf46cIncrement version to 1.3📊 Changes
1 file changed (+9 additions, -6 deletions)
View changed files
📝
examples/pipelines/providers/google_manifold_pipeline.py(+9 -6)📄 Description
The current code in
google_manifold_pipelineadds a "system"-like prompt by prepending the request with a message containing the system prompt:On Gemini 1.5 models, Google added support for native system instructions. In the Python API it is passed as an argument for the constructor:
The equivalent in the REST API is documented here:
In my patch I added support for it when the string
gemini-1.5is part of the model id:Gemini 1.0 and Gemma models don't support system instructions, so they will fall back to the other approach. Note: after trying to use
system_instructionwith Gemini 1.0 I got an error from the server, but both Gemma models (gemma2-9b-itandgemma-7b-it) did accept the instruction without error and showed knowledge of it. Officially they don't support system instructions, so it could be a workaround prompt on the server.Future models, say, like
gemini-2.0will need to be added manually when they become available on the API, otherwise they will fall back to the other approach.The information returned by the API unfortunately doesn't indicate if the model supports system instructions. Here is for example, the information for Gemini 1.5 pro (returned via
https://generativelanguage.googleapis.com/v1beta/models):🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.