File size: 817 Bytes
76f5c58
 
 
 
 
83c03fb
76f5c58
9630547
76f5c58
bbb1f3c
6a0c258
76f5c58
 
230873b
06b73bb
76f5c58
 
 
 
00062b4
 
76f5c58
230873b
00062b4
 
76f5c58
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
from langchain_openai import ChatOpenAI
from langchain_core.prompts import ChatPromptTemplate
import streamlit as st
import os

openai_api_k = os.getenv("openai_api")

llm = ChatOpenAI(temperature=0, model="gpt-3.5-turbo",openai_api_key=openai_api_k,max_tokens=150)
prompt = ChatPromptTemplate.from_messages([
    ("system", "You are so good in writing emails.You are a helpful assistant that gives a reply email for a particular email"),
    ("human", "give a neat and proper reply email\n{input}")
])



st.title("Email Reply Generator")
st.write("Enter the email text you want a reply for:")


email_input = st.text_area("Email Text")

if st.button("Generate Reply"):
    chain = prompt | llm
    response = chain.invoke({"input": email_input})
    st.write("Generated Email Reply:")
    st.write(response.content)