update
This commit is contained in:
@@ -313,7 +313,6 @@ function actor_mistral_openorca(a::agentReflex, taskrecap="")
|
||||
"
|
||||
"""
|
||||
#BUG BIG output from winestock cause recap() to fail.
|
||||
#BUG2 LLM repeat winestock search without recommending wine
|
||||
toolslist = []
|
||||
toolnames = ""
|
||||
toollines = ""
|
||||
@@ -707,7 +706,7 @@ function actor(a::agentReflex)
|
||||
msgToUser = toolinput
|
||||
actorState = toolname
|
||||
break
|
||||
elseif toolname == "finalanswer" #WORKING
|
||||
elseif toolname == "finalanswer"
|
||||
println(">>> already done")
|
||||
actorState = "formulateFinalResponse"
|
||||
break
|
||||
|
||||
@@ -60,52 +60,27 @@ end
|
||||
|
||||
|
||||
function winestock(a::agentReflex, phrase::T) where {T<:AbstractString}
|
||||
# result = [
|
||||
# Dict(
|
||||
# "name" => "Louis Latou - Corton-Charlamagne - Chardonnay",
|
||||
# "description" => "Corton-Charlemagne 2018 is a powerful, complex wine. Its nose is intense, with notes of white stone fruits such as white peach, fresh hazelnut, vanilla, and almond paste. The wine is full-bodied for the palate, and the vanilla is complemented by aromas of fresh almond and lime blossom. The experience ends with a very fine aromatic aftertaste that has subtle saline notes.",
|
||||
# "price" => "49",
|
||||
# "ID" => "ws-114"
|
||||
# ),
|
||||
# Dict(
|
||||
# "name" => "Louis Latou - Corton-Charlamagne - Chardonnay",
|
||||
# "description" => "Corton-Charlemagne 2018 is a powerful, complex wine. Its nose is intense, with notes of white stone fruits such as white peach, fresh hazelnut, vanilla, and almond paste. The wine is full-bodied for the palate, and the vanilla is complemented by aromas of fresh almond and lime blossom. The experience ends with a very fine aromatic aftertaste that has subtle saline notes.",
|
||||
# "price" => "49",
|
||||
# "ID" => "ws-114"
|
||||
# )
|
||||
# ]
|
||||
|
||||
# result =
|
||||
# """
|
||||
# 1. Name: Louis Latou - Corton-Charlamagne - Chardonnay,
|
||||
# Description: Corton-Charlemagne 2018 is a powerful, complex wine. Its nose is intense, with notes of white stone fruits such as white peach, fresh hazelnut, vanilla, and almond paste. The wine is full-bodied for the palate, and the vanilla is complemented by aromas of fresh almond and lime blossom. The experience ends with a very fine aromatic aftertaste that has subtle saline notes.,
|
||||
# Price: 55 dollars,
|
||||
# ID: ws-114
|
||||
# 2. Name: Chateau de Beaucastel Hommage Jacques Perrin Chateauneuf-du-Pape,
|
||||
# Year: 2019,
|
||||
# Description: The quintessence of Château de Beaucastel, Hommage à Jacques Perrin delights us every year, and the 2019 vintage is no exception. To the eye it offers a splendid deep red color, verging on black. Full of power and supremely elegant, the nose is of magnificent aromatic complexity with notes of black fruit and spices that offer all the characteristic expression of Mourvèdre. Perfectly balanced by an incredible freshness, the mouth is eminently elegant with intense and complex aromas of great subtlety, a full, refined texture, subtle tannins of great finesse, and infinite length. A great classic Hommage à Jacques Perrin.,
|
||||
# Price: 40,
|
||||
# ID: ed-23
|
||||
# """
|
||||
result =
|
||||
"""
|
||||
I found the following wines
|
||||
{
|
||||
1: {
|
||||
Chateau: Louis Latou
|
||||
Chateau: Louis Latou,
|
||||
name: Corton-Charlamagne,
|
||||
grape variety: chardonnay,
|
||||
year: 2014,
|
||||
price: 55 USD,
|
||||
stock ID: ws-114
|
||||
stock ID: ws-114,
|
||||
Description: Corton-Charlemagne 2018 is a powerful, complex wine. Its nose is intense, with notes of white stone fruits such as white peach, fresh hazelnut, vanilla, and almond paste. The wine is full-bodied for the palate, and the vanilla is complemented by aromas of fresh almond and lime blossom. The experience ends with a very fine aromatic aftertaste that has subtle saline notes.,
|
||||
},
|
||||
2: {
|
||||
Chateau: Catena Zapata
|
||||
Chateau: Beaucastel,
|
||||
name: Malbec Argentino,
|
||||
grape variety: riesling,
|
||||
year: 2016,
|
||||
price: 39 USD,
|
||||
stock ID: ed-23
|
||||
stock ID: ed-23,
|
||||
Description: The quintessence of Château de Beaucastel, Hommage à Jacques Perrin delights us every year, and the 2019 vintage is no exception. To the eye it offers a splendid deep red color, verging on black. Full of power and supremely elegant, the nose is of magnificent aromatic complexity with notes of black fruit and spices that offer all the characteristic expression of Mourvèdre. Perfectly balanced by an incredible freshness, the mouth is eminently elegant with intense and complex aromas of great subtlety, a full, refined texture, subtle tannins of great finesse, and infinite length. A great classic Hommage à Jacques Perrin.,
|
||||
}
|
||||
}
|
||||
"""
|
||||
|
||||
82
src/utils.jl
82
src/utils.jl
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user