household_gpt

class pyrecodes.household.household_gpt.HouseholdGPT

Bases: Household, HouseholdGPTBase

GPT-powered household agent for regional sociotechnical recovery simulations.

OPTIONS

alias of HouseholdOptions

PROMPTS_FILE = './pyrecodes/household/household_gpt_prompts.json'
add_move_to_friend_options(component_where_household_is_staying=None) list
async async_decide(component_where_household_is_staying: Component) None
async async_set_parameters(parameters: dict, api_key_filename: str = './openai_api_key.json', temperature: float = 1.0, llm_model: str = 'GPT', summarize_experience: bool = False) None
create_time_step_narrative(time_step: int, location_string: str, households_in_town: list) None
decide(component_where_household_is_staying: Component) None
find_friend_id(component: Component) int
get_demand() dict
get_household_options(component_where_household_is_staying: Component) str
get_supply()
leave_town(component_where_household_is_staying: Component) None
map_buildings_to_households(built_environment) None
move(component_where_household_is_staying: Component) None
move_to_friend(component_where_household_is_staying: Component) None
remove_household_from_component(component: Component) None
return_home(component_where_household_is_staying: Component) None
send_resource_demand_parameters_to_llm(parameters: dict) None
send_socioeconomic_parameters_to_llm(socioeconomic_parameters: dict) None
set_context() None
set_friends_ids(friends: list) None
set_home_id(home_id: int) None
set_household_id(household_id: int) None
set_parameters(parameters: dict, api_key_filename: str = './openai_api_key.json', temperature: float = 1.0, llm_model: str = 'GPT', summarize_experience: bool = False) None
set_resource_demand_parameters(parameters: dict) None
set_socioeconomic_parameters(parameters: dict) None
update(time_step: int, component: Component, households_in_town: list) None
update_based_on_unmet_demand(percent_of_met_demand: float, resource_name: str) None
update_where_household_is_staying(component: Component)
class pyrecodes.household.household_gpt.HouseholdOptions(value)

Bases: Enum

An enumeration.

LEAVE_TOWN = 'LeaveTown'
MOVE_TO_FRIEND = 'MoveToFriend_ID'
RETURN_HOME = 'ReturnHome'
STAY_AT_HOME = 'StayAtHome'
STAY_OUT_OF_TOWN = 'StayOutOfTown'
STAY_WITH_FRIEND = 'StayWithFriend_ID'
class pyrecodes.household.household_gpt.TimeStepNarrativeCreator(prompts: dict)

Bases: object

Builds the per-time-step prompt for simulation household agents.

add_current_time_step_to_narrative(time_step: int) None
add_household_location_to_time_step_narrative(location_update: str) None
add_past_experience(llm: LLM) None
add_to_narrative(prompt: str) None
create(time_step: int, location_update: str, households_in_town: list, buildings_map: dict, find_friend_id) None
format_recovery_info(recovery_model: RecoveryModel, household_location_string: str) str
get_building_damage_indicator(building_functionality_level: float) str
get_met_demand_indicator(percent_of_met_demand: float) str
get_met_demand_indicator_for_traffic(percent_of_met_demand: float) str
get_narrative() str
provide_information_on_building_recovery(recovery_model: RecoveryModel, household_location_string: str) None
start_the_time_step_narrative() None
update_current_building_recovery_info(recovery_model: RecoveryModel) None
update_household_on_other_households_in_town(households_in_town: list, location_string: str) None
update_household_on_recovery_state_of_their_predisaster_home(location_string: str, buildings_map: dict) None
update_household_on_the_status_of_their_friend(buildings_map: dict, find_friend_id) None
update_household_options(household_options: str) None
update_resource_demand_fulfilment_status(percent_of_met_demand: float, resource_name: str) None