Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 695b72e

Browse files
committed
Tag bot.py, add requirements.txt
1 parent f247be2 commit 695b72e

File tree

4 files changed

+53
-11
lines changed

4 files changed

+53
-11
lines changed

bot.py

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import streamlit as st
22
from utils import write_message
33

4+
# tag::setup[]
45
# Page Config
56
st.set_page_config("Ebert", page_icon=":movie_camera:")
67

@@ -9,7 +10,9 @@
910
st.session_state.messages = [
1011
{"role": "assistant", "content": "Hi, I'm the GraphAcademy Chatbot! How can I help you?"},
1112
]
13+
# end::setup[]
1214

15+
# tag::submit[]
1316
# Submit handler
1417
def handle_submit(message):
1518
"""
@@ -22,18 +25,13 @@ def handle_submit(message):
2225
# Handle the response
2326
with st.spinner('Thinking...'):
2427
# # TODO: Replace this with a call to your LLM
25-
# from time import sleep
26-
# sleep(1)
27-
# write_message('assistant', message)
28-
29-
# from handlers.vector import generate_response
30-
# from handlers.cypher import generate_response
31-
from handlers.agent import generate_response
32-
33-
response = generate_response(message)
34-
write_message('assistant', response)
28+
from time import sleep
29+
sleep(1)
30+
write_message('assistant', message)
31+
# end::submit[]
3532

3633

34+
# tag::chat[]
3735
with st.container():
3836
# Display messages in Session State
3937
for message in st.session_state.messages:
@@ -46,3 +44,4 @@ def handle_submit(message):
4644

4745
# Generate a response
4846
handle_submit(prompt)
47+
# end::chat[]

helloworld/app.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import streamlit as st
2+
3+
st.set_page_config(
4+
page_title="Hello",
5+
page_icon="👋",
6+
)
7+
8+
st.write("# Welcome to Streamlit! 👋")
9+
10+
st.markdown("""
11+
This component supports **markdown formatting**.
12+
13+
[Check out their documentation](https://docs.streamlit.io) for more information on how to get started.
14+
""")
15+
16+
st.write('updated')

prompts.py

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
)
77

88

9+
# Basic Prompt
910
BASIC_PROMPT = PromptTemplate.from_template("""
1011
You are a movie expert providing customers with movie recommendations.
1112
Answer the following question to the best of your ability.
@@ -14,7 +15,30 @@
1415
Answer:
1516
""")
1617

18+
# RAG Vector Prompts
19+
GENERAL_SYSTEM_TEMPLATE = """
20+
You are a movie expert providing customers with movie recommendations.
21+
Answer the following question to the best of your ability.
22+
Use the following pieces of context to answer the user's question.
23+
24+
Make sure to rely on information from the answers and not on questions to provide accuate responses.
25+
26+
----
27+
{summaries}
28+
----
29+
30+
"""
31+
32+
GENERAL_USER_TEMPLATE = """
33+
Question:
34+
35+
---
36+
{question}
37+
---
38+
"""
39+
1740

41+
# Cypher Prompts
1842
CYPHER_QA_PROMPT = SystemMessagePromptTemplate.from_template("""
1943
You are a movie expert providing customers with information about movies.
2044
Answer the following question to the best of your ability.
@@ -65,4 +89,4 @@
6589
Use Neo4j 5 Cypher syntax. When checking a property is not null, use `IS NOT NULL`.
6690
6791
Question: {question}
68-
"""
92+
"""

requirements.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
langchain==0.0.329
2+
neo4j-driver==5.12.0
3+
streamlit==1.28.1

0 commit comments

Comments
 (0)