类 DefaultContentInjector
java.lang.Object
dev.langchain4j.rag.content.injector.DefaultContentInjector
- 所有已实现的接口:
ContentInjector
Default implementation of
It's important to note that while efforts will be made to avoid breaking changes, the default behavior of this class may be updated in the future if it's found that the current behavior does not adequately serve the majority of use cases. Such changes would be made to benefit both current and future users.
This implementation appends all given
Configurable parameters (optional):
-
-
ContentInjector intended to be suitable for the majority of use cases.
It's important to note that while efforts will be made to avoid breaking changes, the default behavior of this class may be updated in the future if it's found that the current behavior does not adequately serve the majority of use cases. Such changes would be made to benefit both current and future users.
This implementation appends all given
Contents to the end of the given UserMessage
in their order of iteration.
Refer to DEFAULT_PROMPT_TEMPLATE and implementation for more details.
Configurable parameters (optional):
-
promptTemplate: The prompt template that defines how the original userMessage
and contents are combined into the resulting UserMessage.
-
metadataKeysToInclude: A list of Metadata keys that should be included
with each Content.textSegment().-
字段概要
字段 -
构造器概要
构造器构造器说明DefaultContentInjector(PromptTemplate promptTemplate) DefaultContentInjector(PromptTemplate promptTemplate, List<String> metadataKeysToInclude) DefaultContentInjector(List<String> metadataKeysToInclude) -
方法概要
修饰符和类型方法说明protected PromptcreatePrompt(ChatMessage chatMessage, List<Content> contents) protected PromptcreatePrompt(UserMessage userMessage, List<Content> contents) 已过时。protected Stringprotected Stringprotected Stringprotected Stringinject(List<Content> contents, ChatMessage chatMessage) Injects givenContents into a givenChatMessage.inject(List<Content> contents, UserMessage userMessage) 已过时。useinject(List, ChatMessage)instead.
-
字段详细资料
-
DEFAULT_PROMPT_TEMPLATE
-
-
构造器详细资料
-
DefaultContentInjector
public DefaultContentInjector() -
DefaultContentInjector
-
DefaultContentInjector
-
DefaultContentInjector
-
-
方法详细资料
-
inject
从接口复制的说明:ContentInjectorInjects givenContents into a givenChatMessage.
This method has a default implementation in order to temporarily support current custom implementations ofContentInjector. The default implementation will be removed soon.- 指定者:
inject在接口中ContentInjector- 参数:
contents- The list ofContentto be injected.chatMessage- TheChatMessageinto which theContents are to be injected. Can be either aUserMessageor aSystemMessage.- 返回:
- The
UserMessagewith the injectedContents.
-
createPrompt
-
inject
已过时。useinject(List, ChatMessage)instead.从接口复制的说明:ContentInjectorInjects givenContents into a givenUserMessage.- 指定者:
inject在接口中ContentInjector- 参数:
contents- The list ofContentto be injected.userMessage- TheUserMessageinto which theContents are to be injected.- 返回:
- The
UserMessagewith the injectedContents.
-
createPrompt
已过时。implement/overridecreatePrompt(ChatMessage, List)instead. -
format
-
format
-
format
-
format
-
createPrompt(ChatMessage, List)instead.