Spaces:
Build error
Build error
acecalisto3
commited on
Update app2.py
Browse files
app2.py
CHANGED
@@ -1,9 +1,11 @@
|
|
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
|
8 |
import git
|
9 |
import logging
|
@@ -81,12 +83,13 @@ if st.session_state.GOOGLE_API_KEY:
|
|
81 |
return f"An unexpected error occurred while running the command."
|
82 |
|
83 |
def get_agent_response(message: str, system_prompt: str):
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
|
|
90 |
|
91 |
def display_agent_info(agent_name: str):
|
92 |
agent = agents[agent_name]
|
|
|
1 |
import os
|
2 |
import streamlit as st
|
3 |
from langchain_community.utilities import GoogleSearchAPIWrapper
|
4 |
+
from langchain_google_genai import GoogleGenerativeAI
|
5 |
from langchain.llms import GooglePalm
|
6 |
from langchain.chains import ConversationChain
|
7 |
from langchain.memory import ConversationBufferMemory
|
8 |
+
|
9 |
import subprocess
|
10 |
import git
|
11 |
import logging
|
|
|
83 |
return f"An unexpected error occurred while running the command."
|
84 |
|
85 |
def get_agent_response(message: str, system_prompt: str):
|
86 |
+
llm = GoogleGenerativeAI(google_api_key=st.session_state.GOOGLE_API_KEY) # Use GoogleGenerativeAI
|
87 |
+
memory = ConversationBufferMemory()
|
88 |
+
conversation = ConversationChain(llm=llm, memory=memory)
|
89 |
+
full_prompt = f"{system_prompt}\n{message}"
|
90 |
+
response = conversation.run(full_prompt)
|
91 |
+
return response
|
92 |
+
|
93 |
|
94 |
def display_agent_info(agent_name: str):
|
95 |
agent = agents[agent_name]
|