Skip to content

Commit

Permalink
Completed first tranche of db_wiz
Browse files Browse the repository at this point in the history
  • Loading branch information
Cox, Jordan authored and Cox, Jordan committed Mar 22, 2024
1 parent 78450ca commit a0b93d9
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
1 change: 1 addition & 0 deletions elm/db_wiz.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ def get_sql_for(self, query):
'Please only return the SQL query with no commentary or preface.'
.format(self.database_describe, query))
out = super().chat(e_query, temperature=0)
print(out)
return out

def run_sql(self, sql):
Expand Down
13 changes: 13 additions & 0 deletions examples/energy_wizard/run_db_wizard_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

st.set_option('deprecation.showPyplotGlobalUse', False)


if __name__ == '__main__':
wizard = DataBaseWizard(model = model, connection_string = conn_string)

Expand All @@ -46,6 +47,17 @@

if "messages" not in st.session_state:
st.session_state.messages = []
else:
if st.button('Clear Chat'):
# Clearing Messages
st.session_state.messages = []
for message in st.session_state.messages:
with st.chat_message(message["role"]):
st.markdown(message["content"])

# Clearing Wizard
wizard.clear()
wizard = DataBaseWizard(model = model, connection_string = conn_string)

for message in st.session_state.messages:
with st.chat_message(message["role"]):
Expand Down Expand Up @@ -75,3 +87,4 @@

#st.session_state.messages.append({"role": "assistant",
# "content": full_response})

2 changes: 1 addition & 1 deletion examples/energy_wizard/test_db_wizard_v2.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@
"AND week_type = 'winter'\n",
"AND sector = 'res'\n",
"AND enduse = 'heating'\n",
"AND load_center <= 5\n",
"AND load_center BETWEEN 1 AND 5\n",
"ORDER BY timestamp;\n"
]
}
Expand Down

0 comments on commit a0b93d9

Please sign in to comment.