from langchain_core.prompts import ChatPromptTemplate from langchain_groq import ChatGroq def get_quote(topic): chat = ChatGroq(temperature=0.9, model_name="mixtral-8x7b-32768") system = "You are a helpful assistant who generate the motivational quotes based on the user topic provided.\ The output quote should be one liner and catchy. " human = "Generate a motivational quote on {topic}" prompt = ChatPromptTemplate.from_messages([("system", system), ("human", human)]) chain = prompt | chat response = chain.invoke({"topic": topic}) return response.content