Spaces:
Runtime error
Runtime error
| 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 |