-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into show-agent-info
- Loading branch information
Showing
28 changed files
with
1,024 additions
and
419 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
{ | ||
"background": "Six agents gather outside at a bus stop to chat with each other. They talk about their interests and anything they come up with.", | ||
"actions_blacklist": [ "move" ], | ||
"agents": [ | ||
{ | ||
"name": "Natasha", | ||
"description": "Natasha is friendly, outgoing, and effortlessly strikes up conversations. She likes to talk.", | ||
"goal": "Natasha wants to talk about her recent experience with love. She wants to ask the opinions of other agents regarding the relationship. She is also concerned of the other agents and asks them if they are doing good. She talks about anything with the other agents..", | ||
"connections": [ | ||
"Sherlock", | ||
"Viktor", | ||
"Lily", | ||
"James" | ||
], | ||
"x": 25, | ||
"y": 10 | ||
}, | ||
{ | ||
"name": "James", | ||
"description": "James is shy, reserved, and observes from the sidelines.", | ||
"goal": "James joins the conversation and shares his special skills and hidden talent in singing. He talks about his favorite songs and music genre. He also asks the other agents about their taste in music. He talks about anything with the other agents.", | ||
"connections": [ | ||
"Sherlock", | ||
"Viktor", | ||
"Lily", | ||
"Natasha" | ||
], | ||
"x": 25, | ||
"y": 15 | ||
}, | ||
{ | ||
"name": "Sherlock", | ||
"description": "Sherlock is funny, lighthearted, and turns moments into laughter. He is quick-witted and charming.", | ||
"goal": "Sherlock tells a joke everytime he gets the chance to. He loves making everyone happy by being silly. He also shares some of his embarassing moments and also asks the other agents about their funny moments. He talks about anything with the other agents.", | ||
"connections": [ | ||
"Natasha", | ||
"Viktor", | ||
"James", | ||
"Paul" | ||
], | ||
"x": 25, | ||
"y": 20 | ||
}, | ||
{ | ||
"name": "Viktor", | ||
"description": "Viktor likes to take photographs and capture moments. He likes to share his collection of memories from pictures. He likes engaging in a conversation.", | ||
"goal": "Viktor tells the other agents about his love of photography and capturing random sweet moments. He also willingly participates in every conversation with the other agents. He talks about anything with the other agents.", | ||
"connections": [ | ||
"James", | ||
"Natasha", | ||
"Sherlock", | ||
"Paul" | ||
], | ||
"x": 25, | ||
"y": 25 | ||
}, | ||
{ | ||
"name": "Lily", | ||
"description": "Lily likes to cook and eat delicious foods. She likes sweets the most. She is friendly and talkative.", | ||
"goal": "Lily talks about her interest in cooking and eating sweet foods. She shares some of her favorite recipes and experience cooking them. She also asks the other agents about their favorite foods. She talks about anything with the other agents.", | ||
"connections": [ | ||
"Natasha", | ||
"Viktor", | ||
"Sherlock", | ||
"Paul" | ||
], | ||
"x": 25, | ||
"y": 30 | ||
}, | ||
{ | ||
"name": "Paul", | ||
"description": "Paul likes to read books especially poems. He is great at words and He is also quick witted.", | ||
"goal": "Paul wants to tell the other agents about his favorite books and poems. He shares his some of the lines of poem he likes. He also tells a silly joke when he has a chance. He talks about anything with the other agents.", | ||
"connections": [ | ||
"Natasha", | ||
"Viktor", | ||
"James", | ||
"Lily" | ||
], | ||
"x": 25, | ||
"y": 35 | ||
} | ||
], | ||
"steps": 50, | ||
"allow_movement": 0, | ||
"perception_range": 50 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import os | ||
import redis | ||
import json | ||
import requests | ||
from dotenv import load_dotenv | ||
from engine import Matrix | ||
|
||
load_dotenv() | ||
|
||
REDIS_URL = os.getenv('REDIS_URL', 'redis://localhost:6379') | ||
QUEUE_NAME = os.getenv('QUEUE_NAME', 'simulation_jobs') | ||
DISCORD_URL = os.getenv('DISCORD_URL') | ||
|
||
# Connect to Redis | ||
redis_conn = redis.from_url(REDIS_URL) | ||
|
||
def notify_discord(msg): | ||
if DISCORD_URL: | ||
requests.post(DISCORD_URL,json={'content':msg}) | ||
|
||
# get this out of here or refactor with engine | ||
def update_from_env(config): | ||
for key, value in config.items(): | ||
env_var = os.getenv(key) | ||
if env_var is not None: | ||
# Update the value from the environment variable | ||
config[key] = type(value)(env_var) if value is not None else env_var | ||
return config | ||
|
||
def load_config(): | ||
filename = "configs/defaults.json" | ||
with open(filename, 'r') as file: | ||
config = json.load(file) | ||
config = update_from_env(config) | ||
return config | ||
|
||
def process_simulation(data): | ||
config = load_config() | ||
config['scenario'] = data | ||
config['environment'] = "configs/largev2.tmj" | ||
notify_discord(f"starting simulation: #{config}") | ||
matrix = Matrix(config) | ||
matrix.boot() | ||
matrix.run_singlethread() | ||
notify_discord(f"finished simulation: #{config}") | ||
|
||
|
||
print(f'Simulation {simulation_id} completed.') | ||
|
||
def main(): | ||
print('Starting simulation job daemon...') | ||
while True: | ||
# Fetch a job from the Redis queue | ||
_, job = redis_conn.blpop(QUEUE_NAME) | ||
job_data = json.loads(job) | ||
|
||
# Process the simulation | ||
try: | ||
process_simulation(job_data) | ||
except Exception as e: | ||
print(f'Error processing simulation: {e}') | ||
|
||
if __name__ == '__main__': | ||
main() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
Your name is {{agent}} | ||
You are talking with {{other_agent}} | ||
You just spoke with {{other_agent}} | ||
|
||
{{conversation_string}} | ||
|
||
Summarize the conversation above in {{agent}}'s point of view. | ||
List all important outcomes of the conversation: | ||
Summarize the conversation in the first person point of view as {{agent}}. | ||
Write it as a thought {{agent}} says to theirselves. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,3 +13,6 @@ python-Levenshtein | |
jsonlines | ||
nltk | ||
Pillow | ||
groq | ||
sshtunnel | ||
psycopg2 |
Oops, something went wrong.