File size: 499 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.code_generator.templates import chat_script_prompt


def chain_code_generator(llm) -> LLMChain:
    # Memory
    script_memory = ConversationBufferMemory(
        input_key="output_format", memory_key="chat_history"
    )

    # Chain
    return LLMChain(
        llm=llm,
        prompt=chat_script_prompt,
        verbose=True,
        output_key="script",
        memory=script_memory,
    )