Spaces:
Runtime error
Runtime error
Asif Islam
commited on
Commit
•
b90ea9a
1
Parent(s):
ea5a1cb
Added warnign
Browse files- app.py +3 -3
- requirements.txt +1 -2
app.py
CHANGED
@@ -13,7 +13,6 @@ from langchain.embeddings import OpenAIEmbeddings
|
|
13 |
from langchain.vectorstores import Chroma
|
14 |
import gradio as gr
|
15 |
|
16 |
-
|
17 |
# LLM
|
18 |
llm = ChatOpenAI()
|
19 |
|
@@ -26,17 +25,18 @@ from langchain.text_splitter import RecursiveCharacterTextSplitter
|
|
26 |
|
27 |
text_splitter = RecursiveCharacterTextSplitter(chunk_size=500, chunk_overlap=0)
|
28 |
all_splits = text_splitter.split_documents(data)
|
|
|
29 |
vectorstore = Chroma.from_documents(documents=all_splits, embedding=OpenAIEmbeddings(), persist_directory='persist')
|
30 |
|
31 |
# Prompt
|
32 |
prompt = ChatPromptTemplate(
|
33 |
messages=[
|
34 |
SystemMessagePromptTemplate.from_template(
|
35 |
-
"You are a nice chatbot having a conversation with a human about UF student government and its 800 codes which are about the budget and student org funding. Please reference context first when trying to respond to queries."
|
36 |
),
|
37 |
# The `variable_name` here is what must align with memory
|
38 |
MessagesPlaceholder(variable_name="chat_history"),
|
39 |
-
HumanMessagePromptTemplate.from_template("{question}")
|
40 |
]
|
41 |
)
|
42 |
|
|
|
13 |
from langchain.vectorstores import Chroma
|
14 |
import gradio as gr
|
15 |
|
|
|
16 |
# LLM
|
17 |
llm = ChatOpenAI()
|
18 |
|
|
|
25 |
|
26 |
text_splitter = RecursiveCharacterTextSplitter(chunk_size=500, chunk_overlap=0)
|
27 |
all_splits = text_splitter.split_documents(data)
|
28 |
+
# persist data into SQLite DB
|
29 |
vectorstore = Chroma.from_documents(documents=all_splits, embedding=OpenAIEmbeddings(), persist_directory='persist')
|
30 |
|
31 |
# Prompt
|
32 |
prompt = ChatPromptTemplate(
|
33 |
messages=[
|
34 |
SystemMessagePromptTemplate.from_template(
|
35 |
+
"You are a nice chatbot having a conversation with a human about UF student government and its 800 codes which are about the budget and student org funding. Please reference context first when trying to respond to queries and try to site sources."
|
36 |
),
|
37 |
# The `variable_name` here is what must align with memory
|
38 |
MessagesPlaceholder(variable_name="chat_history"),
|
39 |
+
HumanMessagePromptTemplate.from_template("{question}"),
|
40 |
]
|
41 |
)
|
42 |
|
requirements.txt
CHANGED
@@ -3,5 +3,4 @@ unstructured
|
|
3 |
langchain
|
4 |
chromadb
|
5 |
gradio
|
6 |
-
tiktoken
|
7 |
-
pdfminer
|
|
|
3 |
langchain
|
4 |
chromadb
|
5 |
gradio
|
6 |
+
tiktoken
|
|