模块使用指南#
目前QueryPipeline中支持以下LlamaIndex模块。请记住,您可以自定义模块!
LLMs(包括补全和聊天)#
- 基类:
LLM
- 模块指南
- 如果是聊天模型:
- 输入:
messages
. 接收任何List[ChatMessage]
或可字符串化的输入。 - 输出:
output
. 输出ChatResponse
(可字符串化) - 如果是补全模型:
- 输入:
prompt
. 接收任何可字符串化的输入。 - 输出:
output
. 输出CompletionResponse
(可字符串化)
提示词#
- 基类:
PromptTemplate
- 模块指南
- 输入:提示模板变量。每个变量可以是可字符串化的输入。
- 输出:
output
. 输出格式化后的提示字符串(可字符串化)
查询引擎#
- 基类:
BaseQueryEngine
- 模块指南
- 输入:
input
. 接收任何可字符串化的输入。 - 输出:
output
. 输出Response
(可字符串化)
查询转换#
- 基类:
BaseQueryTransform
- 模块指南
- 输入:
query_str
,metadata
(可选)。query_str
可以是任何可字符串化的输入。 - 输出:
query_str
. 输出字符串.
检索器#
- 基类:
BaseRetriever
- 模块指南
- 输入:
input
. 接收任何可字符串化的输入。 - 输出:
output
. 输出节点列表List[BaseNode]
.
输出解析器#
- 基类:
BaseOutputParser
- 模块指南
- 输入:
input
. 接收任何可字符串化的输入。 - 输出:
output
. 输出任何类型输出解析器应该解析的内容。
后处理器/重新排序器#
- 基类:
BaseNodePostprocessor
- 模块指南
- 输入:
nodes
,query_str
(可选)。nodes
是List[BaseNode]
类型,query_str
可以是任何可字符串化的输入。 - 输出:
nodes
. 输出节点列表List[BaseNode]
.
响应合成器#
- 基类:
BaseSynthesizer
- 模块指南
- 输入:
nodes
,query_str
。nodes
是List[BaseNode]
,query_str
可以是任何可字符串化的输入。 - 输出:
output
. 输出Response
对象(可字符串化).
其他QueryPipeline对象#
你可以将QueryPipeline
定义为另一个查询管道中的模块。这样可以轻松地将复杂的工作流程串联起来。
自定义组件#
详情请参阅我们的自定义组件指南。