update
This commit is contained in:
@@ -8,24 +8,50 @@ using LLMMCTS, GeneralUtils
|
||||
# ---------------------------------------------- 100 --------------------------------------------- #
|
||||
|
||||
|
||||
"""
|
||||
""" Attempt to correct JSON string.
|
||||
|
||||
# Arguments
|
||||
- `config::Dict`
|
||||
A config containing services and mqttbroker info
|
||||
|
||||
# Return
|
||||
|
||||
# Example
|
||||
```jldoctest
|
||||
julia>
|
||||
julia> config = Dict(
|
||||
:mqttServerInfo => Dict(
|
||||
:description => "mqtt server info",
|
||||
:port => 1883,
|
||||
:broker => "mqtt.yiem.cc"
|
||||
),
|
||||
:externalservice => Dict(
|
||||
:text2textinstruct => Dict(
|
||||
:mqtttopic => "/loadbalancer/requestingservice",
|
||||
:description => "text to text service with instruct LLM",
|
||||
:llminfo => Dict(:name => "llama3instruct")
|
||||
),
|
||||
)
|
||||
)
|
||||
julia> expectJSON =
|
||||
"
|
||||
Here is an expected JSON format:
|
||||
{
|
||||
explain: ...,
|
||||
plan: ...,
|
||||
action: {name: ..., input: ...},
|
||||
expectation: ...,
|
||||
observation: ...
|
||||
}
|
||||
"
|
||||
```
|
||||
|
||||
# TODO
|
||||
- [] update docstring
|
||||
- [] implement the function
|
||||
- [x] implement the function
|
||||
|
||||
# Signature
|
||||
"""
|
||||
function jsoncorrection(config::Dict, jsonstring::String, context; maxattempt=3)
|
||||
function jsoncorrection(config::Dict, jsonstring::String, example; maxattempt=3)
|
||||
|
||||
initialstate = Dict{Symbol, Any}(
|
||||
:reward=> 0,
|
||||
@@ -41,7 +67,7 @@ function jsoncorrection(config::Dict, jsonstring::String, context; maxattempt=3)
|
||||
|
||||
transitionargs = (
|
||||
config=config,
|
||||
context=context,
|
||||
context=example,
|
||||
)
|
||||
_, result = LLMMCTS.runMCTS(initialstate, transition, transitionargs;
|
||||
totalsample=1, maxdepth=(maxattempt-1), maxiterations=1, explorationweight=1.0)
|
||||
|
||||
Reference in New Issue
Block a user