update
This commit is contained in:
@@ -220,8 +220,8 @@ function decisionMaker(state::T1, context, text2textInstructLLM::Function,
|
|||||||
]
|
]
|
||||||
|
|
||||||
# put in model format
|
# put in model format
|
||||||
prompt = GeneralUtils.formatLLMtext(_prompt; formatname="qwen")
|
prompt = GeneralUtils.formatLLMtext(_prompt; formatname="llama3instruct")
|
||||||
response = text2textInstructLLM(prompt)
|
response = text2textInstructLLM(prompt, modelsize="medium")
|
||||||
|
|
||||||
# LLM tends to generate observation given that it is in the input
|
# LLM tends to generate observation given that it is in the input
|
||||||
response =
|
response =
|
||||||
@@ -271,7 +271,7 @@ function decisionMaker(state::T1, context, text2textInstructLLM::Function,
|
|||||||
|
|
||||||
# check whether response has all header
|
# check whether response has all header
|
||||||
detected_kw = GeneralUtils.detect_keyword(header, response)
|
detected_kw = GeneralUtils.detect_keyword(header, response)
|
||||||
if sum(values(detected_kw)) < length(header)
|
if 0 ∈ values(detected_kw)
|
||||||
errornote = "\nSQLLLM decisionMaker() response does not have all header"
|
errornote = "\nSQLLLM decisionMaker() response does not have all header"
|
||||||
continue
|
continue
|
||||||
elseif sum(values(detected_kw)) > length(header)
|
elseif sum(values(detected_kw)) > length(header)
|
||||||
@@ -321,7 +321,7 @@ function decisionMaker(state::T1, context, text2textInstructLLM::Function,
|
|||||||
|
|
||||||
# check whether response has all header
|
# check whether response has all header
|
||||||
detected_kw = GeneralUtils.detect_keyword(header, response)
|
detected_kw = GeneralUtils.detect_keyword(header, response)
|
||||||
if sum(values(detected_kw)) < length(header)
|
if 0 ∈ values(detected_kw)
|
||||||
errornote = "\nSQL decisionMaker() response does not have all header"
|
errornote = "\nSQL decisionMaker() response does not have all header"
|
||||||
continue
|
continue
|
||||||
elseif sum(values(detected_kw)) > length(header)
|
elseif sum(values(detected_kw)) > length(header)
|
||||||
@@ -446,12 +446,12 @@ function evaluator(state::T1, text2textInstructLLM::Function
|
|||||||
]
|
]
|
||||||
|
|
||||||
# put in model format
|
# put in model format
|
||||||
prompt = GeneralUtils.formatLLMtext(_prompt; formatname="qwen")
|
prompt = GeneralUtils.formatLLMtext(_prompt; formatname="llama3instruct")
|
||||||
|
|
||||||
header = ["Trajectory_evaluation:", "Answer_evaluation:", "Accepted_as_answer:", "Score:", "Suggestion:"]
|
header = ["Trajectory_evaluation:", "Answer_evaluation:", "Accepted_as_answer:", "Score:", "Suggestion:"]
|
||||||
dictkey = ["trajectory_evaluation", "answer_evaluation", "accepted_as_answer", "score", "suggestion"]
|
dictkey = ["trajectory_evaluation", "answer_evaluation", "accepted_as_answer", "score", "suggestion"]
|
||||||
|
|
||||||
response = text2textInstructLLM(prompt)
|
response = text2textInstructLLM(prompt, modelsize="medium")
|
||||||
|
|
||||||
# sometime LLM output something like **Comprehension**: which is not expected
|
# sometime LLM output something like **Comprehension**: which is not expected
|
||||||
response = replace(response, "**"=>"")
|
response = replace(response, "**"=>"")
|
||||||
@@ -459,7 +459,7 @@ function evaluator(state::T1, text2textInstructLLM::Function
|
|||||||
|
|
||||||
# check whether response has all header
|
# check whether response has all header
|
||||||
detected_kw = GeneralUtils.detect_keyword(header, response)
|
detected_kw = GeneralUtils.detect_keyword(header, response)
|
||||||
if sum(values(detected_kw)) < length(header)
|
if 0 ∈ values(detected_kw)
|
||||||
errornote = "\nSQL evaluator() response does not have all header"
|
errornote = "\nSQL evaluator() response does not have all header"
|
||||||
continue
|
continue
|
||||||
elseif sum(values(detected_kw)) > length(header)
|
elseif sum(values(detected_kw)) > length(header)
|
||||||
@@ -601,7 +601,7 @@ function reflector(config::T1, state::T2)::String where {T1<:AbstractDict, T2<:A
|
|||||||
]
|
]
|
||||||
|
|
||||||
# put in model format
|
# put in model format
|
||||||
prompt = GeneralUtils.formatLLMtext(_prompt; formatname="qwen")
|
prompt = GeneralUtils.formatLLMtext(_prompt; formatname="llama3instruct")
|
||||||
externalService = config[:externalservice][:text2textinstruct]
|
externalService = config[:externalservice][:text2textinstruct]
|
||||||
|
|
||||||
# apply LLM specific instruct format
|
# apply LLM specific instruct format
|
||||||
@@ -998,7 +998,7 @@ function query(query::T, executeSQL::Function, text2textInstructLLM::Function;
|
|||||||
LLMMCTS.runMCTS(initialstate, transition, transitionargs;
|
LLMMCTS.runMCTS(initialstate, transition, transitionargs;
|
||||||
horizontalSampleExpansionPhase=3,
|
horizontalSampleExpansionPhase=3,
|
||||||
horizontalSampleSimulationPhase=2,
|
horizontalSampleSimulationPhase=2,
|
||||||
maxSimulationDepth=5,
|
maxSimulationDepth=5,
|
||||||
maxiterations=1,
|
maxiterations=1,
|
||||||
explorationweight=1.0,
|
explorationweight=1.0,
|
||||||
earlystop=earlystop,
|
earlystop=earlystop,
|
||||||
@@ -1172,10 +1172,10 @@ function generatequestion(state::T1, context, text2textInstructLLM::Function;
|
|||||||
]
|
]
|
||||||
|
|
||||||
# put in model format
|
# put in model format
|
||||||
prompt = GeneralUtils.formatLLMtext(_prompt; formatname="qwen")
|
prompt = GeneralUtils.formatLLMtext(_prompt; formatname="llama3instruct")
|
||||||
|
|
||||||
try
|
try
|
||||||
response = text2textInstructLLM(prompt)
|
response = text2textInstructLLM(prompt, modelsize="medium")
|
||||||
|
|
||||||
# check if response is valid
|
# check if response is valid
|
||||||
q_number = count("Q", response)
|
q_number = count("Q", response)
|
||||||
|
|||||||
@@ -406,9 +406,9 @@ function getdata_decisionMaker(state::Dict, context::Dict, text2textInstructLLM:
|
|||||||
]
|
]
|
||||||
|
|
||||||
# put in model format
|
# put in model format
|
||||||
prompt = GeneralUtils.formatLLMtext(_prompt; formatname="qwen")
|
prompt = GeneralUtils.formatLLMtext(_prompt; formatname="llama3instruct")
|
||||||
try
|
try
|
||||||
response = text2textInstructLLM(prompt)
|
response = text2textInstructLLM(prompt, modelsize="medium")
|
||||||
|
|
||||||
header = ["Comprehension:", "Plan:", "Code:"]
|
header = ["Comprehension:", "Plan:", "Code:"]
|
||||||
dictkey = ["comprehension", "plan", "code"]
|
dictkey = ["comprehension", "plan", "code"]
|
||||||
@@ -627,12 +627,12 @@ function extractContent_dataframe(df::DataFrame, text2textInstructLLM::Function,
|
|||||||
]
|
]
|
||||||
|
|
||||||
# put in model format
|
# put in model format
|
||||||
prompt = GeneralUtils.formatLLMtext(_prompt; formatname="qwen")
|
prompt = GeneralUtils.formatLLMtext(_prompt; formatname="llama3instruct")
|
||||||
header = ["About_resulting_table:", "Search_summary:"]
|
header = ["About_resulting_table:", "Search_summary:"]
|
||||||
dictkey = ["about_resulting_table", "search_summary"]
|
dictkey = ["about_resulting_table", "search_summary"]
|
||||||
|
|
||||||
for i in 1:5
|
for i in 1:5
|
||||||
response = text2textInstructLLM(prompt)
|
response = text2textInstructLLM(prompt, modelsize="medium")
|
||||||
|
|
||||||
kw = []
|
kw = []
|
||||||
# use for loop and detect_keyword function to get the exact variation of each keyword in the text then push to kw list
|
# use for loop and detect_keyword function to get the exact variation of each keyword in the text then push to kw list
|
||||||
@@ -762,13 +762,13 @@ function getTableNameFromSQL(sql::T, text2textInstructLLM::Function)::Vector{Str
|
|||||||
]
|
]
|
||||||
|
|
||||||
# put in model format
|
# put in model format
|
||||||
prompt = GeneralUtils.formatLLMtext(_prompt; formatname="qwen")
|
prompt = GeneralUtils.formatLLMtext(_prompt; formatname="llama3instruct")
|
||||||
header = ["Table_name:"]
|
header = ["Table_name:"]
|
||||||
dictkey = ["table_name"]
|
dictkey = ["table_name"]
|
||||||
|
|
||||||
for attempt in 1:5
|
for attempt in 1:5
|
||||||
try
|
try
|
||||||
response = text2textInstructLLM(prompt)
|
response = text2textInstructLLM(prompt, modelsize="medium")
|
||||||
responsedict = GeneralUtils.textToDict(response, header;
|
responsedict = GeneralUtils.textToDict(response, header;
|
||||||
dictKey=dictkey, symbolkey=true)
|
dictKey=dictkey, symbolkey=true)
|
||||||
response = copy(JSON3.read(responsedict[:table_name]))
|
response = copy(JSON3.read(responsedict[:table_name]))
|
||||||
@@ -914,12 +914,12 @@ function compareState(question::String, highValueStateList::Vector{T},
|
|||||||
]
|
]
|
||||||
|
|
||||||
# put in model format
|
# put in model format
|
||||||
prompt = GeneralUtils.formatLLMtext(_prompt; formatname="qwen")
|
prompt = GeneralUtils.formatLLMtext(_prompt; formatname="llama3instruct")
|
||||||
|
|
||||||
header = ["Comparison:", "Rationale:", "Selected_response_number:"]
|
header = ["Comparison:", "Rationale:", "Selected_response_number:"]
|
||||||
dictkey = ["comparison", "rationale", "selected_response_number"]
|
dictkey = ["comparison", "rationale", "selected_response_number"]
|
||||||
|
|
||||||
response = text2textInstructLLM(prompt)
|
response = text2textInstructLLM(prompt, modelsize="medium")
|
||||||
|
|
||||||
# sometime LLM output something like **Comprehension**: which is not expected
|
# sometime LLM output something like **Comprehension**: which is not expected
|
||||||
response = replace(response, "**"=>"")
|
response = replace(response, "**"=>"")
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
"""
|
"""
|
||||||
Default system message template:
|
Default system message template:
|
||||||
|
|
||||||
<Your profile>
|
<Your role>
|
||||||
- You are a helpful assistant
|
- You are a helpful assistant
|
||||||
</Your profile>
|
</Your role>
|
||||||
<Situation>
|
<Situation>
|
||||||
- Describe the current situation
|
- Describe the current situation
|
||||||
</Situation>
|
</Situation>
|
||||||
@@ -18,7 +18,10 @@ Default system message template:
|
|||||||
</Your mission's objective includes>
|
</Your mission's objective includes>
|
||||||
<Your responsibility includes>
|
<Your responsibility includes>
|
||||||
- state the mini goals that fall under your responsibility
|
- state the mini goals that fall under your responsibility
|
||||||
</Your responsibility includes>
|
</Your responsibility includes>
|
||||||
|
<Your responsibility does NOT includes>
|
||||||
|
-
|
||||||
|
</Your responsibility does NOT includes>
|
||||||
<At each round of conversation, you will be given the following>
|
<At each round of conversation, you will be given the following>
|
||||||
|
|
||||||
</At each round of conversation, you will be given the following>
|
</At each round of conversation, you will be given the following>
|
||||||
|
|||||||
Reference in New Issue
Block a user