Spaces:
Sleeping
Sleeping
Commit
·
45a81b0
1
Parent(s):
dfe66cd
correct search in data indexing
Browse files
app_stream_rag/app/data_indexing.py
CHANGED
@@ -135,7 +135,10 @@ class DataIndexer:
|
|
135 |
docs = []
|
136 |
for res in result["matches"]:
|
137 |
# From the result's metadata, extract the "text" element.
|
138 |
-
|
|
|
|
|
|
|
139 |
|
140 |
return docs
|
141 |
|
|
|
135 |
docs = []
|
136 |
for res in result["matches"]:
|
137 |
# From the result's metadata, extract the "text" element.
|
138 |
+
metadata = res['metadata']
|
139 |
+
if 'text' in metadata:
|
140 |
+
text = metadata.pop('text')
|
141 |
+
docs.append(text)
|
142 |
|
143 |
return docs
|
144 |
|
app_stream_rag/test.py
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
from langserve import RemoteRunnable
|
2 |
# Hit our enpoint with specified rout
|
3 |
# If we put /simple/stream, it complains; because chain.stream will hit /simple/stream endpoint
|
4 |
-
url = "https://simafarazi-backend-c.hf.space/
|
5 |
chain = RemoteRunnable(url) #Client for iteracting with LangChain runnables that are hosted as LangServe endpoints
|
6 |
-
stream = chain.stream(input={"question":"
|
7 |
"username": "Sima"}) # .stream() and .invoke() are standard methods to interact with hosted runnables
|
8 |
|
9 |
|
|
|
1 |
from langserve import RemoteRunnable
|
2 |
# Hit our enpoint with specified rout
|
3 |
# If we put /simple/stream, it complains; because chain.stream will hit /simple/stream endpoint
|
4 |
+
url = "https://simafarazi-backend-c.hf.space/rag"
|
5 |
chain = RemoteRunnable(url) #Client for iteracting with LangChain runnables that are hosted as LangServe endpoints
|
6 |
+
stream = chain.stream(input={"question":"Where do you recommend me for a 7 days hike in europe during April?",
|
7 |
"username": "Sima"}) # .stream() and .invoke() are standard methods to interact with hosted runnables
|
8 |
|
9 |
|