Spaces:
Sleeping
Sleeping
tejoess
commited on
Commit
·
368dfa9
1
Parent(s):
3f4d130
Updated app.py
Browse files
app.py
CHANGED
|
@@ -13,7 +13,7 @@ def init_llm():
|
|
| 13 |
return ChatOpenAI(
|
| 14 |
model="gpt-4o-mini",
|
| 15 |
temperature=0.1,
|
| 16 |
-
max_tokens=
|
| 17 |
)
|
| 18 |
|
| 19 |
# Initialize chat history
|
|
@@ -21,7 +21,7 @@ if "messages" not in st.session_state:
|
|
| 21 |
st.session_state.messages = []
|
| 22 |
|
| 23 |
# Streamlit UI
|
| 24 |
-
st.title("🤖 Simple Chatbot")
|
| 25 |
st.write("Ask me anything and I'll give you a short, simple answer!")
|
| 26 |
|
| 27 |
# Display chat history
|
|
@@ -77,6 +77,7 @@ if prompt := st.chat_input("What would you like to know?"):
|
|
| 77 |
st.session_state.messages.append({"role": "assistant", "content": error_msg})
|
| 78 |
|
| 79 |
# Sidebar with clear chat button
|
|
|
|
| 80 |
with st.sidebar:
|
| 81 |
st.header("Chat Controls")
|
| 82 |
if st.button("Clear Chat History"):
|
|
@@ -87,4 +88,5 @@ with st.sidebar:
|
|
| 87 |
st.markdown("**Instructions:**")
|
| 88 |
st.markdown("1. Make sure you have your OpenAI API key in a `.env` file")
|
| 89 |
st.markdown("2. The format should be: `OPENAI_API_KEY=your_api_key_here`")
|
| 90 |
-
st.markdown("3. Install required packages: `pip install streamlit langchain-openai python-dotenv`")
|
|
|
|
|
|
| 13 |
return ChatOpenAI(
|
| 14 |
model="gpt-4o-mini",
|
| 15 |
temperature=0.1,
|
| 16 |
+
max_tokens=300 # Increased for better context explanations
|
| 17 |
)
|
| 18 |
|
| 19 |
# Initialize chat history
|
|
|
|
| 21 |
st.session_state.messages = []
|
| 22 |
|
| 23 |
# Streamlit UI
|
| 24 |
+
st.title("🤖 Simple Chatbot using openai")
|
| 25 |
st.write("Ask me anything and I'll give you a short, simple answer!")
|
| 26 |
|
| 27 |
# Display chat history
|
|
|
|
| 77 |
st.session_state.messages.append({"role": "assistant", "content": error_msg})
|
| 78 |
|
| 79 |
# Sidebar with clear chat button
|
| 80 |
+
"""
|
| 81 |
with st.sidebar:
|
| 82 |
st.header("Chat Controls")
|
| 83 |
if st.button("Clear Chat History"):
|
|
|
|
| 88 |
st.markdown("**Instructions:**")
|
| 89 |
st.markdown("1. Make sure you have your OpenAI API key in a `.env` file")
|
| 90 |
st.markdown("2. The format should be: `OPENAI_API_KEY=your_api_key_here`")
|
| 91 |
+
st.markdown("3. Install required packages: `pip install streamlit langchain-openai python-dotenv`")
|
| 92 |
+
"""
|