update
This commit is contained in:
@@ -23,7 +23,7 @@ using LLMMCTS, GeneralUtils
|
||||
A number to limit how many attempt will be made.
|
||||
|
||||
# Return
|
||||
- `(response, errormsg, success)::@NamedTuple{response::String, errormsg::String, success::Bool}`
|
||||
- `NamedTuple{(:result, :errormsg, :success), Tuple{Union{String, Nothing}, Union{String, Nothing}, Bool}}`
|
||||
if success=`true`, response is a valid JSON string. otherwise, check errormsg.
|
||||
|
||||
# Example
|
||||
@@ -92,7 +92,7 @@ julia> println(result)
|
||||
# Signature
|
||||
"""
|
||||
function jsoncorrection(jsonstring::T, example::String, commfunction::Function; maxattempt=3
|
||||
)::@NamedTuple{response::String, errormsg::String, success::Bool} where {T<:AbstractString}
|
||||
)::NamedTuple{(:result, :errormsg, :success), Tuple{Union{String, Nothing}, Union{String, Nothing}, 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 (result=result[:code], errormsg=nothing, success=true)
|
||||
else
|
||||
return (response="nothing", errormsg=result[:errorexplain], success=false)
|
||||
return (result=nothing, errormsg=result[:errorexplain], success=false)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user