diff --git a/app.py b/app.py index cc8ad5f..85d9b41 100644 --- a/app.py +++ b/app.py @@ -1,14 +1,13 @@ # Import the Streamlit library import streamlit as st -import sys -import os - import asyncio +#from metadata_chatbot.agents.GAMER import GAMER +import uuid -sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), 'src'))) - +import sys +import os +sys.path.insert(0, os.path.abspath('./src')) from metadata_chatbot.agents.GAMER import GAMER -import uuid #run on terminal with streamlit run c:/Users/sreya.kumar/Documents/GitHub/metadata-chatbot/app.py [ARGUMENTS] @@ -17,9 +16,9 @@ async def main(): llm = GAMER() unique_id = str(uuid.uuid4()) - + message = st.chat_message("assistant") - message.write("Hello!") + message.write("Hello! How can I help you?") prompt = st.chat_input("Ask a question about the AIND Metadata!") diff --git a/src/metadata_chatbot/agents/GAMER.py b/src/metadata_chatbot/agents/GAMER.py index 364ad25..b4f464a 100644 --- a/src/metadata_chatbot/agents/GAMER.py +++ b/src/metadata_chatbot/agents/GAMER.py @@ -16,8 +16,6 @@ from langchain.callbacks.manager import AsyncCallbackManager, CallbackManagerForLLMRun import streamlit as st - - class GAMER(LLM): def _call( @@ -103,14 +101,7 @@ async def streamlit_astream( """ Asynchronous call. """ - - config = {"configurable":{"thread_id": unique_id}} - inputs = { - "messages": [HumanMessage(query)], - } - async def main(query: str): - - unique_id = str(uuid.uuid4()) + async def main(query:str): config = {"configurable":{"thread_id": unique_id}} inputs = { "messages": [HumanMessage(query)], @@ -121,6 +112,7 @@ async def main(query: str): yield value['messages'][0].content else: yield value['generation'] + curr = None generation = None