Compare commits
6 Commits
e0b3ffa8e3
..
v0.2.5
| Author | SHA1 | Date | |
|---|---|---|---|
| 42b8f5bdb1 | |||
| 35f1482228 | |||
| b4cac4f383 | |||
| 685ee7a48f | |||
| b55ae31e5b | |||
| e8e1764bb4 |
+2
-2
@@ -759,10 +759,10 @@ uuid = "ea8e919c-243c-51af-8825-aaa63cd721ce"
|
||||
version = "0.7.0"
|
||||
|
||||
[[deps.SQLLLM]]
|
||||
deps = ["CSV", "DataFrames", "DataStructures", "Dates", "FileIO", "GeneralUtils", "HTTP", "JSON", "LLMMCTS", "LibPQ", "PrettyPrinting", "Random", "Revise", "StatsBase", "Tables", "URIs", "UUIDs"]
|
||||
deps = ["CSV", "DataFrames", "DataStructures", "Dates", "FileIO", "GeneralUtils", "HTTP", "JSON", "LibPQ", "PrettyPrinting", "Random", "Revise", "StatsBase", "Tables", "URIs", "UUIDs"]
|
||||
path = "."
|
||||
uuid = "2ebc79c7-cc10-4a3a-9665-d2e1d61e63d3"
|
||||
version = "0.2.4"
|
||||
version = "0.2.5"
|
||||
|
||||
[[deps.SQLStrings]]
|
||||
git-tree-sha1 = "55de0530689832b1d3d43491ee6b67bd54d3323c"
|
||||
|
||||
+1
-1
@@ -26,4 +26,4 @@ UUIDs = "cf7118a7-6976-5b1a-9a39-7adc72f591a4"
|
||||
Dates = "1.11.0"
|
||||
GeneralUtils = "0.4.0 - 0.9.0"
|
||||
JSON = "1.6.1"
|
||||
LLMMCTS = "0.1.5"
|
||||
LLMMCTS = "0.1.5 - 0.9.0"
|
||||
|
||||
+40
-41
@@ -371,10 +371,10 @@ function evaluator(state::T1, text2textInstructLLM::Function, llmFormatName::Str
|
||||
state["reward"] = responsedict["score"]
|
||||
end
|
||||
|
||||
println("\n--- SQLLLM evaluator() ", @__FILE__, ":", @__LINE__, " $(Dates.now())")
|
||||
pprintln(responsedict)
|
||||
println("---\n")
|
||||
|
||||
# println("\n--- SQLLLM evaluator() ", @__FILE__, ":", @__LINE__, " $(Dates.now())")
|
||||
# pprintln(responsedict)
|
||||
# println("---\n")
|
||||
# error(7777)
|
||||
return responsedict["score"]
|
||||
end
|
||||
error("Evaluator failed to generate an evaluation, Response: \n$response\n<|End of error|>")
|
||||
@@ -596,16 +596,16 @@ function transition(state::T, args::NamedTuple
|
||||
end
|
||||
|
||||
newNodeKey, newstate = makeNewState(state, thoughtDict, response)
|
||||
progressvalue::Integer =
|
||||
if response[:success]
|
||||
8 # for faster agent response. if success just skip evaluation
|
||||
else
|
||||
evaluatorF(newstate, text2textInstructLLM, llmFormatName)
|
||||
end
|
||||
progressvalue::Integer = evaluatorF(newstate, text2textInstructLLM, llmFormatName)
|
||||
# if response[:success]
|
||||
# 8 # for faster agent response. if success just skip evaluation
|
||||
# else
|
||||
# evaluatorF(newstate, text2textInstructLLM, llmFormatName)
|
||||
# end
|
||||
|
||||
println("\n--- SQLLLM transition() thoughtDict ", @__FILE__, ":", @__LINE__, " $(Dates.now())")
|
||||
pprintln(thoughtDict)
|
||||
println("---")
|
||||
# println("\n--- SQLLLM transition() thoughtDict ", @__FILE__, ":", @__LINE__, " $(Dates.now())")
|
||||
# pprintln(thoughtDict)
|
||||
# println("---")
|
||||
# error("SQLLLM transition() end")
|
||||
return (newNodeKey=newNodeKey, newstate=newstate, progressvalue=progressvalue)
|
||||
end
|
||||
@@ -727,42 +727,41 @@ function query(query::T, executeSQL::Function, text2textInstructLLM::Function;
|
||||
|
||||
systemmsg =
|
||||
"""
|
||||
<available_actions>
|
||||
- RUNSQL, which you can use to execute SQL against the database.
|
||||
action_input for this function must be a single SQL query to be executed against the database.
|
||||
For more effective text search, it's necessary to use case-insensitivity and the ILIKE operator.
|
||||
Do not wrap the SQL as it will be executed against the database directly and SQL must be ended with ';'.
|
||||
</available_actions>
|
||||
<situation>
|
||||
At each round of conversation, you will be given the following:
|
||||
- user question
|
||||
You are working under your mentor supervision and you are also eager to improve your helpfulness.
|
||||
</situation>
|
||||
<objective>
|
||||
Consult the database search guidelines. Then find the data from a database to satisfy the user's question.
|
||||
</objective>
|
||||
<your responsibility includes>
|
||||
Fulfill the objective.
|
||||
</your responsibility includes>
|
||||
<database search guidelines>
|
||||
# database search guidelines
|
||||
- Keep SQL queries focused only on the provided information.
|
||||
- Do not create any table in the database
|
||||
- A junction table can be used to link tables together. Another use case is for filtering data.
|
||||
- If you can't find a single table that can be used to answer the user's query, try joining multiple tables to see if you can obtain the answer.
|
||||
- Text information in the database usually stored in lower case. If your search returns empty, try using lower case to search.
|
||||
- If there is no search result from the database, remove the restrictive criteria until a search result is available, and proceed from there.
|
||||
</database search guidelines>
|
||||
<you should then respond to the user with interleaving plan, action_name, action_input>
|
||||
1) plan: Based on the current situation, state a complete action plan to complete the task. Be specific.
|
||||
2) action_name: (Typically corresponds to the execution of the first step in your plan) Can be one of the available_actions name
|
||||
3) action_input: The input to the action you are about to perform according to your plan.
|
||||
|
||||
# situation
|
||||
At each round of conversation, you will be given the following:
|
||||
- user question
|
||||
You are working under your mentor supervision and you are also eager to improve your helpfulness.
|
||||
|
||||
# objective
|
||||
Consult the database search guidelines. Then find the data from a database to satisfy the user's question.
|
||||
|
||||
# your responsibility includes
|
||||
Fulfill the objective.
|
||||
|
||||
# you should then respond to the user with interleaving plan, action_name, action_input
|
||||
1) **plan**, Based on the current situation, state a complete action plan to complete the task and rationale. Be specific.
|
||||
2) **action_name**, (Typically corresponds to the execution of the first step in your plan) Can be one of the available_actions name
|
||||
3) **action_input**, The input to the action you are about to perform according to your plan.
|
||||
After the action is executed you gets "action_result". It is the output from the action you selected.
|
||||
</you should then respond to the user with interleaving plan, action_name, action_input>
|
||||
<you should only respond in JSON format as described below>
|
||||
|
||||
# you should only respond in JSON format as described below
|
||||
"plan": "...",
|
||||
"action_name": "...",
|
||||
"action_input": "..."
|
||||
</you should only respond in JSON format as described below>
|
||||
|
||||
# available_actions
|
||||
**RUNSQL**, which you can use to execute SQL against the database.
|
||||
The input must be a single SQL query to be executed against the database.
|
||||
For more effective text search, it's necessary to use case-insensitivity and the ILIKE operator.
|
||||
Do not wrap the SQL as it will be executed against the database directly and SQL must be ended with ';'.
|
||||
"""
|
||||
|
||||
|
||||
@@ -975,7 +974,7 @@ function query(query::T, executeSQL::Function, text2textInstructLLM::Function;
|
||||
end
|
||||
|
||||
println("\n--- SQLLLM query() ", @__FILE__, ":", @__LINE__, " $(Dates.now())")
|
||||
println(resultState["result_raw"])
|
||||
# pprintln(resultState)
|
||||
println("---\n")
|
||||
|
||||
return (result_str=latest_action["action_result"], result_raw=resultState["result_raw"])
|
||||
@@ -1001,7 +1000,7 @@ function makeNewState(currentstate::T1, thoughtDict::T2, response::NamedTuple,
|
||||
if response[:success]
|
||||
thoughtDict["action_result"] = response[:result_str]
|
||||
else
|
||||
error(response[:errormsg])
|
||||
thoughtDict["action_result"] = response[:errormsg]
|
||||
end
|
||||
|
||||
newstate = deepcopy(currentstate)
|
||||
|
||||
Reference in New Issue
Block a user