acecalisto3 commited on
Commit
311e709
·
verified ·
1 Parent(s): 29291bf

Update app2.py

Browse files
Files changed (1) hide show
  1. app2.py +7 -9
app2.py CHANGED
@@ -1,6 +1,7 @@
1
  import os
2
  import streamlit as st
3
  from langchain_community.utilities import GoogleSearchAPIWrapper
 
4
  from langchain.chains import ConversationChain
5
  from langchain.memory import ConversationBufferMemory
6
  import subprocess
@@ -80,15 +81,12 @@ if st.session_state.GOOGLE_API_KEY:
80
  return f"An unexpected error occurred while running the command."
81
 
82
  def get_agent_response(message: str, system_prompt: str):
83
- # Access API key from session state
84
- llm = GoogleSearchAPIWrapper(google_api_key=st.session_state.GOOGLE_API_KEY)
85
- memory = ConversationBufferMemory()
86
- conversation = ConversationChain(llm=llm, memory=memory)
87
-
88
- # Combine system prompt and user message
89
- full_prompt = f"{system_prompt}\n{message}"
90
- response = conversation.run(full_prompt)
91
- return response
92
 
93
  def display_agent_info(agent_name: str):
94
  agent = agents[agent_name]
 
1
  import os
2
  import streamlit as st
3
  from langchain_community.utilities import GoogleSearchAPIWrapper
4
+ from langchain.llms import GooglePalm
5
  from langchain.chains import ConversationChain
6
  from langchain.memory import ConversationBufferMemory
7
  import subprocess
 
81
  return f"An unexpected error occurred while running the command."
82
 
83
  def get_agent_response(message: str, system_prompt: str):
84
+ llm = GooglePalm(google_api_key=st.session_state.GOOGLE_API_KEY) # Use GooglePalm
85
+ memory = ConversationBufferMemory()
86
+ conversation = ConversationChain(llm=llm, memory=memory)
87
+ full_prompt = f"{system_prompt}\n{message}"
88
+ response = conversation.run(full_prompt)
89
+ return response
 
 
 
90
 
91
  def display_agent_info(agent_name: str):
92
  agent = agents[agent_name]