Files
FormatCorrector/test/runtest.jl
narawat lamaiin 69c42beeca update
2024-06-25 07:26:57 +07:00

47 lines
1.5 KiB
Julia

using FormatCorrector
incorrectjson = "{\n \"explain\": \"The user is asking for information about wines that can be paired with lamb. This seems like a straightforward question, but it's not clear which database tables will contain the relevant information. I'll start by listing all available tables to see if any of them have columns related to wine and food pairing.\",\n \"plan\":\n \"1) List all tables in the database using 'listalltables',\n 2) Check each table for columns related to wine and food pairing\",\n \"action\": {\"name\": \"listalltables\", \"input\": \"\"},\n \"expectation\": \"A list of all available tables in the database, which will help me identify potential tables that might contain relevant information.\",\n \"observation\": \"\"\n}"
# incorrectjson = "{\"t\":5}"
context =
"""
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)
println(result)