import streamlit as st import json import google.generativeai as genai def add_to_json(): with open("test.json", "r") as file: data = json.load(file) new_item = { "goal": new_goal, # "reminder": new_reminder } data["goals"].append(new_item)(new_goal) with open("test.json", "w") as file: json.dump(data, file, indent=4) add_to_json() GOOGLE_API_KEY="AIzaSyCUBaL7TdISL7lRuBy19_X0-OsZfgbIgEc" genai.configure(api_key=GOOGLE_API_KEY) model = genai.GenerativeModel('gemini-pro') if prompt := st.chat_input("Hi, how can I help you?"): goals = f""" Act as a personal assistant, Understand user intent from the point of view for asking a few questions. ask to know more details about {prompt} :- {prompt}""" completetion = model.generate_content(goals) with st.chat_message("Assistant"): st.write(completetion.text)