File size: 513 Bytes
15ad492
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
from langchain.chains import LLMChain
from langchain.memory import ConversationBufferMemory
from chains.output_format.templates import output_format_chat_prompt


def chain_output_format(llm) -> LLMChain:
    # memory
    html_memory = ConversationBufferMemory(
        input_key="html_content", memory_key="chat_history"
    )

    # chain
    return LLMChain(
        llm=llm,
        prompt=output_format_chat_prompt,
        verbose=True,
        output_key="output_format",
        memory=html_memory,
    )