"hi"}, {"output": "whats up"})memory.save_context({"input": "not much you"}, {"output": "not much"})Conversation‚ÄãWe can unpack what goes under the hood with ConversationChain. We can specify our memory, ConversationSummaryMemory and we can specify the prompt. from langchain.prompts import (    ChatPromptTemplate,    MessagesPlaceholder,    SystemMessagePromptTemplate,    HumanMessagePromptTemplate,)from langchain.chains import LLMChain# LLMllm = ChatOpenAI()# Prompt prompt = ChatPromptTemplate(    messages=[        SystemMessagePromptTemplate.from_template(            "You are a nice chatbot having a conversation with a human."        ),        # The `variable_name` here is what must align with memory        MessagesPlaceholder(variable_name="chat_history"),        HumanMessagePromptTemplate.from_template("{question}")    ])# Notice that we `return_messages=True` to fit into the MessagesPlaceholder# Notice that `"chat_history"` aligns with the MessagesPlaceholder namememory = ConversationBufferMemory(memory_key="chat_history",return_messages=True)conversation = LLMChain(    llm=llm,    prompt=prompt,    verbose=True,    memory=memory)# Notice that we just pass in the `question` variables - `chat_history` gets populated by memoryconversation({"question": "hi"})            > Entering new LLMChain chain...    Prompt after formatting:    System: You are a nice chatbot having a conversation with a human.    Human: hi        > Finished chain.    {'question': 'hi',     'chat_history': [HumanMessage(content='hi', additional_kwargs={}, example=False),      AIMessage(content='Hello! How can I assist you today?', additional_kwargs={}, example=False)],     'text': 'Hello! How can I assist you today?'}conversation({"question": "Translate this sentence from English to French: I love programming."})            > Entering new LLMChain chain...    Prompt after formatting:    System: You are a nice chatbot having a conversation with a human.    Human: hi    AI: Hello! How can I
Open In Colab
Open In Colab ->: "hi"}, {"output": "whats up"})memory.save_context({"input": "not much you"}, {"output": "not much"})Conversation‚ÄãWe can unpack what goes under the hood with ConversationChain. We can specify our memory, ConversationSummaryMemory and we can specify the prompt. from langchain.prompts import (    ChatPromptTemplate,    MessagesPlaceholder,    SystemMessagePromptTemplate,    HumanMessagePromptTemplate,)from langchain.chains import LLMChain# LLMllm = ChatOpenAI()# Prompt prompt = ChatPromptTemplate(    messages=[        SystemMessagePromptTemplate.from_template(            "You are a nice chatbot having a conversation with a human."        ),        # The `variable_name` here is what must align with memory        MessagesPlaceholder(variable_name="chat_history"),        HumanMessagePromptTemplate.from_template("{question}")    ])# Notice that we `return_messages=True` to fit into the MessagesPlaceholder# Notice that `"chat_history"` aligns with the MessagesPlaceholder namememory = ConversationBufferMemory(memory_key="chat_history",return_messages=True)conversation = LLMChain(    llm=llm,    prompt=prompt,    verbose=True,    memory=memory)# Notice that we just pass in the `question` variables - `chat_history` gets populated by memoryconversation({"question": "hi"})            > Entering new LLMChain chain...    Prompt after formatting:    System: You are a nice chatbot having a conversation with a human.    Human: hi        > Finished chain.    {'question': 'hi',     'chat_history': [HumanMessage(content='hi', additional_kwargs={}, example=False),      AIMessage(content='Hello! How can I assist you today?', additional_kwargs={}, example=False)],     'text': 'Hello! How can I assist you today?'}conversation({"question": "Translate this sentence from English to French: I love programming."})            > Entering new LLMChain chain...    Prompt after formatting:    System: You are a nice chatbot having a conversation with a human.    Human: hi    AI: Hello! How can I