update
This commit is contained in:
40
src/util.jl
40
src/util.jl
@@ -229,7 +229,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
""" Check JSON format correctness, provide
|
""" Check JSON format correctness and provide feedback
|
||||||
|
|
||||||
Arguments\n
|
Arguments\n
|
||||||
-----
|
-----
|
||||||
@@ -237,6 +237,7 @@ end
|
|||||||
|
|
||||||
Return\n
|
Return\n
|
||||||
-----
|
-----
|
||||||
|
(correct, critique)
|
||||||
|
|
||||||
Example\n
|
Example\n
|
||||||
-----
|
-----
|
||||||
@@ -254,18 +255,18 @@ end
|
|||||||
"""
|
"""
|
||||||
function syntaxcheck_json(jsonstring::T)::NamedTuple where {T<:AbstractString}
|
function syntaxcheck_json(jsonstring::T)::NamedTuple where {T<:AbstractString}
|
||||||
error("--> syntaxcheck_json")
|
error("--> syntaxcheck_json")
|
||||||
# success, result, errormsg, st = GeneralUtils.showstracktrace(JSON3.read, jsonstring)
|
success, result, errormsg, st = GeneralUtils.showstracktrace(JSON3.read, jsonstring)
|
||||||
# if !success # gives feedback
|
if !success # gives feedback
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# else
|
else
|
||||||
|
|
||||||
|
|
||||||
# end
|
end
|
||||||
|
|
||||||
|
|
||||||
# return (success, result, critique)
|
return (success, critique)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@@ -306,27 +307,29 @@ function iterativeprompting(a::T, prompt::String, verification::Function) where
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
result = nothing
|
||||||
|
success = nothing
|
||||||
|
|
||||||
# iteration loop
|
# iteration loop
|
||||||
while true
|
while true
|
||||||
# send prompt to LLM
|
# send prompt to LLM
|
||||||
response = GeneralUtils.sendReceiveMqttMsg(outgoingMsg)
|
response = GeneralUtils.sendReceiveMqttMsg(outgoingMsg)
|
||||||
error("--> iterativeprompting")
|
error("--> iterativeprompting")
|
||||||
# check for correctness and get feedback
|
# check for correctness and get feedback
|
||||||
|
success, critique = verification(response)
|
||||||
|
|
||||||
# if correct
|
if success
|
||||||
|
result = response
|
||||||
# break
|
break
|
||||||
# else
|
else
|
||||||
# # get LLM critique
|
# add critique to prompt
|
||||||
|
end
|
||||||
# # add critique to prompt
|
|
||||||
# end
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
return response
|
return (success=sucess, result=response)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@@ -364,13 +367,6 @@ end
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user