This commit is contained in:
2025-03-19 11:29:31 +07:00
parent e6ce6f9954
commit 418c543d44
2 changed files with 160 additions and 30 deletions
+23 -19
View File
@@ -36,7 +36,7 @@ julia> result = response[:result]
# Signature
"""
function listAllTable_json(executeSQL::Function
)::NamedTuple{(:result, :success),Tuple{DataFrame,Bool}}
)::NamedTuple{(:result, :success),Tuple{DataFrame,Bool}}
sql = """
SELECT
@@ -788,32 +788,37 @@ function getTableNameFromSQL(sql::T, text2textInstructLLM::Function)::Vector{Str
end
""" Assigns a scalar value to each new child node to be used for selec-
tion and backpropagation. This value effectively quantifies the agent's progress in task completion,
serving as a heuristic to steer the search algorithm towards the most promising regions of the tree.
""" Compare multiple solution attempts and select the most accurate one.
This function evaluates multiple solution attempts for a given question and determines which attempt
provides the most accurate and relevant response. It uses an LLM to analyze and compare the attempts,
considering their actions and observations.
# Arguments
- `state<:AbstractDict`
one of Yiem's agent
- `text2textInstructLLM::Function`
A function that handles communication to LLM service
- `question::String`
The original question or task that was attempted to be solved
- `highValueStateList::Vector{Dict}`
List of states containing different solution attempts and their results
- `text2textInstructLLM::Function`
A function that handles communication to LLM service
# Return
- `score::Integer`
# Returns
- `Integer`
The index of the selected best response (1-based indexing)
# Example
```jldoctest
julia>
```
# TODO
- [] update docs
- [WORKING] implement
# Signature
# Notes
- The function makes up to 10 attempts to get a valid response from the LLM
- Each state in highValueStateList should contain a thoughtHistory with action_input and observation
- The LLM evaluates attempts based on accuracy and relevance to the original question
"""
function compareState(question::String, highValueStateList, text2textInstructLLM::Function)
println(typeof(highValueStateList))
function compareState(question::String, highValueStateList::Vector{Dict},
text2textInstructLLM::Function)::Integer
systemmsg =
"""
<Your profile>
@@ -947,7 +952,7 @@ function compareState(question::String, highValueStateList, text2textInstructLLM
return responsedict[:selected_response_number]
end
error("compareState failed to generate an evaluation, Response: \n$response\n<|End of error|>", @__FILE__, ":", @__LINE__, " $(Dates.now())")
error("compareState() failed to generate an evaluation, Response: \n$response\n<|End of error|>", @__FILE__, ":", @__LINE__, " $(Dates.now())")
end
@@ -988,7 +993,6 @@ end
end # module llmfunction