AUXteam commited on
Commit
ac9e533
·
verified ·
1 Parent(s): f5e9574

Upload folder using huggingface_hub

Browse files
deeppersona/__init__.py CHANGED
@@ -193,7 +193,7 @@ class ConfigManager:
193
 
194
  # Create global instance of the configuration manager
195
  config = utils.read_config_file()
196
- utils.pretty_print_tinytroupe_version()
197
  utils.pretty_print_datetime()
198
  utils.pretty_print_config(config)
199
  utils.start_logger(config)
 
193
 
194
  # Create global instance of the configuration manager
195
  config = utils.read_config_file()
196
+ utils.pretty_print_deep_persona_version()
197
  utils.pretty_print_datetime()
198
  utils.pretty_print_config(config)
199
  utils.start_logger(config)
deeppersona/control.py CHANGED
@@ -673,20 +673,20 @@ class Transaction:
673
  if output is None:
674
  return None
675
  elif isinstance(output, DeepPersona):
676
- return {"type": "TinyPersonRef", "name": output.name}
677
  elif isinstance(output, DeepWorld):
678
- return {"type": "TinyWorldRef", "name": output.name}
679
  elif isinstance(output, DeepPersonaFactory):
680
- return {"type": "TinyFactoryRef", "name": output.name}
681
  elif isinstance(output, list):
682
  encoded_list = []
683
  for item in output:
684
  if isinstance(item, DeepPersona):
685
- encoded_list.append({"type": "TinyPersonRef", "name": item.name})
686
  elif isinstance(item, DeepWorld):
687
- encoded_list.append({"type": "TinyWorldRef", "name": item.name})
688
  elif isinstance(item, DeepPersonaFactory):
689
- encoded_list.append({"type": "TinyFactoryRef", "name": item.name})
690
  else:
691
  encoded_list.append({"type": "JSON", "value": item})
692
  return {"type": "List", "value": encoded_list}
@@ -706,20 +706,20 @@ class Transaction:
706
 
707
  if encoded_output is None:
708
  return None
709
- elif encoded_output["type"] == "TinyPersonRef":
710
  return DeepPersona.get_agent_by_name(encoded_output["name"])
711
- elif encoded_output["type"] == "TinyWorldRef":
712
  return DeepWorld.get_environment_by_name(encoded_output["name"])
713
- elif encoded_output["type"] == "TinyFactoryRef":
714
  return DeepPersonaFactory.get_factory_by_name(encoded_output["name"])
715
  elif encoded_output["type"] == "List":
716
  decoded_list = []
717
  for item in encoded_output["value"]:
718
- if item["type"] == "TinyPersonRef":
719
  decoded_list.append(DeepPersona.get_agent_by_name(item["name"]))
720
- elif item["type"] == "TinyWorldRef":
721
  decoded_list.append(DeepWorld.get_environment_by_name(item["name"]))
722
- elif item["type"] == "TinyFactoryRef":
723
  decoded_list.append(DeepPersonaFactory.get_factory_by_name(item["name"]))
724
  else:
725
  decoded_list.append(item["value"])
 
673
  if output is None:
674
  return None
675
  elif isinstance(output, DeepPersona):
676
+ return {"type": "DeepPersonaRef", "name": output.name}
677
  elif isinstance(output, DeepWorld):
678
+ return {"type": "DeepWorldRef", "name": output.name}
679
  elif isinstance(output, DeepPersonaFactory):
680
+ return {"type": "DeepPersonaFactoryRef", "name": output.name}
681
  elif isinstance(output, list):
682
  encoded_list = []
683
  for item in output:
684
  if isinstance(item, DeepPersona):
685
+ encoded_list.append({"type": "DeepPersonaRef", "name": item.name})
686
  elif isinstance(item, DeepWorld):
687
+ encoded_list.append({"type": "DeepWorldRef", "name": item.name})
688
  elif isinstance(item, DeepPersonaFactory):
689
+ encoded_list.append({"type": "DeepPersonaFactoryRef", "name": item.name})
690
  else:
691
  encoded_list.append({"type": "JSON", "value": item})
692
  return {"type": "List", "value": encoded_list}
 
706
 
707
  if encoded_output is None:
708
  return None
709
+ elif encoded_output["type"] == "DeepPersonaRef":
710
  return DeepPersona.get_agent_by_name(encoded_output["name"])
711
+ elif encoded_output["type"] == "DeepWorldRef":
712
  return DeepWorld.get_environment_by_name(encoded_output["name"])
713
+ elif encoded_output["type"] == "DeepPersonaFactoryRef":
714
  return DeepPersonaFactory.get_factory_by_name(encoded_output["name"])
715
  elif encoded_output["type"] == "List":
716
  decoded_list = []
717
  for item in encoded_output["value"]:
718
+ if item["type"] == "DeepPersonaRef":
719
  decoded_list.append(DeepPersona.get_agent_by_name(item["name"]))
720
+ elif item["type"] == "DeepWorldRef":
721
  decoded_list.append(DeepWorld.get_environment_by_name(item["name"]))
722
+ elif item["type"] == "DeepPersonaFactoryRef":
723
  decoded_list.append(DeepPersonaFactory.get_factory_by_name(item["name"]))
724
  else:
725
  decoded_list.append(item["value"])
deeppersona/environment/social_deep_world.py CHANGED
@@ -52,7 +52,7 @@ class SimulationResult:
52
  self.total_reach = len(set(e["persona_id"] for e in self.engagements)) # Simplified
53
  # ... more metrics
54
 
55
- class SocialTinyWorld(DeepWorld):
56
  """Extended DeepWorld with social network capabilities"""
57
 
58
  def __init__(self, name: str, network: NetworkTopology = None, **kwargs):
 
52
  self.total_reach = len(set(e["persona_id"] for e in self.engagements)) # Simplified
53
  # ... more metrics
54
 
55
+ class SocialDeepWorld(DeepWorld):
56
  """Extended DeepWorld with social network capabilities"""
57
 
58
  def __init__(self, name: str, network: NetworkTopology = None, **kwargs):
deeppersona/profiling.py CHANGED
@@ -75,7 +75,7 @@ class Profiler:
75
  for agent in agents:
76
  if isinstance(agent, DeepPersona):
77
  # Extract data from DeepPersona object
78
- agent_data = self._extract_tinyperson_data(agent)
79
  else:
80
  agent_data = agent.copy()
81
 
@@ -83,7 +83,7 @@ class Profiler:
83
 
84
  return processed_agents
85
 
86
- def _extract_tinyperson_data(self, agent: DeepPersona) -> Dict[str, Any]:
87
  """Extract comprehensive data from a DeepPersona object."""
88
  data = {}
89
 
 
75
  for agent in agents:
76
  if isinstance(agent, DeepPersona):
77
  # Extract data from DeepPersona object
78
+ agent_data = self._extract_deep_persona_data(agent)
79
  else:
80
  agent_data = agent.copy()
81
 
 
83
 
84
  return processed_agents
85
 
86
+ def _extract_deep_persona_data(self, agent: DeepPersona) -> Dict[str, Any]:
87
  """Extract comprehensive data from a DeepPersona object."""
88
  data = {}
89
 
deeppersona/simulation_manager.py CHANGED
@@ -4,7 +4,7 @@ import threading
4
  from datetime import datetime
5
  from deeppersona.agent import DeepPersona
6
  from deeppersona.social_network import NetworkTopology
7
- from deeppersona.environment.social_deep_world import SocialTinyWorld, SimulationResult
8
  from deeppersona.agent.social_types import Content
9
  from deeppersona.ml_models import EngagementPredictor
10
  from deeppersona.content_generation import ContentVariantGenerator
@@ -18,7 +18,7 @@ class SimulationConfig:
18
  self.user_id = kwargs.get("user_id")
19
 
20
  class Simulation:
21
- def __init__(self, id: str, config: SimulationConfig, world: SocialTinyWorld, personas: List[DeepPersona], network: NetworkTopology):
22
  self.id = id
23
  self.config = config
24
  self.world = world
@@ -58,7 +58,7 @@ class SimulationManager:
58
  network = net_gen.generate_small_world_network(config.persona_count, 4, 0.1)
59
 
60
  # Create world
61
- world = SocialTinyWorld(config.name, network=network)
62
  for persona in personas:
63
  world.add_agent(persona)
64
 
 
4
  from datetime import datetime
5
  from deeppersona.agent import DeepPersona
6
  from deeppersona.social_network import NetworkTopology
7
+ from deeppersona.environment.social_deep_world import SocialDeepWorld, SimulationResult
8
  from deeppersona.agent.social_types import Content
9
  from deeppersona.ml_models import EngagementPredictor
10
  from deeppersona.content_generation import ContentVariantGenerator
 
18
  self.user_id = kwargs.get("user_id")
19
 
20
  class Simulation:
21
+ def __init__(self, id: str, config: SimulationConfig, world: SocialDeepWorld, personas: List[DeepPersona], network: NetworkTopology):
22
  self.id = id
23
  self.config = config
24
  self.world = world
 
58
  network = net_gen.generate_small_world_network(config.persona_count, 4, 0.1)
59
 
60
  # Create world
61
+ world = SocialDeepWorld(config.name, network=network)
62
  for persona in personas:
63
  world.add_agent(persona)
64
 
deeppersona/utils/config.py CHANGED
@@ -59,7 +59,7 @@ def pretty_print_datetime():
59
  print(f"Current date and time (local): {now.strftime('%Y-%m-%d %H:%M:%S')}")
60
  print(f"Current date and time (UTC): {now_utc.strftime('%Y-%m-%d %H:%M:%S')}")
61
 
62
- def pretty_print_tinytroupe_version():
63
  try:
64
  import importlib.metadata
65
  version = importlib.metadata.version("deeppersona")
 
59
  print(f"Current date and time (local): {now.strftime('%Y-%m-%d %H:%M:%S')}")
60
  print(f"Current date and time (UTC): {now_utc.strftime('%Y-%m-%d %H:%M:%S')}")
61
 
62
+ def pretty_print_deep_persona_version():
63
  try:
64
  import importlib.metadata
65
  version = importlib.metadata.version("deeppersona")