Slide 31
Slide 31 text
llm = BedrockChat(model_id="anthropic.claude-instant-v1")
def conversation(input: str, session_id: str):
history = DynamoDBChatMessageHistory(table_name="SessionTable", session_id=str)
memory = ConversationBufferWindowMemory(
human_prefix="H",
ai_prefix="A",
chat_memory=history,
k=10)
chain = ConversationChain(
llm=llm,
memory=memory,
verbose=True
)
return chain.predict(input=input)
29