diff --git a/.env b/.env new file mode 100644 index 0000000..aafc26d --- /dev/null +++ b/.env @@ -0,0 +1,3 @@ +#groq_api_key = os.environ['GROQ_API_KEY'] + +GROQ_API_KEY=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 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4c49bd7 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.env diff --git a/README.md b/README.md index 9886249..391afc7 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +**This is a fork of Groq's demo chatbot app.** You can find it here: https://github.com/definitive-io/conversational-chatbot-groq + # Groq LangChain Conversational Chatbot This repository contains a Streamlit application that allows users to interact with a conversational chatbot powered by the LangChain API. The application uses the Groq API to generate responses and maintains a history of the conversation to provide context for the chatbot's responses. diff --git a/app.py b/app.py index 7c52f44..039f055 100644 --- a/app.py +++ b/app.py @@ -13,15 +13,18 @@ from langchain.chains.conversation.memory import ConversationBufferWindowMemory from langchain_groq import ChatGroq from langchain.prompts import PromptTemplate +from dotenv import load_dotenv +load_dotenv() def main(): """ This function is the main entry point of the application. It sets up the Groq client, the Streamlit interface, and handles the chat interaction. """ - - # Get Groq API key + groq_api_key = os.environ['GROQ_API_KEY'] + # Get Groq API key + #groq_api_key = # Display the Groq logo spacer, col = st.columns([5, 1]) @@ -37,7 +40,7 @@ def main(): system_prompt = st.sidebar.text_input("System prompt:") model = st.sidebar.selectbox( 'Choose a model', - ['llama3-8b-8192', 'mixtral-8x7b-32768', 'gemma-7b-it'] + ['llama3-70b-8192', 'llama3-8b-8192', 'mixtral-8x7b-32768', 'gemma-7b-it'] ) conversational_memory_length = st.sidebar.slider('Conversational memory length:', 1, 10, value = 5) diff --git a/requirements.txt b/requirements.txt index c749f8f..0027c9f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,4 @@ +python-dotenv aiohttp==3.9.3 aiosignal==1.3.1 altair==5.2.0