venkatcharan commited on
Commit
e62af2a
·
verified ·
1 Parent(s): dc04c58

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -6
app.py CHANGED
@@ -12,7 +12,7 @@ genai_key = os.getenv("gen_key")
12
  model = ChatGoogleGenerativeAI(temperature=0,model='gemini-1.5-pro',max_output_tokens=150,convert_system_message_to_human=True,google_api_key=genai_key)
13
 
14
  prompt=ChatPromptTemplate.from_messages([
15
- ("system","you are a good assistant"),
16
  MessagesPlaceholder(variable_name="history"),
17
  ("human","{input}")])
18
 
@@ -28,12 +28,11 @@ st.write("Enter your input text:")
28
 
29
 
30
  def end_conv():
31
- st.write("Conversation ended.")
32
- st.session_state.conversation_history = []
33
 
34
  # Initialize session state for conversation history if not already done
35
- if 'conversation_history' not in st.session_state:
36
- st.session_state.conversation_history = []
37
 
38
  # User input
39
  user_input = st.text_area("Input Text")
@@ -51,7 +50,7 @@ if st.button("Generate Response"):
51
 
52
  # Save the context in memory and session state
53
  memory.save_context({"input": user_input}, {"output": response_content})
54
- st.session_state.conversation_history.extend([{"role": "human", "content": user_input}, {"role": "assistant", "content": response_content}])
55
 
56
  # Display the updated conversation history
57
  #st.write("Conversation History:")
 
12
  model = ChatGoogleGenerativeAI(temperature=0,model='gemini-1.5-pro',max_output_tokens=150,convert_system_message_to_human=True,google_api_key=genai_key)
13
 
14
  prompt=ChatPromptTemplate.from_messages([
15
+ ("system","you are a good assistant that give information about mentioned topic."),
16
  MessagesPlaceholder(variable_name="history"),
17
  ("human","{input}")])
18
 
 
28
 
29
 
30
  def end_conv():
31
+ st.write("Conversation ended.")
32
+
33
 
34
  # Initialize session state for conversation history if not already done
35
+
 
36
 
37
  # User input
38
  user_input = st.text_area("Input Text")
 
50
 
51
  # Save the context in memory and session state
52
  memory.save_context({"input": user_input}, {"output": response_content})
53
+
54
 
55
  # Display the updated conversation history
56
  #st.write("Conversation History:")