Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pylint fix #21

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 23 additions & 13 deletions chat.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,30 @@
import argparse
"""
This module handles the chat functionality of the system.
"""

from src.agents import Agent
from src.conversation import Conversation
from utils.utils import *

def chat_with_agent(agent,you):

def chat_with_agent(agent, you):
"""
This function lets a user to chat with an agent.
"""

print(f"Welcome, chat with {agent}, the meta cognizing LLM agent!")
timestamp = 1
unix_time = 1704067200
agent.last_conversation = Conversation(agent,you )
# unix_time = 1704067200
agent.last_conversation = Conversation(agent, you)
you.last_conversation = Conversation(you, agent)
while True:
user_input = input("You: ")
if user_input.lower() in ['exit()', 'quit()']:
if user_input.lower() in ["exit()", "quit()"]:
print("Goodbye!")
break
elif user_input.lower() in ['meta()']:
if user_input.lower() in ["meta()"]:
agent.meta_cognize(unix_to_strftime(timestamp))
elif user_input.lower() in ['mem()']:
elif user_input.lower() in ["mem()"]:
print("long")
for m in agent.memory:
print(m)
Expand All @@ -25,19 +33,21 @@ def chat_with_agent(agent,you):
print(m)
else:

#agent_response = agent.answer(user_input)
# agent_response = agent.answer(user_input)
timestamp += 10
interaction = f"{timestamp} - Jason said to {agent}: {user_input}"
you.last_conversation.messages.append(interaction)
agent.last_conversation.messages.append(interaction)
agent_response = agent.talk({ "other_agents": [you],"timestamp":unix_to_strftime(timestamp)}) #"timestamp": self.unix_to_strftime(unix_time) })
agent_response = agent.talk(
{"other_agents": [you], "timestamp": unix_to_strftime(timestamp)}
) # "timestamp": self.unix_to_strftime(unix_time) })
print(f"{agent}: {agent_response}")


if __name__ == "__main__":
# Create an instance of the Agent
agent = Agent({'name':'Jarvis','goal':'Serve Jason'})
you = Agent({'name':'Jason'})
sim_agent = Agent({"name": "Jarvis", "goal": "Serve Jason"})
person = Agent({"name": "Jason"})

# Start the CLI chat interface
chat_with_agent(agent,you)

chat_with_agent(sim_agent, person)
Loading