This commit is contained in:
2024-01-01 08:02:58 +00:00
parent 6d9b383404
commit 41c5fe3963
3 changed files with 24 additions and 98 deletions

View File

@@ -354,87 +354,39 @@ function isUsePlans(a::agentReflex)
Your job is to decide whether you need think thoroughly in order to respond to the user according to your conversation with the user and tools you have.
</Your job>
<Example 1>
So for instance the following:
user: Hello!. How are you?
assistant: {No}, the user is greeting me, I could respond right away.
assistant: {"thought": "the user is greeting me, I don't need to think about it.", "anwer": "no"}
</Example 1>
<Example 2>
user: "I want a bottle of wine."
assistant: {Yes}, I need to think thoroughly about the user stimulus.
user: "I want to get a bottle of wine."
assistant: {"thought": "the user show interest to purchase wine from me.", "anwer": "yes"}
</Example 2>
</s>
$conversation
<|assistant|>
"""
# # if LLM mentions any tools, use Plan/Thought/Act loop
# isuseplan = false
# response = sendReceivePrompt(a, prompt, temperature=0.2, max_tokens=64)
# response = split(response, "<|assistant|>")[1]
# response = split(response, "<|user|>")[1]
# if LLM mentions any tools, use Plan/Thought/Act loop
isuseplan = false
response = sendReceivePrompt(a, prompt, temperature=0.2, max_tokens=64)
response = split(response, "<|assistant|>")[1]
response = split(response, "<|user|>")[1]
# for (toolname, v) in a.tools
# if occursin("Yes", String(response))
# isuseplan = true
# break
# end
# end
for (toolname, v) in a.tools
if occursin("Yes", String(response))
isuseplan = true
break
end
end
# if length(a.memory[:shortterm]) != 0
# isuseplan = true
# end
if length(a.memory[:shortterm]) != 0
isuseplan = true
end
isuseplan = true #XXX true because i'm testing sommelier role.
return isuseplan
end
# function isUsePlans(a::agentReflex)
# toollines = ""
# for (toolname, v) in a.tools
# if toolname ∉ ["chatbox"] # LLM will always use chatbox
# toolline = "$toolname: $(v[:description]) $(v[:input]) $(v[:output])\n"
# toollines *= toolline
# end
# end
# conversation = messagesToString_nomark(a.messages)
# prompt =
# """
# <|im_start|>system
# $(a.roles[a.role])
# You have access to the following tools:
# $toollines
# Your conversation with the user:
# $conversation
# From the conversation, ask yourself what do you intend to do now?
# <|im_end|>
# """
# # if LLM mentions any tools, use Plan/Thought/Act loop
# isuseplan = false
# response = sendReceivePrompt(a, prompt, temperature=0.0)
# response = split(response, "<|im_end|>")[1]
# for (toolname, v) in a.tools
# if occursin(toolname, String(response))
# isuseplan = true
# break
# end
# end
# if length(a.memory[:shortterm]) != 0
# isuseplan = true
# end
# return isuseplan
# end
"""
make a conversation summary.
```jldoctest