ayushsinghal1510's picture
Intial Commit
34df346
raw
history blame contribute delete
561 Bytes
from google.genai import types
async def json_to_google_chat(chat) :
contents = []
for row in chat :
role = row['role']
if role == 'user' : contents.append(
types.Content(
role = 'user' ,
parts = [types.Part.from_text(text = str(row['content']))]
)
)
else : contents.append(
types.Content(
role = 'model' ,
parts = [types.Part.from_text(text = str(row['content']))]
)
)
return contents