Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
llm-bootcamp-projects
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zaid
llm-bootcamp-projects
Commits
abfef4d5
Commit
abfef4d5
authored
Oct 12, 2023
by
Hyder
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added requirements
parent
929dee7d
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
40 additions
and
16 deletions
+40
-16
1_Basic_Chatbot.py
Final-Project/Pages/1_Basic_Chatbot.py
+8
-4
2_Chatbot_Agent.py
Final-Project/Pages/2_Chatbot_Agent.py
+9
-5
3_Chat_with_your_Data.py
Final-Project/Pages/3_Chat_with_your_Data.py
+10
-7
streaming.cpython-310.pyc
Final-Project/__pycache__/streaming.cpython-310.pyc
+0
-0
utils.cpython-310.pyc
Final-Project/__pycache__/utils.cpython-310.pyc
+0
-0
requirements.txt
Final-Project/requirements.txt
+13
-0
2023_GPT4All_Technical_Report.pdf
Final-Project/tmp/2023_GPT4All_Technical_Report.pdf
+0
-0
No files found.
Final-Project/Pages/1_Basic_Chatbot.py
View file @
abfef4d5
...
...
@@ -29,10 +29,14 @@ class Basic:
if
user_query
:
utils
.
display_msg
(
user_query
,
'user'
)
with
st
.
chat_message
(
"assistant"
):
st_cb
=
StreamHandler
(
st
.
empty
())
response
=
chain
.
run
(
user_query
,
callbacks
=
[
st_cb
])
st
.
session_state
.
messages
.
append
(
{
"role"
:
"assistant"
,
"content"
:
response
})
try
:
st_cb
=
StreamHandler
(
st
.
empty
())
response
=
chain
.
run
(
user_query
,
callbacks
=
[
st_cb
])
st
.
session_state
.
messages
.
append
(
{
"role"
:
"assistant"
,
"content"
:
response
})
except
Exception
as
e
:
print
(
e
)
if
__name__
==
"__main__"
:
...
...
Final-Project/Pages/2_Chatbot_Agent.py
View file @
abfef4d5
...
...
@@ -47,11 +47,15 @@ class ChatbotTools:
if
user_query
:
utils
.
display_msg
(
user_query
,
'user'
)
with
st
.
chat_message
(
"assistant"
):
st_cb
=
StreamlitCallbackHandler
(
st
.
container
())
response
=
agent
.
run
(
user_query
,
callbacks
=
[
st_cb
])
st
.
session_state
.
messages
.
append
(
{
"role"
:
"assistant"
,
"content"
:
response
})
st
.
write
(
response
)
try
:
st_cb
=
StreamlitCallbackHandler
(
st
.
container
())
response
=
agent
.
run
(
user_query
,
callbacks
=
[
st_cb
])
st
.
session_state
.
messages
.
append
(
{
"role"
:
"assistant"
,
"content"
:
response
})
st
.
write
(
response
)
except
Exception
as
e
:
print
(
e
)
if
__name__
==
"__main__"
:
...
...
Final-Project/Pages/3_Chat_with_your_Data.py
View file @
abfef4d5
...
...
@@ -8,7 +8,7 @@ from langchain.document_loaders import PyPDFLoader
from
langchain.memory
import
ConversationBufferMemory
from
langchain.chains
import
ConversationalRetrievalChain
from
langchain.embeddings
import
OpenAIEmbeddings
from
langchain.vectorstores
import
Chroma
from
langchain.vectorstores
import
FAISS
from
langchain.text_splitter
import
RecursiveCharacterTextSplitter
st
.
set_page_config
(
page_title
=
"ChatPDF"
,
page_icon
=
"📄"
)
...
...
@@ -51,7 +51,7 @@ class CustomDataChatbot:
# Create embeddings and store in vectordb
embeddings
=
OpenAIEmbeddings
()
vectordb
=
Chroma
.
from_documents
(
splits
,
embeddings
)
vectordb
=
FAISS
.
from_documents
(
splits
,
embeddings
)
# Define retriever
retriever
=
vectordb
.
as_retriever
()
...
...
@@ -84,12 +84,15 @@ class CustomDataChatbot:
qa_chain
=
self
.
setup_qa_chain
(
uploaded_files
)
utils
.
display_msg
(
user_query
,
'user'
)
with
st
.
chat_message
(
"assistant"
):
st_cb
=
StreamHandler
(
st
.
empty
())
response
=
qa_chain
.
run
(
user_query
,
callbacks
=
[
st_cb
])
st
.
session_state
.
messages
.
append
(
{
"role"
:
"assistant"
,
"content"
:
response
})
try
:
st_cb
=
StreamHandler
(
st
.
empty
())
response
=
qa_chain
.
run
(
user_query
,
callbacks
=
[
st_cb
])
st
.
session_state
.
messages
.
append
(
{
"role"
:
"assistant"
,
"content"
:
response
})
except
Exception
as
e
:
print
(
e
)
if
__name__
==
"__main__"
:
...
...
Final-Project/__pycache__/streaming.cpython-310.pyc
View file @
abfef4d5
No preview for this file type
Final-Project/__pycache__/utils.cpython-310.pyc
View file @
abfef4d5
No preview for this file type
Final-Project/requirements.txt
0 → 100644
View file @
abfef4d5
langchain==0.0.312
PyPDF2==3.0.1
python-dotenv==1.0.0
streamlit==1.27.2
openai==0.27.6
altair==4
Pillow==9.5.0
tiktoken==0.5.1
duckduckgo-search==3.9.3
pypdf==3.16.4
faiss-cpu==1.7.4
chromadb
\ No newline at end of file
Final-Project/tmp/2023_GPT4All_Technical_Report.pdf
0 → 100644
View file @
abfef4d5
File added
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment