summaryrefslogtreecommitdiffstats
path: root/g4f/Provider
diff options
context:
space:
mode:
authormonosans <hsyqixco@protonmail.com>2024-09-11 13:55:48 +0200
committermonosans <hsyqixco@protonmail.com>2024-09-11 14:01:10 +0200
commitc2f724890e6d44aec48e2a8b4f8b1e98a5736d21 (patch)
tree7c4b0fe333da37234ef84e262371c073f024baf1 /g4f/Provider
parentMerge pull request #2207 from kqlio67/main (diff)
downloadgpt4free-c2f724890e6d44aec48e2a8b4f8b1e98a5736d21.tar
gpt4free-c2f724890e6d44aec48e2a8b4f8b1e98a5736d21.tar.gz
gpt4free-c2f724890e6d44aec48e2a8b4f8b1e98a5736d21.tar.bz2
gpt4free-c2f724890e6d44aec48e2a8b4f8b1e98a5736d21.tar.lz
gpt4free-c2f724890e6d44aec48e2a8b4f8b1e98a5736d21.tar.xz
gpt4free-c2f724890e6d44aec48e2a8b4f8b1e98a5736d21.tar.zst
gpt4free-c2f724890e6d44aec48e2a8b4f8b1e98a5736d21.zip
Diffstat (limited to '')
-rw-r--r--g4f/Provider/GeminiPro.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/g4f/Provider/GeminiPro.py b/g4f/Provider/GeminiPro.py
index b225c26c..06bf69ee 100644
--- a/g4f/Provider/GeminiPro.py
+++ b/g4f/Provider/GeminiPro.py
@@ -54,6 +54,7 @@ class GeminiPro(AsyncGeneratorProvider, ProviderModelMixin):
"parts": [{"text": message["content"]}]
}
for message in messages
+ if message["role"] != "system"
]
if image is not None:
image = to_bytes(image)
@@ -73,6 +74,13 @@ class GeminiPro(AsyncGeneratorProvider, ProviderModelMixin):
"topK": kwargs.get("top_k"),
}
}
+ system_prompt = "\n".join(
+ message["content"]
+ for message in messages
+ if message["role"] == "system"
+ )
+ if system_prompt:
+ data["system_instruction"] = {"parts": {"text": system_prompt}}
async with session.post(url, params=params, json=data) as response:
if not response.ok:
data = await response.json()