diff --git a/Manifest.toml b/Manifest.toml index 6e1d586..8c75035 100644 --- a/Manifest.toml +++ b/Manifest.toml @@ -214,7 +214,7 @@ deps = ["Random"] uuid = "9fa8497b-333b-5362-9e8d-4d0656e87820" [[deps.GeneralUtils]] -deps = ["DataStructures", "Dates", "Distributions", "JSON3", "MQTTClient", "Random", "Revise", "UUIDs"] +deps = ["CSV", "DataFrames", "DataStructures", "Dates", "Distributions", "JSON3", "MQTTClient", "Random", "Revise", "UUIDs"] path = "/appfolder/app/privatejuliapkg/GeneralUtils" uuid = "c6c72f09-b708-4ac8-ac7c-2084d70108fe" version = "0.1.0" diff --git a/src/interface.jl b/src/interface.jl index bd82554..c42ab8a 100644 --- a/src/interface.jl +++ b/src/interface.jl @@ -23,7 +23,7 @@ using LLMMCTS, GeneralUtils A number to limit how many attempt will be made. # Return - - `(response, errormsg, success)::NamedTuple` + - `(response, errormsg, success)::@NamedTuple{response::String, errormsg::String, success::Bool}` if success=`true`, response is a valid JSON string. otherwise, check errormsg. # Example @@ -91,8 +91,8 @@ julia> println(result) # Signature """ -function jsoncorrection(jsonstring::T, example::String, commfunction::Function; - maxattempt=3)::NamedTuple where {T<:AbstractString} +function jsoncorrection(jsonstring::T, example::String, commfunction::Function; maxattempt=3 + )::@NamedTuple{response::String, errormsg::String, success::Bool} where {T<:AbstractString} initialstate = Dict{Symbol, Any}( :reward=> 0, @@ -116,9 +116,9 @@ function jsoncorrection(jsonstring::T, example::String, commfunction::Function; totalsample=1, maxdepth=(maxattempt-1), maxiterations=1, explorationweight=1.0) if result[:isterminal] == true - return (response=result[:code], errormsg=nothing, success=true) + return (response=result[:code], errormsg="nothing", success=true) else - return (response=nothing, errormsg=result[:errorexplain], success=false) + return (response="nothing", errormsg=result[:errorexplain], success=false) end end