47 lines
1.2 KiB
Julia
47 lines
1.2 KiB
Julia
using FormatCorrector
|
|
|
|
|
|
incorrectjson = " \"explain\": \"The user is asking about wines that are suitable for pairing with lamb. I need to explore the database to find relevant information.\",\n \"plan\":\n 1) List all tables in the database using the function `listalltables` to get an idea of what data is available.\n \"action\": {\"name\": \"listalltables\", \"input\": null},\n \"expectation\": The list of all tables in the database,\n \"observation\": null\n}"
|
|
|
|
context = Dict(
|
|
:expectedJsonExample=>
|
|
"""
|
|
Here is an expected JSON format:
|
|
{
|
|
"explain": ...,
|
|
"plan": ...,
|
|
"action": {"name": ..., "input": ...},
|
|
"expectation": ...,
|
|
"observation": ...
|
|
}
|
|
"""
|
|
)
|
|
|
|
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")
|
|
),
|
|
)
|
|
)
|
|
|
|
result = FormatCorrector.jsoncorrection(config, incorrectjson, context)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|