This commit is contained in:
narawat lamaiin
2024-10-13 06:39:05 +07:00
parent be10d24d61
commit 7b2d85da48
2 changed files with 7 additions and 7 deletions

View File

@@ -499,7 +499,7 @@ julia>
function evaluator(state::T1, text2textInstructLLM::Function;
addSQLVectorDB::Union{Function, Nothing}=nothing
) where {T1<:AbstractDict}
println("Evaluating state", @__FILE__, " ", @__LINE__)
# systemmsg =
# """
# You are a helpful assistant that analyzes agent's trajectories to find solutions and observations (i.e., the results of actions) to answer the user's questions.
@@ -982,7 +982,7 @@ function transition(state::T, args::NamedTuple
if actionname == "listalltables"
# deepcopy(state[:virtualCustomerChatHistory]) because I want to keep it clean
# so that other simulation start from this same node is not contaminated with actioninput
listAllTable_json(executeSQLF) # virtual customer
listAllTable_json(executeSQLF)
elseif actionname == "TABLEINFO"
input = copy(JSON3.read(actioninput))
tableinfo(executeSQLF, input)
@@ -1002,7 +1002,7 @@ function transition(state::T, args::NamedTuple
success::Bool = haskey(response, :success) ? response[:success] : false
newNodeKey, newstate = makeNewState(state, thoughtDict, JSON3.write(result), select, reward, isterminal)
println("SQLLLM transition() 1 ", @__FILE__, " ", @__LINE__)
progressvalue::Integer = evaluatorF(newstate, text2textInstructLLM;
addSQLVectorDB=addSQLVectorDBF)
@@ -1090,8 +1090,8 @@ function query(query::T, executeSQL::Function, text2textInstructLLM::Function;
addSQLVectorDB::Union{Function, Nothing}=nothing,
querySQLVectorDB::Union{Function, Nothing}=nothing
)::String where {T<:AbstractString}
# add extra context for Evaluator so that it knows the observation is from seaching a database
query = "Search the database for " * query
#[WORKING] add extra context for Evaluator so that it knows the observation is from seaching a database
query = "Search the database for {$query}"
initialstate = Dict{Symbol, Any}(
:reward=> 0,
:isterminal=> false,

View File

@@ -341,7 +341,7 @@ function getdata_transition(state::T, args::NamedTuple
reward=0,
isterminal=false)
end
println("getdata_transition() 1 ", @__FILE__, " ", @__LINE__)
newstate[:code] = sql
newstate[:response] = response
newstate[:errorexplain] = thought
@@ -352,7 +352,7 @@ function getdata_transition(state::T, args::NamedTuple
extracted = extractContent_dataframe(response, context, text2textInstructLLM)
newstate[:response] = extracted
end
println("getdata_transition() 2 ", @__FILE__, " ", @__LINE__)
stateevaluation = "None"
progressvalue = 0