hail75 commited on
Commit
f16688d
·
1 Parent(s): 8b3c6d8

create simple chat bot

Browse files
Files changed (2) hide show
  1. app.py +23 -2
  2. requirements.txt +1 -1
app.py CHANGED
@@ -1,7 +1,28 @@
1
  import os
2
 
3
  import streamlit as st
4
- from langchain.llms import openai
 
5
 
6
  st.title("Chat with your data")
7
- promt = st.text_area("Enter your prompt here", "What is the capital of France?")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import os
2
 
3
  import streamlit as st
4
+ from langchain_openai import OpenAI
5
+ from langchain_core.prompts import ChatPromptTemplate
6
 
7
  st.title("Chat with your data")
8
+
9
+ inp = st.text_input("Enter your prompt here")
10
+
11
+ llm = OpenAI(api_key=os.environ.get("OPENAI_API_KEY"), temperature=0.2)
12
+
13
+ # prompt = ChatPromptTemplate.from_messages(
14
+ # [
15
+ # (
16
+ # "system",
17
+ # "You are a helpful assistant that answer questions from user.",
18
+ # ),
19
+ # ("human", "{input}"),
20
+ # ]
21
+ # )
22
+
23
+ chain = llm
24
+ if inp:
25
+ response = chain.invoke(input=inp)
26
+ st.write(response)
27
+
28
+
requirements.txt CHANGED
@@ -1,2 +1,2 @@
1
  langchain
2
- langchain_community
 
1
  langchain
2
+ langchain_openai