Spaces:
Build error
Build error
added template
Browse files
app.py
CHANGED
@@ -15,6 +15,8 @@ from langchain.vectorstores import Chroma
|
|
15 |
|
16 |
from langchain.chains import RetrievalQA
|
17 |
|
|
|
|
|
18 |
#web_links = ["https://www.databricks.com/","https://help.databricks.com","https://docs.databricks.com","https://kb.databricks.com/","http://docs.databricks.com/getting-started/index.html","http://docs.databricks.com/introduction/index.html","http://docs.databricks.com/getting-started/tutorials/index.html","http://docs.databricks.com/machine-learning/index.html","http://docs.databricks.com/sql/index.html"]
|
19 |
#loader = WebBaseLoader(web_links)
|
20 |
#documents = loader.load()
|
@@ -40,9 +42,37 @@ def bot(history):
|
|
40 |
|
41 |
def infer(question):
|
42 |
|
43 |
-
query = question
|
44 |
-
result = qa({"query": query})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
|
|
|
|
|
46 |
return result
|
47 |
|
48 |
css="""
|
|
|
15 |
|
16 |
from langchain.chains import RetrievalQA
|
17 |
|
18 |
+
from langchain.prompts import ChatPromptTemplate
|
19 |
+
|
20 |
#web_links = ["https://www.databricks.com/","https://help.databricks.com","https://docs.databricks.com","https://kb.databricks.com/","http://docs.databricks.com/getting-started/index.html","http://docs.databricks.com/introduction/index.html","http://docs.databricks.com/getting-started/tutorials/index.html","http://docs.databricks.com/machine-learning/index.html","http://docs.databricks.com/sql/index.html"]
|
21 |
#loader = WebBaseLoader(web_links)
|
22 |
#documents = loader.load()
|
|
|
42 |
|
43 |
def infer(question):
|
44 |
|
45 |
+
#query = question
|
46 |
+
#result = qa({"query": query})
|
47 |
+
chat_template = ChatPromptTemplate.from_messages(
|
48 |
+
[
|
49 |
+
("system", "You are a helpful Doc AI bot. Your name is {name}."),
|
50 |
+
("human", "Hello, how can I install RAY?"),
|
51 |
+
("ai", "To install Ray, you can use pip: \
|
52 |
+
pip install ray Or, if you want to install a specific version of Ray, you can use: \
|
53 |
+
\
|
54 |
+
pip install -U 'ray[version]' \
|
55 |
+
\
|
56 |
+
Where [version] is the version you want to install. \
|
57 |
+
If you are on Arch Linux, you can install Ray from the Arch User Repository (AUR) using an AUR helper like yay: \
|
58 |
+
\
|
59 |
+
yay -S python-ray \
|
60 |
+
\
|
61 |
+
You can also manually install the package by following the instructions on the Arch Wiki. \
|
62 |
+
\
|
63 |
+
Sources: \
|
64 |
+
\
|
65 |
+
https://docs.ray.io/en/master/ray-core/examples/gentle_walkthrough.html#install-ray \
|
66 |
+
https://docs.ray.io/en/master/ray-more-libs/installation.html#installing-ray-on-arch-linux \
|
67 |
+
https://docs.ray.io/en/master/ray-overview/installation.html#installing-ray-on-arch-linux \
|
68 |
+
https://docs.ray.io/en/master/installation.html#installing-ray-on-arch-linux \
|
69 |
+
https://docs.ray.io/en/master/installation.html#from-wheels)",
|
70 |
+
("human", "{user_input}"),
|
71 |
+
]
|
72 |
+
)
|
73 |
|
74 |
+
message = chat_template.format_messages(name="RAYDOC", user_input=question)
|
75 |
+
result = qa({"query": message})
|
76 |
return result
|
77 |
|
78 |
css="""
|