chat_engine = index.as_chat_engine(chat_mode='condense_plus_context', use_async=True, system_prompt=SYSTEM_PROMPT,)返回的内容太长了,我该如何让它只返回前1或2个匹配项?
oxf4rvwz1#
已经是默认的前两名了?
kqqjbcuj2#
它已经是默认的前两名了?👀但是通过verbose=True,我看到了8个匹配的结果(跟随file_path: / / )
dl5txlt93#
啊。我猜我以为你使用了向量索引,但你创建了哪种索引?
v1uwarro4#
我猜我假设你使用了向量索引,但是你创建了哪种索引?DocumentSummaryIndex这是我如何使用它的:storage_context = StorageContext.from_defaults(persist_dir=persist_dir)index = load_index_from_storage(storage_context)
disbfnqx5#
我猜我假设你使用了向量索引,但是你创建了哪种索引?DocumentSummaryIndex这是我如何使用它的:storage_context = StorageContext.from_defaults(persist_dir=persist_dir) index = load_index_from_storage(storage_context)这是我如何创建索引的:splitter = SentenceSplitter(chunk_size=1024)response_synthesizer = get_response_synthesizer(response_mode="tree_summarize", use_async=True)doc_summary_index = DocumentSummaryIndex.from_documents(docs,llm=OurLLM(), #自定义本地模型transformations=[splitter],response_synthesizer=response_synthesizer,show_progress=True,)doc_summary_index.storage_context.persist(persist_dir)
gzszwxb46#
@yuyu990116 文档摘要索引通过生成文档摘要来工作,并使用这些摘要来决定将哪些文档发送给LLM。这将把与所选文档相关的所有节点发送到LLM。实际上没有方法限制使用此索引发送的节点数量,因为它会从所选文档中提取所有节点。
6条答案
按热度按时间oxf4rvwz1#
已经是默认的前两名了?
kqqjbcuj2#
它已经是默认的前两名了?👀
但是通过verbose=True,我看到了8个匹配的结果(跟随file_path: / / )
dl5txlt93#
啊。我猜我以为你使用了向量索引,但你创建了哪种索引?
v1uwarro4#
我猜我假设你使用了向量索引,但是你创建了哪种索引?
DocumentSummaryIndex
这是我如何使用它的:
storage_context = StorageContext.from_defaults(persist_dir=persist_dir)
index = load_index_from_storage(storage_context)
disbfnqx5#
我猜我假设你使用了向量索引,但是你创建了哪种索引?
DocumentSummaryIndex
这是我如何使用它的:storage_context = StorageContext.from_defaults(persist_dir=persist_dir) index = load_index_from_storage(storage_context)
这是我如何创建索引的:
splitter = SentenceSplitter(chunk_size=1024)
response_synthesizer = get_response_synthesizer(
response_mode="tree_summarize", use_async=True
)
doc_summary_index = DocumentSummaryIndex.from_documents(
docs,
llm=OurLLM(), #自定义本地模型
transformations=[splitter],
response_synthesizer=response_synthesizer,
show_progress=True,
)
doc_summary_index.storage_context.persist(persist_dir)
gzszwxb46#
@yuyu990116 文档摘要索引通过生成文档摘要来工作,并使用这些摘要来决定将哪些文档发送给LLM。
这将把与所选文档相关的所有节点发送到LLM。
实际上没有方法限制使用此索引发送的节点数量,因为它会从所选文档中提取所有节点。