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

Danny search and rescue #14

Merged
merged 25 commits into from
Nov 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
fd498e0
adjusting for gpt-4-mini and setup
Sep 22, 2024
d8e1cbb
Merge remote-tracking branch 'origin/search-and-rescue' into Danny-se…
Sep 30, 2024
19416bb
Merged search-and-rescue into my new branch
Sep 30, 2024
054ed7a
Adding in Jonathon's structured output: adjusting for gpt-4-mini and …
Sep 22, 2024
d4f65c9
Merged search-and-rescue into my new branch
Sep 30, 2024
7ce7c01
run_gpt_primpt_decide_to_react to structured output
Oct 18, 2024
7d3b02c
run_gpt_generate_safety_score() to structured output
Oct 18, 2024
7be398f
EventPoignancy to structured
Oct 18, 2024
1817823
EventPoignancy to structured edit
Oct 18, 2024
e1ffd71
SummarizeConversation to structured output
Oct 18, 2024
77c94b1
run_gpt_prompt_action_arena and added validation from pydantic
Oct 23, 2024
e86c800
run_gpt_prompt_action_arena and run_gpt_prompt_aciton_sector creaitng…
Oct 23, 2024
d04c945
prompt_act_obj_desc
Oct 23, 2024
b33b827
minor bug fixes to structured output
Oct 25, 2024
e17ca9d
Merge branch dev into Danny-search-and-rescue
Oct 25, 2024
c941c99
Resolved merge conflicts
Oct 25, 2024
e3fe5f5
putting the following 2 functions back to normal: run_gpt_prompt_even…
Oct 25, 2024
214ca7e
fixed small error in ActionLoc
Oct 25, 2024
fe5b958
bug fixes for structured output
Oct 27, 2024
d04940b
Clean up PR
chowington Oct 29, 2024
c55ed1f
More PR cleaning
chowington Oct 29, 2024
f37e1c8
Merge branch 'dev' into Danny-search-and-rescue
chowington Nov 8, 2024
4ab890f
Merge branch 'dev' into Danny-search-and-rescue
chowington Nov 23, 2024
0d6c546
Use correct function replacements
chowington Nov 25, 2024
1ca7cfc
Increase max token limits
chowington Nov 25, 2024
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
59 changes: 59 additions & 0 deletions print_all_sim.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import os
import json
import re
import sys

def get_unique_conversations(simulation_name):
sim_folder = os.path.join("environment", "frontend_server", "storage")

regex_name = re.compile(re.escape(simulation_name + '-'))
for file_name in os.listdir(sim_folder):
step=0
output = []
if regex_name.search(file_name):
step_folder = os.path.join(sim_folder, file_name, "movement")
for filename in os.listdir(step_folder):
filepath = os.path.join(step_folder, filename)
output.append(f"Step {str(step)}:")
try:
with open(filepath, "r") as file:
data = json.load(file)
for k, v in data.items():
output.append(k)
if k == 'persona':
for key, value in v.items():
output.append(f' {key}')
for attribute, val in value.items():
if attribute != 'chat' or (attribute == 'chat' and val is None):
output.append(f' {attribute}: {val}')
else:
output.append(f' {attribute}:')
for convo in val:
output.append(f' {convo[0]}: {convo[1]}')
else:
for key, value in v.items():
output.append(f' {key}: {value}')
output.append('\n')
except json.JSONDecodeError:
continue
except Exception as e:
print(f"Error processing file {filename}: {e}")
continue
step+=1

output_filename = os.path.join(sim_folder, file_name, f"output_0-{file_name.split('-')[5]}.txt", )
with open(output_filename, "w") as output_file:
output_file.write('\n'.join(output))


if __name__ == "__main__":
if len(sys.argv) < 2:
print("Please provide the simulation name as a command line argument.")
sys.exit(1)

simulation_name = sys.argv[1]
'''
unique_conversations = get_unique_conversations(simulation_name)
print(json.dumps(unique_conversations, indent=2))
'''
get_unique_conversations(simulation_name)
Loading