Class DefaultContentInjector

  • All Implemented Interfaces:
    dev.langchain4j.rag.content.injector.ContentInjector

    
    public class DefaultContentInjector
     implements ContentInjector
                        

    Default implementation of 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. The text of the template should contain the {{userMessage}} and {{contents}} variables. - metadataKeysToInclude: A list of Metadata keys that should be included with each textSegment.