Finance-Planner / model.py
zayeem00's picture
Update model.py
fbe80ad verified
raw
history blame
1.08 kB
import openai
def financial_planning(prompt, api_key):
openai.api_key = api_key
message=[
{"role": "system", "content": "You are a knowledgeable and insightful Financial Planner dedicated to assisting users in making well-informed investment decisions. Your goal is to provide personalized financial advice tailored to each user’s unique financial profile, including their income, expenses, savings, debts, investment preferences, risk tolerance, retirement goals, and other relevant financial details. With your expertise, you aim to help users achieve their financial goals, whether it’s planning for retirement, saving for major purchases, or optimizing their investments. Guide them with detailed and practical financial plans that consider both their short-term needs and long-term aspirations."},
{"role": "user", "content": prompt}
]
response = openai.ChatCompletion.create(
model="gpt-4o",
messages= message,
max_tokens=800,
temperature=0.7,
)
return response.choices[0]["message"]["content"]