Skip to content

Commit

Permalink
Updated db_description file.
Browse files Browse the repository at this point in the history
  • Loading branch information
Cox, Jordan authored and Cox, Jordan committed Jan 5, 2024
1 parent 32c16bd commit 78450ca
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 48 deletions.
8 changes: 4 additions & 4 deletions elm/db_wiz.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ def __init__(self, connection_string, model=None, token_budget=3500, ref_col=Non
self.database_unique_values = self.get_unique_values()

self.database_describe = ('You have been given access to the database '
'schema {}. The first ten lines of the database are {}\n '
'. Each column of text contains the following unique '
'values {}. The table name is loads.lc_day_profile_demand_enduse.'
'schema {}.\n The first ten lines of the database are {}.\n '
'Each column of text contains the following unique '
'values {}.\n The table name is loads.lc_day_profile_demand_enduse.'
.format(self.database_schema,
self.database_first_lines,
self.database_unique_values))
Expand Down Expand Up @@ -172,7 +172,7 @@ def get_py_code(self, query, df):
## get response from output
# Need to fix full response
full_response = out
print(full_response)
#print(full_response)
## get python code from response
full_response = full_response[full_response.find('python')+6:]
full_response = full_response[:full_response.find('```')]
Expand Down
6 changes: 4 additions & 2 deletions examples/energy_wizard/db_description.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
You have been given access to the database schema {"lc_day_profile_demand_enduse": [{"column": "load_scenario", "type": "text"}, {"column": "year", "type": "text"}, {"column": "geography_id", "type": "bigint"}, {"column": "scenario_year", "type": "text"}, {"column": "load_center", "type": "bigint"}, {"column": "timestamp", "type": "timestamp without time zone"}, {"column": "timestamp_alias", "type": "timestamp without time zone"}, {"column": "week_type", "type": "text"}, {"column": "day_type", "type": "text"}, {"column": "hour_type", "type": "text"}, {"column": "sector", "type": "text"}, {"column": "enduse", "type": "text"}, {"column": "kwh", "type": "double precision"}, {"column": "kwh_w_dlosses", "type": "double precision"}]}. The first ten lines of the database are [["moderate", "2025", 1, "moderate_2025", 1, "2012-04-18T05:00:00", "2025-04-16T13:00:00", "min", null, null, "com", "plug_and_process", 2916.49093456103, 3149.8102093259126], ["moderate", "2025", 1, "moderate_2025", 1, "2012-04-18T05:00:00", "2025-04-16T13:00:00", "min", null, null, "com", "refrigeration", 54.7219096497455, 59.09966242172514], ["moderate", "2025", 1, "moderate_2025", 1, "2012-04-18T05:00:00", "2025-04-16T13:00:00", "min", null, null, "ev", "bus", 1760.17283482198, 1900.9866616077384], ["moderate", "2025", 1, "moderate_2025", 1, "2012-04-18T05:00:00", "2025-04-16T13:00:00", "min", null, null, "ev", "dcfc", 0.0, 0.0], ["moderate", "2025", 1, "moderate_2025", 1, "2012-04-18T05:00:00", "2025-04-16T13:00:00", "min", null, null, "ev", "l1l2", 284.711061946903, 307.48794690265527], ["moderate", "2025", 1, "moderate_2025", 1, "2012-04-18T05:00:00", "2025-04-16T13:00:00", "min", null, null, "gap", "other", 201.712384639549, 217.84937541071292], ["moderate", "2025", 1, "moderate_2025", 1, "2012-04-18T05:00:00", "2025-04-16T13:00:00", "min", null, null, "ind", "other", 1196.36519278737, 1292.0744082103597], ["moderate", "2025", 1, "moderate_2025", 1, "2012-04-18T05:00:00", "2025-04-16T13:00:00", "min", null, null, "misc", "other", 0.0, 0.0], ["moderate", "2025", 1, "moderate_2025", 1, "2012-04-18T05:00:00", "2025-04-16T13:00:00", "min", null, null, "res", "appliances", 101.25093281548, 109.3510074407184], ["moderate", "2025", 1, "moderate_2025", 1, "2012-04-18T05:00:00", "2025-04-16T13:00:00", "min", null, null, "res", "cooling", 260.147432639897, 280.95922725108875]]
. Each column of text contains the following unique values {"load_scenario": "[('stress',), ('high',), ('moderate',)]", "year": "[('2030',), ('2045',), ('2040',), ('2035',), ('2025',), ('2020',)]", "scenario_year": "[('high_2020',), ('high_2025',), ('moderate_2035',), ('moderate_2030',), ('stress_2020',), ('stress_2040',), ('moderate_2045',), ('moderate_2025',), ('moderate_2040',), ('high_2035',), ('stress_2035',), ('moderate_2020',), ('stress_2030',), ('stress_2045',), ('stress_2025',), ('high_2045',), ('high_2030',), ('high_2040',)]", "week_type": "[('min',), ('winter',), ('peak',), ('fall',)]", "day_type": "[(None,), ('min',), ('winter',), ('peak',), ('fall',)]", "hour_type": "[(None,), ('min',), ('winter',), ('peak',), ('fall',)]", "sector": "[('misc',), ('ev',), ('com',), ('res',), ('wtr',), ('gap',), ('ind',)]", "enduse": "[('fans_and_pumps',), ('hot_water',), ('heating',), ('refrigeration',), ('plug_and_process',), ('lighting',), ('cooling',), ('pool',), ('bus',), ('dcfc',), ('appliances',), ('municipal_water',), ('l1l2',), ('other',)]"}. The table name is loads.lc_day_profile_demand_enduse.
You have been given access to the database schema {"lc_day_profile_demand_enduse": [{"column": "load_scenario", "type": "text"}, {"column": "year", "type": "text"}, {"column": "geography_id", "type": "bigint"}, {"column": "scenario_year", "type": "text"}, {"column": "load_center", "type": "bigint"}, {"column": "timestamp", "type": "timestamp without time zone"}, {"column": "timestamp_alias", "type": "timestamp without time zone"}, {"column": "week_type", "type": "text"}, {"column": "day_type", "type": "text"}, {"column": "hour_type", "type": "text"}, {"column": "sector", "type": "text"}, {"column": "enduse", "type": "text"}, {"column": "kwh", "type": "double precision"}, {"column": "kwh_w_dlosses", "type": "double precision"}]}.
The first ten lines of the database are [["moderate", "2025", 1, "moderate_2025", 1, "2012-04-18T05:00:00", "2025-04-16T13:00:00", "min", null, null, "com", "plug_and_process", 2916.49093456103, 3149.8102093259126], ["moderate", "2025", 1, "moderate_2025", 1, "2012-04-18T05:00:00", "2025-04-16T13:00:00", "min", null, null, "com", "refrigeration", 54.7219096497455, 59.09966242172514], ["moderate", "2025", 1, "moderate_2025", 1, "2012-04-18T05:00:00", "2025-04-16T13:00:00", "min", null, null, "ev", "bus", 1760.17283482198, 1900.9866616077384], ["moderate", "2025", 1, "moderate_2025", 1, "2012-04-18T05:00:00", "2025-04-16T13:00:00", "min", null, null, "ev", "dcfc", 0.0, 0.0], ["moderate", "2025", 1, "moderate_2025", 1, "2012-04-18T05:00:00", "2025-04-16T13:00:00", "min", null, null, "ev", "l1l2", 284.711061946903, 307.48794690265527], ["moderate", "2025", 1, "moderate_2025", 1, "2012-04-18T05:00:00", "2025-04-16T13:00:00", "min", null, null, "gap", "other", 201.712384639549, 217.84937541071292], ["moderate", "2025", 1, "moderate_2025", 1, "2012-04-18T05:00:00", "2025-04-16T13:00:00", "min", null, null, "ind", "other", 1196.36519278737, 1292.0744082103597], ["moderate", "2025", 1, "moderate_2025", 1, "2012-04-18T05:00:00", "2025-04-16T13:00:00", "min", null, null, "misc", "other", 0.0, 0.0], ["moderate", "2025", 1, "moderate_2025", 1, "2012-04-18T05:00:00", "2025-04-16T13:00:00", "min", null, null, "res", "appliances", 101.25093281548, 109.3510074407184], ["moderate", "2025", 1, "moderate_2025", 1, "2012-04-18T05:00:00", "2025-04-16T13:00:00", "min", null, null, "res", "cooling", 260.147432639897, 280.95922725108875]].
Each column of text contains the following unique values {"load_scenario": "[('stress',), ('high',), ('moderate',)]", "year": "[('2030',), ('2045',), ('2040',), ('2035',), ('2025',), ('2020',)]", "scenario_year": "[('high_2020',), ('high_2025',), ('moderate_2035',), ('moderate_2030',), ('stress_2020',), ('stress_2040',), ('moderate_2045',), ('moderate_2025',), ('moderate_2040',), ('high_2035',), ('stress_2035',), ('moderate_2020',), ('stress_2030',), ('stress_2045',), ('stress_2025',), ('high_2045',), ('high_2030',), ('high_2040',)]", "week_type": "[('min',), ('winter',), ('peak',), ('fall',)]", "day_type": "[(None,), ('min',), ('winter',), ('peak',), ('fall',)]", "hour_type": "[(None,), ('min',), ('winter',), ('peak',), ('fall',)]", "sector": "[('misc',), ('ev',), ('com',), ('res',), ('wtr',), ('gap',), ('ind',)]", "enduse": "[('fans_and_pumps',), ('hot_water',), ('heating',), ('refrigeration',), ('plug_and_process',), ('lighting',), ('cooling',), ('pool',), ('bus',), ('dcfc',), ('appliances',), ('municipal_water',), ('l1l2',), ('other',)]"}.
The table name is loads.lc_day_profile_demand_enduse.
83 changes: 41 additions & 42 deletions examples/energy_wizard/test_db_wizard_v2.ipynb

Large diffs are not rendered by default.

0 comments on commit 78450ca

Please sign in to comment.