jason137 commited on
Commit
2f02f10
·
1 Parent(s): 87601fe

Update script.py

Browse files
Files changed (1) hide show
  1. script.py +4 -9
script.py CHANGED
@@ -39,16 +39,11 @@ llm = OpenAI(temperature=0.0, openai_api_key=OPENAI_API_KEY)
39
  db = SQLDatabase.from_uri("sqlite:///Chinook.db", include_tables=TABLES)
40
  db_chain = SQLDatabaseChain.from_llm(llm, db, use_query_checker=True, return_intermediate_steps=True)
41
 
42
- # db_chain = SQLDatabaseChain.from_llm(llm, db, use_query_checker=True)
43
-
44
  for query in QUERIES:
45
 
46
- # result = db_chain.run(query)
47
- # print(result)
48
-
49
- result = db_chain(query)
50
 
51
  st.text("Q: %s" % query)
52
- st.text(result["intermediate_steps"])
53
- st.text("A: %s" % result)
54
-
 
39
  db = SQLDatabase.from_uri("sqlite:///Chinook.db", include_tables=TABLES)
40
  db_chain = SQLDatabaseChain.from_llm(llm, db, use_query_checker=True, return_intermediate_steps=True)
41
 
 
 
42
  for query in QUERIES:
43
 
44
+ output = db_chain(query)
45
+ sql, result = output[1], output[5]
 
 
46
 
47
  st.text("Q: %s" % query)
48
+ st.text(" (sql: %s)" % sql)
49
+ st.text("A: %s" % result)