public abstract class AbstractToolRetriever extends Object implements ToolRetriever
| Modifier and Type | Field and Description |
|---|---|
protected ToolProvider |
toolProvider
储存工具类相关信息;
|
protected Vector |
vector
向量检索库
|
protected VectorStoreConfig |
vectorStoreConfig |
| Constructor and Description |
|---|
AbstractToolRetriever(ToolProvider toolProvider,
VectorStoreConfig vectorStoreConfig) |
| Modifier and Type | Method and Description |
|---|---|
void |
addToolsFromMetadata(List<ToolMetadata> toolMetadataList)
工具入库
|
Function<List<ConversationMessage>,String> |
getQueryPreprocessor()
获取query请求的预处理器
|
void |
remove(List<String> toolIds)
删除工具
|
List<Tool> |
search(String query)
工具检索
|
List<Tool> |
search(String query,
int topK)
工具检索
|
List<Tool> |
search(String query,
int topK,
float scoreThreshold)
工具检索
|
void |
setQueryPreprocessor(Function<List<ConversationMessage>,String> preprocessor)
设置query请求的预处理器,
当ToolRetriever被设置在Agent中时,Agent在Retrieve工具前,先会调用query预处理器对多轮对话进行改写,
如果不设置,默认使用多轮中的最后一轮对话
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaddTools, searchprotected final VectorStoreConfig vectorStoreConfig
protected final ToolProvider toolProvider
protected Vector vector
public AbstractToolRetriever(ToolProvider toolProvider, VectorStoreConfig vectorStoreConfig)
public void addToolsFromMetadata(List<ToolMetadata> toolMetadataList)
ToolRetrieveraddToolsFromMetadata in interface ToolRetrievertoolMetadataList - 需要入库的工具public List<Tool> search(String query)
ToolRetrieversearch in interface ToolRetrieverquery - 查询语句public void setQueryPreprocessor(Function<List<ConversationMessage>,String> preprocessor)
ToolRetrieversetQueryPreprocessor in interface ToolRetrieverpreprocessor - query预处理器public Function<List<ConversationMessage>,String> getQueryPreprocessor()
ToolRetrievergetQueryPreprocessor in interface ToolRetrieverpublic List<Tool> search(String query, int topK)
ToolRetrieversearch in interface ToolRetrieverquery - 查询语句topK - top k条public List<Tool> search(String query, int topK, float scoreThreshold)
ToolRetrieversearch in interface ToolRetrieverquery - 查询语句topK - top k条scoreThreshold - 评分阈值public void remove(List<String> toolIds)
ToolRetrieverremove in interface ToolRetrievertoolIds - 工具ID列表Copyright © 2024. All rights reserved.