79189702

Date: 2024-11-14 16:47:17
Score: 4
Natty:
Report link

I created a conversation using conversation memory then asked the llm to summarize the conversation. If you use a vector database to initialize the conversation then assess the memory message chat history

conversation = [
    {"user": "Hey Louise, can you help me with something?"},
    {"ai": "Of course! What do you need help with today?"},
    {"user": "I’m trying to organize a surprise birthday party for my friend. Any ideas?"},
    {"ai": "That sounds fun! What does your friend enjoy? We can brainstorm a theme based on their interests."},
    {"user": "They love the outdoors and hiking. I was thinking of doing something in a park."},
    {"ai": "Great idea! How about a picnic party? You could set up a cozy area with blankets, snacks, and decorations that reflect nature. Maybe even some outdoor games!"},
    {"user": "I love that! What kind of snacks should I include?"},
    {"ai": "Consider packing finger foods that are easy to eat outdoors. Sandwiches, fruit skewers, veggie platters, and some homemade cookies would be perfect. Don’t forget refreshing drinks!"},
    {"user": "Good call! How about decorations? I want it to feel special."},
    {"ai": "You could use biodegradable decorations like paper lanterns, wildflower bouquets, and string lights. A nature-themed cake would also be a nice centerpiece!"},
    {"user": "These are awesome suggestions! How many people should I invite?"},
    {"ai": "It depends on the size of the park area you’ll be using. A smaller group of close friends might make it feel more intimate, while a larger group could bring more energy. What do you think?"},
    {"user": "Maybe around 10-15 people. That feels manageable."},
    {"ai": "Perfect! Just remember to send out the invites soon so everyone can mark their calendars. Do you need help with the invitation wording?"},
    {"user": "Yes, please! I want it to be fun and casual."},
    {"ai": "How about this: “Join us for a surprise outdoor adventure to celebrate [Friend’s Name]’s birthday! Bring your favorite snacks and your love for nature. Let’s make some unforgettable memories!”"},
    {"user": "I love it! Thanks, Louise. You’ve been a huge help."},
    {"ai": "Anytime! Have a blast planning the party, and let me know if you need anything else."}
]

def example_tool(input_text):
    system_prompt = "You are a Louise AI agent. Louise, you will be fair and reasonable in your responses to subjective statements. Logic puzzle the facts or theorize future events or optimize facts providing resulting inferences. Think"
    return f"{system_prompt} Processed input: {input_text}"

# Initialize the LLM
llm = LangChainChatOpenAI(model="gpt-4o-mini", temperature=0, openai_api_key=key)

# Define tools
tools = [
    Tool(
        name="ExampleTool",
        func=example_tool,
        description="A simple tool that processes input text."
    )
]

# Initialize memory
memory = ConversationBufferMemory(memory_key="chat_history", return_messages=True)

# Loop through the conversation and add messages to memory
for message in conversation:
    if "user" in message:
        memory.chat_memory.add_user_message(message["user"])
    elif "ai" in message:
        memory.chat_memory.add_ai_message(message["ai"])

# Initialize the agent with memory
agent = initialize_agent(
    tools,
    llm,
    agent=AgentType.ZERO_SHOT_REACT_DESCRIPTION,
    verbose=True,
    handle_parsing_errors=True,
    memory=memory
)

# Query to recall previous discussion
query = "Tell me in detail about our previous discussion about the party. Louise enumerate the foods that will be served at the party."
response = agent.run(query)

# Print the response
print(response)


print(memory.chat_memory.messages)
Reasons:
  • Blacklisted phrase (0.5): Thanks
  • Blacklisted phrase (1): help me
  • Blacklisted phrase (1): Any ideas
  • RegEx Blacklisted phrase (3): can you help me
  • RegEx Blacklisted phrase (1): I want
  • Long answer (-1):
  • Has code block (-0.5):
  • High reputation (-1):
Posted by: ListenSoftware Louise Ai Agent