Compare commits
21 Commits
a4227ec165
...
v0.2.6
| Author | SHA1 | Date | |
|---|---|---|---|
| 2efb016646 | |||
| 216a8bdabb | |||
| cbaa480e84 | |||
| 6cb4073e29 | |||
| 42b8f5bdb1 | |||
| 35f1482228 | |||
| b4cac4f383 | |||
| 685ee7a48f | |||
| b55ae31e5b | |||
| e8e1764bb4 | |||
| e0b3ffa8e3 | |||
| ec9f44e5a1 | |||
| 6b3f8620e1 | |||
| 9cd37317d7 | |||
| 1577d7ae25 | |||
| c4e255ec2a | |||
| 681a91a0ca | |||
| c085a445e2 | |||
| bc81033924 | |||
| f5875dcb61 | |||
| 69208b2ffc |
+387
-211
File diff suppressed because it is too large
Load Diff
+5
-2
@@ -1,7 +1,7 @@
|
||||
name = "SQLLLM"
|
||||
uuid = "2ebc79c7-cc10-4a3a-9665-d2e1d61e63d3"
|
||||
version = "0.2.6"
|
||||
authors = ["narawat lamaiin <narawat@outlook.com>"]
|
||||
version = "0.2.4"
|
||||
|
||||
[deps]
|
||||
CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"
|
||||
@@ -11,7 +11,7 @@ Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
|
||||
FileIO = "5789e2e9-d7fb-5bc7-8068-2c6fae9b9549"
|
||||
GeneralUtils = "c6c72f09-b708-4ac8-ac7c-2084d70108fe"
|
||||
HTTP = "cd3eb016-35fb-5094-929b-558a96fad6f3"
|
||||
JSON3 = "0f8b85d8-7281-11e9-16c2-39a750bddbf1"
|
||||
JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
|
||||
LLMMCTS = "d76c5a4d-449e-4835-8cc4-dd86ec44f241"
|
||||
LibPQ = "194296ae-ab2e-5f79-8cd4-7183a0a5a0d1"
|
||||
PrettyPrinting = "54e16d92-306c-5ea0-a30b-337be88ac337"
|
||||
@@ -24,3 +24,6 @@ UUIDs = "cf7118a7-6976-5b1a-9a39-7adc72f591a4"
|
||||
|
||||
[compat]
|
||||
Dates = "1.11.0"
|
||||
GeneralUtils = "0.4.0 - 0.9.0"
|
||||
JSON = "1.6.1"
|
||||
LLMMCTS = "0.1.5 - 0.9.0"
|
||||
|
||||
+378
-717
File diff suppressed because it is too large
Load Diff
+72
-87
@@ -3,7 +3,7 @@ module llmfunction
|
||||
export listAllTable_json, listAllTable_str, tableinfo, getdata, finalAnswerBox,
|
||||
getTableNameFromSQL, extractContent_dataframe, SQLexecution, compareState
|
||||
|
||||
using HTTP, JSON3, URIs, Random, PrettyPrinting, UUIDs, LibPQ, Tables, DataFrames, CSV,
|
||||
using HTTP, JSON, URIs, Random, PrettyPrinting, UUIDs, LibPQ, Tables, DataFrames, CSV,
|
||||
DataStructures, StatsBase, Dates
|
||||
using GeneralUtils, LLMMCTS
|
||||
using ..util
|
||||
@@ -189,7 +189,7 @@ function tableinfo(executeSQL::Function, tablenames::T
|
||||
end
|
||||
end
|
||||
if !isempty(notExistingTable)
|
||||
result = "Error, the following tables does not exist in the database: $(JSON3.write(notExistingTable))"
|
||||
result = "Error, the following tables does not exist in the database: $(JSON.json(notExistingTable))"
|
||||
return (result=result,)
|
||||
end
|
||||
|
||||
@@ -287,17 +287,17 @@ function getdata_transition(state::T, args::NamedTuple
|
||||
# decisionMaker::Function = args[:decisionMaker]
|
||||
# evaluator::Function = args[:evaluator]
|
||||
# reflector::Function = args[:reflector]
|
||||
context = args[:context]
|
||||
executeSQL::Function = args[:executeSQL]
|
||||
text2textInstructLLM::Function = args[:text2textInstructLLM]
|
||||
context = args["context"]
|
||||
executeSQL::Function = args["executeSQL"]
|
||||
text2textInstructLLM::Function = args["text2textInstructLLM"]
|
||||
|
||||
thought, sql =
|
||||
if state[:code] !== nothing
|
||||
result = getdata_decisionMaker(state, context, text2textInstructLLM)
|
||||
result[:thought], result[:code]
|
||||
else
|
||||
nothing, state[:question]
|
||||
end
|
||||
thought, sql =
|
||||
if state["code"] !== nothing
|
||||
result = getdata_decisionMaker(state, context, text2textInstructLLM)
|
||||
result["thought"], result["code"]
|
||||
else
|
||||
nothing, state["question"]
|
||||
end
|
||||
|
||||
# make new state
|
||||
newNodeKey = GeneralUtils.uuid4snakecase()
|
||||
@@ -314,15 +314,15 @@ function getdata_transition(state::T, args::NamedTuple
|
||||
isterminal=false)
|
||||
end
|
||||
println("getdata_transition() 1 ", @__FILE__, " ", @__LINE__)
|
||||
newstate[:code] = sql
|
||||
newstate[:response] = response
|
||||
newstate[:errorexplain] = thought
|
||||
newstate[:errormsg] = errormsg
|
||||
newstate[:reward] = reward
|
||||
newstate[:isterminal] = isterminal
|
||||
newstate["code"] = sql
|
||||
newstate["response"] = response
|
||||
newstate["errorexplain"] = thought
|
||||
newstate["errormsg"] = errormsg
|
||||
newstate["reward"] = reward
|
||||
newstate["isterminal"] = isterminal
|
||||
if response !== nothing
|
||||
extracted = extractContent_dataframe(response, context, text2textInstructLLM)
|
||||
newstate[:response] = extracted
|
||||
newstate["response"] = extracted
|
||||
end
|
||||
println("getdata_transition() 2 ", @__FILE__, " ", @__LINE__)
|
||||
stateevaluation = "None"
|
||||
@@ -389,10 +389,10 @@ function getdata_decisionMaker(state::Dict, context::Dict, text2textInstructLLM:
|
||||
for attempt in 1:10
|
||||
usermsg = """
|
||||
Context:
|
||||
$(context[:mentionedTableInfo])
|
||||
User intention: $(context[:userintention])
|
||||
Code executed from the last round: $(state[:code])
|
||||
Execution error: $(state[:errormsg])
|
||||
$(context["mentionedTableInfo"])
|
||||
User intention: $(context["userintention"])
|
||||
Code executed from the last round: $(state["code"])
|
||||
Execution error: $(state["errormsg"])
|
||||
$noise
|
||||
$note_flag
|
||||
"""
|
||||
@@ -414,13 +414,13 @@ function getdata_decisionMaker(state::Dict, context::Dict, text2textInstructLLM:
|
||||
dictkey = ["plan", "code"]
|
||||
|
||||
responsedict = GeneralUtils.textToDict(response, header;
|
||||
dictKey=dictkey, symbolkey=true)
|
||||
_code = responsedict[:code]
|
||||
dictKey=dictkey, symbolkey=false)
|
||||
_code = responsedict["code"]
|
||||
code = strip(_code)
|
||||
|
||||
if length(code) < 2
|
||||
error("No code available.")
|
||||
elseif code == state[:code]
|
||||
elseif code == state["code"]
|
||||
error("generated code is the same as earlier.")
|
||||
else
|
||||
end
|
||||
@@ -440,7 +440,7 @@ function getdata_decisionMaker(state::Dict, context::Dict, text2textInstructLLM:
|
||||
|
||||
println("\n~~~ getdata_decisionMaker() ", @__FILE__, " ", @__LINE__)
|
||||
pprintln(Dict(responsedict))
|
||||
return (thought=responsedict[:comprehension], code=code, success=true, errormsg=nothing)
|
||||
return (thought=responsedict["comprehension"], code=code, success=true, errormsg=nothing)
|
||||
catch e
|
||||
io = IOBuffer()
|
||||
showerror(io, e)
|
||||
@@ -481,20 +481,9 @@ julia> response = SQLLLM.SQLexecution(executeSQL, sql)
|
||||
# Signature
|
||||
"""
|
||||
function SQLexecution(executeSQL::Function, sql::T
|
||||
) where {T<:AbstractString}
|
||||
)::NamedTuple where {T<:AbstractString}
|
||||
|
||||
try
|
||||
#XXX dummy SQL. use for testing
|
||||
# sql = "SELECT w.wine_name FROM wine w JOIN wine_food wf ON w.wine_id = wf.wine_id JOIN food f ON wf.food_id = f.food_id WHERE f.\"food_name\" = 'lamb';"
|
||||
# sql = " SELECT w.wine_name FROM wine w JOIN food f ON f.food_name = 'lamb' JOIN wine_food wf ON w.wine_id = wf.wine_id AND f.food_id = wf.food_id GROUP BY w.wine_name ORDER BY COUNT(DISTINCT w.wine_id) DESC;"
|
||||
# sql = " SELECT COUNT(DISTINCT wf.wine_id) FROM wine w JOIN wine_food wf ON w.wine_id = wf.wine_id JOIN food f ON wf.food_id = f.food_id WHERE f.food_name ILIKE '%lamb%'"
|
||||
|
||||
#XXX use for package testing, remove when done
|
||||
# ans = "1.schilfwein zweigelt 2.cabernet sauvignon reserve limited edition"
|
||||
# ans = "There are 1500 wines that can be paired with lamb."
|
||||
# ans = "1500"
|
||||
# return (response=ans, errormsg=nothing, reward=1, isterminal=true)
|
||||
|
||||
# add LIMIT to the SQL to prevent loading large data
|
||||
sql = strip(sql)
|
||||
|
||||
@@ -508,39 +497,36 @@ function SQLexecution(executeSQL::Function, sql::T
|
||||
else
|
||||
sql = sql * ";"
|
||||
end
|
||||
println("\n~~~ SQLexecution() SQL: ", @__FILE__, " ", @__LINE__)
|
||||
println(sql)
|
||||
|
||||
result = executeSQL(sql)
|
||||
df = DataFrame(result)
|
||||
|
||||
tablesize = size(df)
|
||||
row, column = tablesize
|
||||
if row == 0
|
||||
error("\nThe resulting table has 0 row. Please try again.")
|
||||
return (result_str="The resulting table has 0 row.", result_raw=df, success=true, errormsg=nothing)
|
||||
elseif column > 30
|
||||
error("\nSQL execution failed. An unexpected error occurred. Please try again.")
|
||||
return (result_str="There are more than 30 columns. Please be more specific.", result_raw=df, success=true, errormsg=nothing)
|
||||
else
|
||||
df1 =
|
||||
if row > 2
|
||||
# ramdom row to pick
|
||||
df[sample(1:nrow(df), 2, replace=false), :] # random select 2 rows from df
|
||||
else
|
||||
df
|
||||
end
|
||||
result = GeneralUtils.dfToString(df1)
|
||||
# println("\n~~~ SQLexecution() result: ", @__FILE__, " ", @__LINE__)
|
||||
# println(sql)
|
||||
# println(df1)
|
||||
# println("\n")
|
||||
return (result_str=result, result_raw=df1, success=true, errormsg=nothing)
|
||||
end
|
||||
|
||||
df1 =
|
||||
if row > 2
|
||||
# ramdom row to pick
|
||||
df[sample(1:nrow(df), 2, replace=false), :] # random select 2 rows from df
|
||||
else
|
||||
df
|
||||
end
|
||||
|
||||
println("\n~~~ SQLexecution() result: ", @__FILE__, " ", @__LINE__)
|
||||
println(df1)
|
||||
return (result=df1, success=true, errormsg=nothing)
|
||||
catch e
|
||||
io = IOBuffer()
|
||||
showerror(io, e)
|
||||
errorMsg = String(take!(io))
|
||||
st = sprint((io, v) -> show(io, "text/plain", v), stacktrace(catch_backtrace()))
|
||||
println(errorMsg)
|
||||
response = (result=nothing, success=false, errormsg=errorMsg)
|
||||
return response
|
||||
return (result_str=nothing, result_raw=nothing, success=false, errormsg=errorMsg)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -559,7 +545,7 @@ end
|
||||
- `result::String`
|
||||
|
||||
# Signature
|
||||
"""
|
||||
""" #WORKING
|
||||
function extractContent_dataframe(df::DataFrame, text2textInstructLLM::Function, action::String,
|
||||
llmFormatName::String
|
||||
)::String
|
||||
@@ -633,7 +619,7 @@ function extractContent_dataframe(df::DataFrame, text2textInstructLLM::Function,
|
||||
dictkey = ["about_resulting_table", "search_summary"]
|
||||
|
||||
for i in 1:5
|
||||
response = text2textInstructLLM(prompt, modelsize="medium")
|
||||
response = text2textInstructLLM("ramdom_id", prompt)
|
||||
response = GeneralUtils.deFormatLLMtext(response, llmFormatName)
|
||||
think, response = GeneralUtils.extractthink(response)
|
||||
|
||||
@@ -651,12 +637,11 @@ function extractContent_dataframe(df::DataFrame, text2textInstructLLM::Function,
|
||||
end
|
||||
|
||||
responsedict = GeneralUtils.textToDict(response, header;
|
||||
dictKey=dictkey, symbolkey=true)
|
||||
dictKey=dictkey, symbolkey=false)
|
||||
|
||||
# result = dfstr
|
||||
result =
|
||||
"""
|
||||
Summary: $(responsedict[:search_summary])
|
||||
Summary: $(responsedict["search_summary"])
|
||||
More details: $dfstr
|
||||
"""
|
||||
|
||||
@@ -778,8 +763,8 @@ function getTableNameFromSQL(sql::T, text2textInstructLLM::Function,
|
||||
response = text2textInstructLLM(prompt, modelsize="medium")
|
||||
response = GeneralUtils.deFormatLLMtext(response, llmFormatName)
|
||||
responsedict = GeneralUtils.textToDict(response, header;
|
||||
dictKey=dictkey, symbolkey=true)
|
||||
response = copy(JSON3.read(responsedict[:table_name]))
|
||||
dictKey=dictkey, symbolkey=false)
|
||||
response = copy(JSON.parse(responsedict["table_name"]))
|
||||
|
||||
return response
|
||||
catch e
|
||||
@@ -821,7 +806,7 @@ julia>
|
||||
|
||||
# Notes
|
||||
- The function makes up to 10 attempts to get a valid response from the LLM
|
||||
- Each state in highValueStateList should contain a thoughtHistory with action_input and observation
|
||||
- Each state in highValueStateList should contain a action_history with action_input and observation
|
||||
- The LLM evaluates attempts based on accuracy and relevance to the original question
|
||||
"""
|
||||
function compareState(question::String, highValueStateList::Vector{T},
|
||||
@@ -862,21 +847,21 @@ function compareState(question::String, highValueStateList::Vector{T},
|
||||
Let's begin!
|
||||
"""
|
||||
|
||||
potentialSolution = []
|
||||
keys = [:action_input, :observation]
|
||||
# extract the last action_name, action_input, observation of each state in highValueStateList and store them in a dictionary then push into potentialSolution
|
||||
for state in highValueStateList
|
||||
thoughtHistory = state[:thoughtHistory]
|
||||
_, currentstate_latestIndice =
|
||||
GeneralUtils.findHighestIndexKey(thoughtHistory, keys[1])
|
||||
latestKeys = makekey.(keys, currentstate_latestIndice)
|
||||
d = Dict()
|
||||
# get the last action_name, action_input, observation of currentstate
|
||||
for (i,v) in enumerate(keys)
|
||||
d[v] = thoughtHistory[latestKeys[i]]
|
||||
end
|
||||
push!(potentialSolution, d)
|
||||
end
|
||||
potentialSolution = []
|
||||
keys = ["action_input", "observation"]
|
||||
# extract the last action_name, action_input, observation of each state in highValueStateList and store them in a dictionary then push into potentialSolution
|
||||
for state in highValueStateList
|
||||
action_history = state["action_history"]
|
||||
_, currentstate_latestIndice =
|
||||
GeneralUtils.findHighestIndexKey(action_history, keys[1])
|
||||
latestKeys = makekey.(keys, currentstate_latestIndice)
|
||||
d = Dict()
|
||||
# get the last action_name, action_input, observation of currentstate
|
||||
for (i,v) in enumerate(keys)
|
||||
d[v] = action_history[latestKeys[i]]
|
||||
end
|
||||
push!(potentialSolution, d)
|
||||
end
|
||||
|
||||
"""
|
||||
# put potential solutions from potentialSolution into the following form
|
||||
@@ -944,11 +929,11 @@ function compareState(question::String, highValueStateList::Vector{T},
|
||||
continue
|
||||
end
|
||||
|
||||
responsedict = GeneralUtils.textToDict(response, header; dictKey=dictkey, symbolkey=true)
|
||||
responsedict = GeneralUtils.textToDict(response, header; dictKey=dictkey, symbolkey=false)
|
||||
|
||||
responsedict[:selected_response_number] = responsedict[:selected_response_number][1] # some time "6\nThe trajectories are incomplete" is generated but I only need the number.
|
||||
try
|
||||
responsedict[:selected_response_number] = parse(Int, responsedict[:selected_response_number]) # convert string "5" into integer 5
|
||||
responsedict["selected_response_number"] = responsedict["selected_response_number"][1] # some time "6\nThe trajectories are incomplete" is generated but I only need the number.
|
||||
try
|
||||
responsedict["selected_response_number"] = parse(Int, responsedict["selected_response_number"]) # convert string "5" into integer 5
|
||||
catch
|
||||
errornote = "In your previous attempt, Selected_response_number was not a number. It must be a number."
|
||||
println("\nERROR SQLLLM compareState() Attempt $attempt. $errornote ", @__FILE__, ":", @__LINE__, " $(Dates.now())")
|
||||
@@ -958,7 +943,7 @@ function compareState(question::String, highValueStateList::Vector{T},
|
||||
println("\n~~~ compareState() ", @__FILE__, ":", @__LINE__, " $(Dates.now())")
|
||||
pprintln(Dict(responsedict))
|
||||
|
||||
return responsedict[:selected_response_number]
|
||||
return responsedict["selected_response_number"]
|
||||
end
|
||||
error("compareState() failed to generate an evaluation, Response: \n$response\n<|End of error|>", @__FILE__, ":", @__LINE__, " $(Dates.now())")
|
||||
end
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@ module util
|
||||
|
||||
export makekey
|
||||
|
||||
makekey(key, indice) = Symbol("$(key)_$indice")
|
||||
makekey(key, indice) = "$(key)_$indice"
|
||||
|
||||
|
||||
|
||||
|
||||
+9
-9
@@ -1,9 +1,9 @@
|
||||
using Revise
|
||||
using LibPQ, Dates, JSON3, PrettyPrinting, UUIDs, DataFrames, DataStructures, Base64
|
||||
using LibPQ, Dates, JSON, PrettyPrinting, UUIDs, DataFrames, DataStructures, Base64
|
||||
using GeneralUtils, SQLLLM
|
||||
|
||||
|
||||
config = JSON3.read("/appfolder/app/dev/YiemAgent/test/config.json")
|
||||
config = JSON.parse("/appfolder/app/dev/YiemAgent/test/config.json")
|
||||
|
||||
function executeSQL(sql::T) where {T<:AbstractString}
|
||||
host = config[:externalservice][:wineDB][:host]
|
||||
@@ -137,7 +137,7 @@ end
|
||||
function insertSQLVectorDB(query::T1, SQL::T2; maxdistance::Integer=3) where {T1<:AbstractString, T2<:AbstractString}
|
||||
tablename = "sqlllm_decision_repository"
|
||||
# get embedding of the query
|
||||
# query = state[:thoughtHistory][:question]
|
||||
# query = state[:action_history][:question]
|
||||
df = findSimilarTextFromVectorDB(query, tablename,
|
||||
"function_input_embedding", executeSQLVectorDB)
|
||||
row, col = size(df)
|
||||
@@ -173,7 +173,7 @@ function similarSommelierDecision(recentevents::T1; maxdistance::Integer=3
|
||||
println("\n~~~ found similar decision. row id $rowid, distance $distance ", @__FILE__, " ", @__LINE__)
|
||||
output_b64 = df[1, :function_output_base64] # pick the closest match
|
||||
_output_str = String(base64decode(output_b64))
|
||||
output = copy(JSON3.read(_output_str))
|
||||
output = copy(JSON.parse(_output_str))
|
||||
return output
|
||||
else
|
||||
println("\n~~~ similar decision not found, max distance $maxdistance ", @__FILE__, " ", @__LINE__)
|
||||
@@ -193,7 +193,7 @@ function insertSommelierDecision(recentevents::T1, decision::T2; maxdistance::In
|
||||
if row == 0 || distance > maxdistance # no close enough SQL stored in the database
|
||||
recentevents_embedding = getEmbedding(recentevents)[1]
|
||||
recentevents = replace(recentevents, "'" => "")
|
||||
decision_json = JSON3.write(decision)
|
||||
decision_json = JSON.json(decision)
|
||||
decision_base64 = base64encode(decision_json)
|
||||
decision = replace(decision_json, "'" => "")
|
||||
|
||||
@@ -212,14 +212,14 @@ sessionId = GeneralUtils.uuid4snakecase()
|
||||
d = Dict(:id => sessionId)
|
||||
filepath = "/appfolder/app/sessionid.json"
|
||||
open(filepath, "w") do io
|
||||
JSON3.pretty(io, d)
|
||||
JSON.pretty(io, d)
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
# query = "How many German wines do you have?"
|
||||
# highValueStateList = copy(JSON3.read("/appfolder/app/highValueState_1.json"))
|
||||
# highValueStateList = copy(JSON.parse("/appfolder/app/highValueState_1.json"))
|
||||
# selectedState = SQLLLM.compareState(query, highValueStateList, text2textInstructLLM)
|
||||
|
||||
|
||||
@@ -352,8 +352,8 @@ SELECT * FROM wine WHERE wine_type = 'red' AND country = 'France' AND sweetness
|
||||
# :evaluation =>
|
||||
# "The user's question is to search the database for wines that have a type of \"white\", are from \"France\", and have a sweetness level of 1. The thought is correct in identifying the conditions needed to filter the wine table. The action taken is to execute a SQL query to retrieve the desired data, which is also correct. The observation provides a search summary and two search results that match the user's question. Each result includes details about the wine such as ID, name, brand, manufacturer, region, country, type, grape variety, serving temperature, intensity, sweetness, tannin, and acidity.",
|
||||
# :accepted_as_answer => "Yes",
|
||||
# :thoughtHistory =>
|
||||
# OrderedDict{Symbol, Any}(:question => "Search the database for wine_type: white, country: France, sweetness: 1", :thought_1 => "The user wants to search the database for wines that have a type of \"white\", are from \"France\", and have a sweetness level of 1. To achieve this, we need to filter the wine table based on these conditions.", :action_name_1 => "GETDATA", :action_input_1 => "SELECT * FROM wine WHERE wine.wine_type = 'white' AND wine.country = 'France' AND wine.sweetness = 1;", :observation_1 => "\"Search summary: The resulting table represents wines.\\nSearch result: 1) wine_id: 5b6b6df9-d87c-4f33-8995-7249c2ecc917, wine_name: corton-charlemagne grand cru, brand: domaine des croix, manufacturer: domaine des croix, region: bourgogne, country: France, wine_type: white, grape_variety: cote de beaune blanc, serving_temperature: 11 to 13 Celsius, intensity: 4, sweetness: 1, tannin: missing, acidity: 3, fizziness: missing\\n2) wine_id: 1ad27d16-ef64-4907-acf1-40631630c143, wine_name: puligny-montrachet 1er cru 'les demoiselles', brand: amiot guy, manufacturer: amiot guy, region: bourgogne, country: France, wine_type: white, grape_variety: cote de beaune blanc, serving_temperature: 11 to 13 Celsius, intensity: 4, sweetness: 1, tannin: missing, acidity: 3, fizziness: missing\\n\\n\""),
|
||||
# :action_history =>
|
||||
# OrderedDict{String, Any}("question" => "Search the database for wine_type: white, country: France, sweetness: 1", "thought_1" => "The user wants to search the database for wines that have a type of \"white\", are from \"France\", and have a sweetness level of 1. To achieve this, we need to filter the wine table based on these conditions.", "action_name_1" => "GETDATA", "action_input_1" => "SELECT * FROM wine WHERE wine.wine_type = 'white' AND wine.country = 'France' AND wine.sweetness = 1;", "observation_1" => "\"Search summary: The resulting table represents wines.\\nSearch result: 1) wine_id: 5b6b6df9-d87c-4f33-8995-7249c2ecc917, wine_name: corton-charlemagne grand cru, brand: domaine des croix, manufacturer: domaine des croix, region: bourgogne, country: France, wine_type: white, grape_variety: cote de beaune blanc, serving_temperature: 11 to 13 Celsius, intensity: 4, sweetness: 1, tannin: missing, acidity: 3, fizziness: missing\\n2) wine_id: 1ad27d16-ef64-4907-acf1-40631630c143, wine_name: puligny-montrachet 1er cru 'les demoiselles', brand: amiot guy, manufacturer: amiot guy, region: bourgogne, country: France, wine_type: white, grape_variety: cote de beaune blanc, serving_temperature: 11 to 13 Celsius, intensity: 4, sweetness: 1, tannin: missing, acidity: 3, fizziness: missing\\n\\n\""),
|
||||
# :evaluationscore => 9,
|
||||
# :select => nothing,
|
||||
# :suggestion => "None")
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
using Revise
|
||||
using LibPQ, JSON3, PrettyPrinting, UUIDs, DataFrames, DataStructures, Dates, MQTTClient, Random
|
||||
using LibPQ, JSON, PrettyPrinting, UUIDs, DataFrames, DataStructures, Dates, MQTTClient, Random
|
||||
using SQLLLM, GeneralUtils
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ df = DataFrame(result)
|
||||
|
||||
|
||||
|
||||
config = copy(JSON3.read("config.json"))
|
||||
config = copy(JSON.parse("config.json"))
|
||||
|
||||
msgMeta = GeneralUtils.generate_msgMeta(
|
||||
config[:externalservice][:text2textinstruct][:mqtttopic];
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
# using Revise
|
||||
# using SQLLLM, LLMMCTS, DataStructures, JSON3
|
||||
# using SQLLLM, LLMMCTS, DataStructures, JSON
|
||||
|
||||
# query = "How many German wines do you have?"
|
||||
# highValueStateList = copy(JSON3.read("/appfolder/app/highValueState_1.json"))
|
||||
# highValueStateList = copy(JSON.parse("/appfolder/app/highValueState_1.json"))
|
||||
# selectedState = SQLLLM.compareState(query, highValueStateList)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user