Spaces:
Running
Running
Nik Fedorov
commited on
Commit
Β·
c7cf5ac
1
Parent(s):
02d7651
feat: improve prompt and update vectorstore
Browse files- app.py +10 -11
- vectorstore/{52cf6466-c585-436a-8047-fdd44e17950b β 1f3b3422-1ab2-4f97-bad6-bc5af0b3f4fd}/data_level0.bin +2 -2
- vectorstore/{52cf6466-c585-436a-8047-fdd44e17950b β 1f3b3422-1ab2-4f97-bad6-bc5af0b3f4fd}/header.bin +1 -1
- vectorstore/{52cf6466-c585-436a-8047-fdd44e17950b β 1f3b3422-1ab2-4f97-bad6-bc5af0b3f4fd}/index_metadata.pickle +2 -2
- vectorstore/{52cf6466-c585-436a-8047-fdd44e17950b β 1f3b3422-1ab2-4f97-bad6-bc5af0b3f4fd}/length.bin +2 -2
- vectorstore/{52cf6466-c585-436a-8047-fdd44e17950b β 1f3b3422-1ab2-4f97-bad6-bc5af0b3f4fd}/link_lists.bin +2 -2
- vectorstore/chroma.sqlite3 +2 -2
app.py
CHANGED
|
@@ -13,22 +13,21 @@ vectorstore = Chroma(
|
|
| 13 |
)
|
| 14 |
|
| 15 |
# arrange search template
|
| 16 |
-
template = """
|
| 17 |
-
|
| 18 |
-
If
|
| 19 |
-
|
| 20 |
-
|
| 21 |
|
| 22 |
-
|
|
|
|
|
|
|
| 23 |
|
| 24 |
-
|
| 25 |
-
Answer:"""
|
| 26 |
-
|
| 27 |
-
# run script if quesry is set
|
| 28 |
if query:
|
| 29 |
|
| 30 |
# search vectorstores
|
| 31 |
-
docs = vectorstore.similarity_search(query,
|
| 32 |
|
| 33 |
# arrange context string
|
| 34 |
context = '';
|
|
|
|
| 13 |
)
|
| 14 |
|
| 15 |
# arrange search template
|
| 16 |
+
template = """As a doctor's assistant, when presented with a user's medical query and specific website context, generate consolidated guidance directing them to pertinent website links.
|
| 17 |
+
If multiple context chunks are similar, combine them into a single suggestion, citing all relevant sources using hyperlinked text in the format <a href="SOURCE_HERE">description</a>.
|
| 18 |
+
If the context doesn't directly address the query, state the absence of a direct match and provide the closest matching guidance.
|
| 19 |
+
Always adhere strictly to the provided context and maintain terminology consistency.
|
| 20 |
+
Don't mention the word "context" in your answer. Pretend that you're answering the user directly.
|
| 21 |
|
| 22 |
+
Query: {question}
|
| 23 |
+
Context:
|
| 24 |
+
{context}"""
|
| 25 |
|
| 26 |
+
# run script if query is set
|
|
|
|
|
|
|
|
|
|
| 27 |
if query:
|
| 28 |
|
| 29 |
# search vectorstores
|
| 30 |
+
docs = vectorstore.similarity_search(query, 6)
|
| 31 |
|
| 32 |
# arrange context string
|
| 33 |
context = '';
|
vectorstore/{52cf6466-c585-436a-8047-fdd44e17950b β 1f3b3422-1ab2-4f97-bad6-bc5af0b3f4fd}/data_level0.bin
RENAMED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:0066f1798e9bbe3a2a5a87d2c16b9f2ea1c0412682cebe138b73710ac08b65ab
|
| 3 |
+
size 18436000
|
vectorstore/{52cf6466-c585-436a-8047-fdd44e17950b β 1f3b3422-1ab2-4f97-bad6-bc5af0b3f4fd}/header.bin
RENAMED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 100
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:1e8924c1bef2e9b21521083efed68904f0074b978a6d12f47937a4fcdc4e7bbc
|
| 3 |
size 100
|
vectorstore/{52cf6466-c585-436a-8047-fdd44e17950b β 1f3b3422-1ab2-4f97-bad6-bc5af0b3f4fd}/index_metadata.pickle
RENAMED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:9422eed03e670d6cae3e20752e3bf56f024385c12d658cbc04b763566cc3ca38
|
| 3 |
+
size 636115
|
vectorstore/{52cf6466-c585-436a-8047-fdd44e17950b β 1f3b3422-1ab2-4f97-bad6-bc5af0b3f4fd}/length.bin
RENAMED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:897aead7fc1c8504cd2f5e6521abe81e8db3523750a12797e7c1660c1b6fe635
|
| 3 |
+
size 44000
|
vectorstore/{52cf6466-c585-436a-8047-fdd44e17950b β 1f3b3422-1ab2-4f97-bad6-bc5af0b3f4fd}/link_lists.bin
RENAMED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:8b61aa11ea1d332db693ec78a4e04d4b522d5d7380cebd5570daf7daf794d4ae
|
| 3 |
+
size 97380
|
vectorstore/chroma.sqlite3
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:49ff7a7d0500cc02a1dc9882f38e567509122c40c1e8ef14f034d5db0fe52659
|
| 3 |
+
size 35893248
|