This commit is contained in:
narawat lamaiin
2024-10-14 10:26:08 +07:00
parent 4ef968b86e
commit 8ceea33218
3 changed files with 10 additions and 14 deletions

BIN
core

Binary file not shown.

View File

@@ -650,12 +650,11 @@ function evaluator(state::T1, text2textInstructLLM::Function;
Trajectories: ... Trajectories: ...
You should then respond to the user with: You should then respond to the user with:
1) Trajectory_evaluation: 1) Trajectory_evaluation: Analyze the trajectory of a solution to answer the user's original question.
- Analyze the trajectories 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.
Then given a question and a trajectory, evaluate its correctness and provide your reasoning and - Provide detailed reasoning and analysis, focusing on the latest thought, action, and observation.
analysis in detail. Focus 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 trajectories can be correct if the thoughts and actions so far are correct, - Do not generate additional thoughts or actions.
even if the answer is not found yet. Do not generate additional thoughts or actions.
2) Answer_evaluation: 2) Answer_evaluation:
- Focus only on the matter mentioned in the question and comprehensively analyze how the latest observation's details addresses the question - Focus only on the matter mentioned in the question and comprehensively analyze how the latest observation's details addresses the question
- State your rationale - State your rationale
@@ -740,12 +739,12 @@ function evaluator(state::T1, text2textInstructLLM::Function;
# user score as reward because different answers hold different value for the user. # user score as reward because different answers hold different value for the user.
state[:reward] = responsedict[:score] state[:reward] = responsedict[:score]
#add to vectorDB # add to vectorDB
if addSQLVectorDB !== nothing if addSQLVectorDB !== nothing
addSQLVectorDB(state) addSQLVectorDB(state)
end end
end end
println("~~~ 5 Evaluator() ", @__FILE__, " ", @__LINE__) println("~~~ Evaluator() ", @__FILE__, " ", @__LINE__)
pprintln(Dict(responsedict)) pprintln(Dict(responsedict))
return responsedict[:score] return responsedict[:score]

View File

@@ -644,7 +644,7 @@ function SQLexecution(executeSQL::Function, sql::T
else else
error("Error, SQL execution failed because it does not ended with ';'") error("Error, SQL execution failed because it does not ended with ';'")
end end
println("~~~ SQL ", @__FILE__, " ", @__LINE__) println("~~~ SQLexecution() SQL: ", @__FILE__, " ", @__LINE__)
println(sql) println(sql)
result = executeSQL(sql) result = executeSQL(sql)
@@ -666,19 +666,16 @@ function SQLexecution(executeSQL::Function, sql::T
df df
end end
println("~~~ SQLexecution() ", @__FILE__, " ", @__LINE__) println("~~~ SQLexecution() result: ", @__FILE__, " ", @__LINE__)
println(df1) println(df1)
return (result=df1, success=true, errormsg=nothing) return (result=df1, success=true, errormsg=nothing)
catch e catch e
println("~~~ Error SQLexecution() 2 ", @__FILE__, " ", @__LINE__)
io = IOBuffer() io = IOBuffer()
showerror(io, e) showerror(io, e)
errorMsg = String(take!(io)) errorMsg = String(take!(io))
st = sprint((io, v) -> show(io, "text/plain", v), stacktrace(catch_backtrace())) st = sprint((io, v) -> show(io, "text/plain", v), stacktrace(catch_backtrace()))
println(errorMsg) println(errorMsg)
println("~~~ Error SQLexecution() 2.1 ", @__FILE__, " ", @__LINE__)
response = (result=nothing, success=false, errormsg=errorMsg) response = (result=nothing, success=false, errormsg=errorMsg)
println("~~~ Error SQLexecution() 2.2 ", @__FILE__, " ", @__LINE__)
return response return response
end end
end end