Skip to content

Commit

Permalink
Updated to stable v1
Browse files Browse the repository at this point in the history
  • Loading branch information
Cox, Jordan authored and Cox, Jordan committed Jan 4, 2024
1 parent 1725869 commit 9c6f6ec
Show file tree
Hide file tree
Showing 3 changed files with 395 additions and 611 deletions.
7 changes: 4 additions & 3 deletions elm/db_wiz.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,10 @@ def get_sql_for(self, query):
"""Take the raw user query and ask the LLM for a SQL query that will
get data to support a response
"""
e_query = ('{}\n\nPlease create a SQL query that will pull data '
'that can answer this user question and please only '
'return the SQL query with no commentary or preface: "{}"'
e_query = ('{}\n\nPlease create a SQL query that will answer this '
'user question: "{}"\n\n'
'Return all columns from the database. '
'Please only return the SQL query with no commentary or preface.'
.format(self.database_describe, query))
out = super().chat(e_query, temperature=0)
return out
Expand Down
2 changes: 2 additions & 0 deletions examples/energy_wizard/db_description.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
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.
Loading

0 comments on commit 9c6f6ec

Please sign in to comment.