基类:EventBaseReader
路径读取器。
从Pathway数据索引管道中检索文档。
参数:
| 名称 |
类型 |
描述 |
默认 |
host
|
str
|
|
None
|
port
|
str | int
|
|
None
|
相关链接
llamaindex.retriever.pathway.PathwayRetriever and,
llamaindex.retriever.pathway.PathwayVectorServer
workflows/handler.py 中的源代码llama_index/readers/pathway/base.py
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162 | class PathwayReader(BaseReader):
"""
Pathway reader.
Retrieve documents from Pathway data indexing pipeline.
Args:
host (str): The URI where Pathway is currently hosted.
port (str | int): The port number on which Pathway is listening.
See Also:
llamaindex.retriever.pathway.PathwayRetriever and,
llamaindex.retriever.pathway.PathwayVectorServer
"""
def __init__(
self,
host: Optional[str] = None,
port: Optional[int] = None,
url: Optional[str] = None,
):
"""Initializing the Pathway reader client."""
self.client = _VectorStoreClient(host, port, url)
def load_data(
self,
query_text: str,
k: Optional[int] = 4,
metadata_filter: Optional[str] = None,
) -> List[Document]:
"""
Load data from Pathway.
Args:
query_text (str): The text to get the closest neighbors of.
k (int): Number of results to return.
metadata_filter (str): Filter to be applied.
Returns:
List[Document]: A list of documents.
"""
results = self.client(query_text, k, metadata_filter)
documents = []
for return_elem in results:
document = Document(
text=return_elem["text"],
extra_info=return_elem["metadata"],
)
documents.append(document)
return documents
|
load_data
load_data(query_text: str, k: Optional[int] = 4, metadata_filter: Optional[str] = None) -> List[文档]
从Pathway加载数据。
参数:
| 名称 |
类型 |
描述 |
默认 |
query_text
|
str
|
|
required
|
k
|
int
|
|
4
|
metadata_filter
|
str
|
|
None
|
返回:
workflows/handler.py 中的源代码llama_index/readers/pathway/base.py
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162 | def load_data(
self,
query_text: str,
k: Optional[int] = 4,
metadata_filter: Optional[str] = None,
) -> List[Document]:
"""
Load data from Pathway.
Args:
query_text (str): The text to get the closest neighbors of.
k (int): Number of results to return.
metadata_filter (str): Filter to be applied.
Returns:
List[Document]: A list of documents.
"""
results = self.client(query_text, k, metadata_filter)
documents = []
for return_elem in results:
document = Document(
text=return_elem["text"],
extra_info=return_elem["metadata"],
)
documents.append(document)
return documents
|