Find answers from the community

Updated 9 months ago

Gemini

Hi, I'm trying to use Tree Summarize with Gemini Pro. I'm getting this error:
"raise ValueError("Gemini model don't support system messages")
ValueError: Gemini model don't support system messages"

It seems that the Gemini Pro model does not accept system messages. I've tried to look at the Github code to see where the system message was, but I haven't been able to find it.

Would anyone have a fix? Thanks!!
W
i
L
6 comments
Hi, can you share your code?
thanks for the quick reply, my code:

from llama_index.core import SimpleDirectoryReader
from llama_index.core.response_synthesizers import TreeSummarize
from llama_index.llms.vertex import Vertex
from google.oauth2 import service_account
from llama_index.core import Settings
import asyncio

filename = "test_service_account.json"
credentials: service_account.Credentials = (
service_account.Credentials.from_service_account_file(filename)
)

llm = Vertex(
model="gemini-pro",
project=credentials.project_id,
credentials=credentials,
temperature=0.1,
)

Settings.llm=llm

reader = SimpleDirectoryReader(
input_files=["LWST.docx"]
)

docs = reader.load_data()

text = docs[0].text

summarizer = TreeSummarize(verbose=True)

async def summ():
response = await summarizer.aget_response("what is this judgment about?", [text])

print(asyncio.run(summ()))
the above works if i use chatgpt3.5 instead

also, gemini is working fine if i do i simple complete chat like, "print(llm.complete("Hello Gemini").text)"
There's a PR to fix this soon I believe
great, thanks for all your super quick answers.

i got it to work. there are two different examples in the docs:-

https://docs.llamaindex.ai/en/stable/module_guides/querying/response_synthesizers/root.html

^ this works for Gemini Pro, TreeSummarize with a PromptTemplate defined in the code

https://docs.llamaindex.ai/en/stable/examples/response_synthesizers/tree_summarize.html

^ this does not work for Gemini Pro. No PromptTemplate defined in the user's code. this is the first google result for "tree summarize llamaindex". i was following this when i encountered the gemini system message error
That makes sense, since the default prompt template uses a system prompt
Add a reply
Sign up and join the conversation on Discord