How can I start a new chat with custom chat history in the new Google Gen AI SDK? (python)

In the previous version, we could start a new chat using chat:
chat = model.start_chat(history=chat_history) where, we would add the history as a parameter or leave it blank.

But in the new sdk,
chat = client.chats.create(
model=MODEL_ID,
config=types.GenerateContentConfig(
system_instruction=system_instruction,
temperature=0.5,
),
)
There is no parameter for chat history.

Hi,

Welcome to the forum.

According to the source code on GitHub

There is an optional parameter history that you could use.

Hope this helps.

2 Likes