Replies: 1 comment
-
你可以这样实现只返回检索出来的数据、不经过总结:
retriever = filechat_index.as_retriever(include_text=True)
results = retriever.retrieve("你的查询")
for node in results:
print(node.node.get_content()) # 或 node.text,具体看 NodeWithScore 的结构
from llama_index.core.query_engine import RetrieverQueryEngine, ResponseMode
query_engine = RetrieverQueryEngine.from_args(
retriever,
streaming=True,
response_mode=ResponseMode.NO_TEXT # 关键参数
)
res = query_engine.query("你的查询")
for chunk in res.response_gen:
print(chunk, end="") 如果 NO_TEXT 不被支持,可以直接用 retriever 的 retrieve 方法拿到原始节点数据,这样不会有任何总结或合成步骤。 参考:PropertyGraphIndex as_retriever 源码 和 RetrieverQueryEngine 源码。 To reply, just mention @dosu. How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Bug Description
这是我的代码
Version
1
Steps to Reproduce
1
Relevant Logs/Tracbacks
Beta Was this translation helpful? Give feedback.
All reactions