class Builder {

        private ChatLanguageModel chatLanguageModel;
        private ChatMemory chatMemory;
        private RetrievalAugmentor retrievalAugmentor;

        @Deprecated
        private dev.langchain4j.retriever.Retriever<TextSegment> retriever;
        @Deprecated
        private PromptTemplate promptTemplate;

        public Builder chatLanguageModel(ChatLanguageModel chatLanguageModel) {
            this.chatLanguageModel = chatLanguageModel;
            return this;
        }

        public Builder chatMemory(ChatMemory chatMemory) {
            this.chatMemory = chatMemory;
            return this;
        }

        public Builder contentRetriever(ContentRetriever contentRetriever) {
            if (contentRetriever != null) {
                this.retrievalAugmentor = DefaultRetrievalAugmentor.builder()
                        .contentRetriever(contentRetriever)
                        .build();
            }
            return this;
        }

        public Builder retrievalAugmentor(RetrievalAugmentor retrievalAugmentor) {
            this.retrievalAugmentor = retrievalAugmentor;
            return this;
        }

        /**
         * Deprecated. Use {@link Builder#contentRetriever(ContentRetriever)} instead.
         */
        @Deprecated
        public Builder retriever(dev.langchain4j.retriever.Retriever<TextSegment> retriever) {
            this.retriever = retriever;
            return this;
        }

        /**
         * Deprecated, Use this instead:<pre>
         * .retrievalAugmentor(DefaultRetrievalAugmentor.builder()
         *     .contentInjector(DefaultContentInjector.builder()
         *         .promptTemplate(promptTemplate)
         *         .build())
         *     .build());
         * </pre>
         */
        @Deprecated
        public Builder promptTemplate(PromptTemplate promptTemplate) {
            this.promptTemplate = promptTemplate;
            return this;
        }

        public ConversationalRetrievalChain build() {

            if (retriever != null) {
                retrievalAugmentor = DefaultRetrievalAugmentor.builder()
                        .contentRetriever(retriever.toContentRetriever())
                        .contentInjector(DefaultContentInjector.builder()
                                .promptTemplate(toPromptTemplateWithNewVariableNames(promptTemplate))
                                .build())
                        .build();
            }

            return new ConversationalRetrievalChain(chatLanguageModel, chatMemory, retrievalAugmentor);
        }
    }

    private static PromptTemplate toPromptTemplateWithNewVariableNames(PromptTemplate oldPromptTemplate) {<FILL_FUNCTION_BODY>

        if (oldPromptTemplate != null) {
            return PromptTemplate.from(oldPromptTemplate.template()
                    .replaceAll("\\{\\{question}}", "{{userMessage}}")
                    .replaceAll("\\{\\{information}}", "{{contents}}")
            );
        }

        return PromptTemplate.from(
                "Answer the following question to the best of your ability: {{userMessage}}\n" +
                        "\n" +
                        "Base your answer on the following information:\n" +
                        "{{contents}}"
        );
    
<no_super_class>