From 04eb85b67e59119c08fc088d0639ee2598432bab Mon Sep 17 00:00:00 2001 From: narawat lamaiin Date: Mon, 14 Oct 2024 12:50:00 +0700 Subject: [PATCH] update --- src/interface.jl | 4 ++-- src/llmfunction.jl | 34 +++++++++++++++++----------------- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/interface.jl b/src/interface.jl index f75b374..47dd682 100644 --- a/src/interface.jl +++ b/src/interface.jl @@ -653,7 +653,7 @@ function evaluator(state::T1, text2textInstructLLM::Function; 1) Trajectory_evaluation: Analyze the trajectory of a solution to answer the user's original question. - Evaluate the correctness of each section and the overall trajectory based on the given question. - Provide detailed reasoning and analysis, focusing on the latest thought, action, and observation. - - Incomplete trajectories are acceptable if the thoughts and actions up to that point are correct, even if the final answer isn't reached. + - Incomplete trajectory are acceptable if the thoughts and actions up to that point are correct, even if the final answer isn't reached. - Do not generate additional thoughts or actions. 2) Answer_evaluation: - Focus only on the matter mentioned in the question and comprehensively analyze how the latest observation's details addresses the question @@ -744,7 +744,7 @@ function evaluator(state::T1, text2textInstructLLM::Function; addSQLVectorDB(state) end end - println("~~~ Evaluator() ", @__FILE__, " ", @__LINE__) + println("\n~~~ Evaluator() ", @__FILE__, " ", @__LINE__) pprintln(Dict(responsedict)) return responsedict[:score] diff --git a/src/llmfunction.jl b/src/llmfunction.jl index 92707e1..5b7c99d 100644 --- a/src/llmfunction.jl +++ b/src/llmfunction.jl @@ -518,7 +518,7 @@ function getdata_decisionMaker(state::Dict, context::Dict, text2textInstructLLM: else end - println("~~~ getdata_decisionMaker() ", @__FILE__, " ", @__LINE__) + println("\n~~~ getdata_decisionMaker() ", @__FILE__, " ", @__LINE__) pprintln(Dict(responsedict)) return (thought=responsedict[:reasoning], code=code, success=true, errormsg=nothing) catch e @@ -562,7 +562,7 @@ julia> response = SQLLLM.SQLexecution(executeSQL, sql) """ # function SQLexecution(executeSQL::Function, sql::T # )::NamedTuple{(:result, :success, :errormsg, :reward, :isterminal), Tuple{Union{DataFrame, Nothing}, Bool, Union{String, Nothing}, Integer, Bool}} where {T<:AbstractString} -# println("~~~ 1-01 ", @__FILE__, " ", @__LINE__) +# println("\n~~~ 1-01 ", @__FILE__, " ", @__LINE__) # #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;" @@ -576,37 +576,37 @@ julia> response = SQLLLM.SQLexecution(executeSQL, sql) # # add LIMIT to the SQL to prevent loading large data # sql = strip(sql) -# println("~~~ SQL 1", @__FILE__, " ", @__LINE__) +# println("\n~~~ SQL 1", @__FILE__, " ", @__LINE__) # println(sql) -# println("~~~ 1-02 ", @__FILE__, " ", @__LINE__) +# println("\n~~~ 1-02 ", @__FILE__, " ", @__LINE__) # if sql[end] != ';' # errorMsg = "Error, SQL execution failed because it does not ended with ';'" # return (result=nothing, success=false, errormsg=errorMsg, reward=0, isterminal=false) # end -# println("~~~ 1-03 ", @__FILE__, " ", @__LINE__) +# println("\n~~~ 1-03 ", @__FILE__, " ", @__LINE__) # if !occursin("LIMIT", sql) # # sql = sql[1:end-1] * " LIMIT 100;" # sql = sql[1:end-1] * " ORDER BY RANDOM() LIMIT 2;" # end -# println("~~~ SQL 2", @__FILE__, " ", @__LINE__) +# println("\n~~~ SQL 2", @__FILE__, " ", @__LINE__) # println(sql) -# println("~~~ 1-1 ", @__FILE__, " ", @__LINE__) +# println("\n~~~ 1-1 ", @__FILE__, " ", @__LINE__) # result = executeSQL(sql) -# println("~~~ 1-2 ", @__FILE__, " ", @__LINE__) +# println("\n~~~ 1-2 ", @__FILE__, " ", @__LINE__) # df = DataFrame(result) -# println("~~~ raw df ", df) +# println("\n~~~ raw df ", df) # tablesize = size(df) -# println("~~~ df size ", tablesize) -# println("~~~ 6 ", @__FILE__, " ", @__LINE__) +# println("\n~~~ df size ", tablesize) +# println("\n~~~ 6 ", @__FILE__, " ", @__LINE__) # row = tablesize[1] -# println("~~~ 7 ", @__FILE__, " ", @__LINE__) +# println("\n~~~ 7 ", @__FILE__, " ", @__LINE__) # if row == 0 # if 0 row # errorMsg = "The resulting table has 0 row. Possible causes: 1) SQL is incorrect 2) There is no data that match your search criteria." # return (result=nothing, success=false, errormsg=errorMsg, reward=0, isterminal=false) # end -# println("~~~ 8 ", @__FILE__, " ", @__LINE__) +# println("\n~~~ 8 ", @__FILE__, " ", @__LINE__) # df1 = # if row > 2 # # ramdom row to pick @@ -615,7 +615,7 @@ julia> response = SQLLLM.SQLexecution(executeSQL, sql) # df # end -# println("~~~ SQLexecution result ", @__FILE__, " ", @__LINE__) +# println("\n~~~ SQLexecution result ", @__FILE__, " ", @__LINE__) # println(df1) # return (result=df1, success=true, errormsg=nothing, reward=1, isterminal=true) # end @@ -644,7 +644,7 @@ function SQLexecution(executeSQL::Function, sql::T else error("Error, SQL execution failed because it does not ended with ';'") end - println("~~~ SQLexecution() SQL: ", @__FILE__, " ", @__LINE__) + println("\n~~~ SQLexecution() SQL: ", @__FILE__, " ", @__LINE__) println(sql) result = executeSQL(sql) @@ -666,7 +666,7 @@ function SQLexecution(executeSQL::Function, sql::T df end - println("~~~ SQLexecution() result: ", @__FILE__, " ", @__LINE__) + println("\n~~~ SQLexecution() result: ", @__FILE__, " ", @__LINE__) println(df1) return (result=df1, success=true, errormsg=nothing) catch e @@ -780,7 +780,7 @@ function extractContent_dataframe(df::DataFrame, context::Dict, text2textInstruc result *= "There are many more rows, but they are truncated because there are too many of them." end - println("~~~ extractContent_dataframe() ", @__FILE__, " ", @__LINE__) + println("\n~~~ extractContent_dataframe() ", @__FILE__, " ", @__LINE__) println(result) return result