update
This commit is contained in:
@@ -255,7 +255,7 @@ function decisionMaker(a::T)::Dict{Symbol, Any} where {T<:agent}
|
||||
5) mentioning_wine: Are you mentioning specific wine name to the user? Can be "Yes" or "No"
|
||||
|
||||
You should only respond in format as described below:
|
||||
thought: Let's think step by step. In order to ...
|
||||
thought: ...
|
||||
plan: ...
|
||||
action_name: ...
|
||||
action_input: ...
|
||||
@@ -1100,7 +1100,7 @@ function think(a::T)::NamedTuple{(:actionname, :result), Tuple{String, String}}
|
||||
elseif actionname == "PRESENTBOX"
|
||||
x = """
|
||||
1) Introduce $actioninput in details for the user to choose."
|
||||
2) compare each option against the others in details and explain why each one is a suitable match for the user's specific needs.
|
||||
2) Comprehensively compare each option against the others and explain why each one is a suitable match for the user's specific needs.
|
||||
"""
|
||||
(result=x, errormsg=nothing, success=true)
|
||||
elseif actionname == "ENDCONVERSATION"
|
||||
@@ -1292,6 +1292,7 @@ function generatechat(memory::Dict, chathistory::Vector, text2textInstructLLM::F
|
||||
|
||||
Your responsibility does not include:
|
||||
1) Processing sales orders or engaging in any other sales-related activities.
|
||||
2) Ordering the wines.
|
||||
|
||||
At each round of conversation, you will be given the current situation:
|
||||
Your conversation with the user: ...
|
||||
@@ -1307,7 +1308,7 @@ function generatechat(memory::Dict, chathistory::Vector, text2textInstructLLM::F
|
||||
You should then respond to the user with:
|
||||
1) chat: Given the situation, what would you say to convey your thoughts to the user?
|
||||
2) mentioning_wine: Are you mentioning specific wine name to the user? Can be "Yes" or "No"
|
||||
3) note: Put everything you want to add here
|
||||
3) note: Put everything you want to add here. Otherwise, put "NA"
|
||||
|
||||
You should only respond in format as described below:
|
||||
chat: ...
|
||||
@@ -1599,9 +1600,9 @@ function generatequestion(a, text2textInstructLLM::Function)::String
|
||||
|
||||
You should then respond to the user with:
|
||||
1) thought: State your reasoning about the current situation
|
||||
2) Q: Given the situation, "ask yourself" about the situation at least two, but no more than five, questions.
|
||||
2) Q: Given the situation, "ask yourself" about the situation at least three, but no more than ten, questions.
|
||||
3) A: Given the situation, "answer to yourself" the best you can
|
||||
4) note: Put everything you want to add here
|
||||
4) note: Additional info you want to say. Otherwise, "NA"
|
||||
|
||||
Here are some examples:
|
||||
Q: The user is asking for a cappuccino. Do I have it at my cafe?
|
||||
@@ -1611,18 +1612,18 @@ function generatequestion(a, text2textInstructLLM::Function)::String
|
||||
Q: Are they allergic to milk?
|
||||
A: Since they mentioned a cappuccino before, I think they are not allergic to milk.
|
||||
Q: Do I search the database yet?
|
||||
A: I've searched the database and found ...
|
||||
A: Not yet.
|
||||
Q: Did I introduce the wines to the user yet?
|
||||
A: Not yet. I will introduce the wines now.
|
||||
|
||||
You must only respond in format as described below:
|
||||
thought: ... , In order to ..., I should ask myself the following questions.
|
||||
Q_1: ...
|
||||
A_1: ...
|
||||
Q_2: ...
|
||||
A_2: ...
|
||||
Q_3: ...
|
||||
A_3: ...
|
||||
thought: ...
|
||||
Q1: ...
|
||||
A1: ...
|
||||
Q2: ...
|
||||
A2: ...
|
||||
Q3: ...
|
||||
A3: ...
|
||||
...
|
||||
note: ...
|
||||
|
||||
@@ -1663,15 +1664,15 @@ function generatequestion(a, text2textInstructLLM::Function)::String
|
||||
|
||||
try
|
||||
response = text2textInstructLLM(prompt)
|
||||
q_number = count("Q_", response)
|
||||
if q_number < 1
|
||||
q_number = count("Q", response)
|
||||
if q_number < 3
|
||||
error("too few questions only $q_number questions are generated ", @__FILE__, " ", @__LINE__)
|
||||
end
|
||||
# response = string(split(response, "Please")[1]) # LLM usually add comments which is no need.
|
||||
responsedict = GeneralUtils.textToDict(response,
|
||||
["thought", "Q_1", "note"],
|
||||
["thought", "Q1", "note"],
|
||||
rightmarker=":", symbolkey=true)
|
||||
response = "Q_1: " * responsedict[:Q_1]
|
||||
response = "Q1: " * responsedict[:Q1]
|
||||
println("--> generatequestion ", @__FILE__, " ", @__LINE__)
|
||||
pprintln(response)
|
||||
return response
|
||||
@@ -1713,7 +1714,7 @@ function generateSituationReport(a, text2textInstructLLM::Function)::Dict
|
||||
systemmsg =
|
||||
"""
|
||||
You are the assistant being in the given events.
|
||||
Your task is to writes a summary for each event in an ongoing series.
|
||||
Your task is to writes a summary for each event in an ongoing, interleaving series.
|
||||
|
||||
At each round of conversation, you will be given the situation:
|
||||
Total events: number of events you need to summarize.
|
||||
|
||||
@@ -123,7 +123,40 @@ main()
|
||||
|
||||
|
||||
|
||||
error("test done")
|
||||
|
||||
|
||||
|
||||
|
||||
function run_with_timeout(f, args...; timeout=5)
|
||||
result = Ref{Any}()
|
||||
task = Threads.@spawn try
|
||||
result[] = f(args...)
|
||||
catch e
|
||||
println("Task interrupted: ", e)
|
||||
end
|
||||
|
||||
Timer(timeout) do _
|
||||
if !istaskdone(task)
|
||||
schedule(task, InterruptException())
|
||||
println("Task did not complete in time. Aborting.")
|
||||
else
|
||||
println("Task completed within the timeout.")
|
||||
end
|
||||
end
|
||||
|
||||
return result[]
|
||||
end
|
||||
|
||||
# Example function that takes arguments and returns a value
|
||||
function example_function(x, y)
|
||||
sleep(10) # Simulate a long-running task
|
||||
return x + y
|
||||
end
|
||||
|
||||
# Example usage
|
||||
result = run_with_timeout(example_function, 3, 4; timeout=5)
|
||||
println("Result: ", result)
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user