add context
This commit is contained in:
@@ -93,7 +93,7 @@ julia> output_thoughtDict = Dict(
|
||||
- [] use customerinfo
|
||||
- [] user storeinfo
|
||||
|
||||
""" #WORKING
|
||||
"""
|
||||
function decisionMaker(a::T; recentevents::Integer=20, maxattempt=10
|
||||
) where {T<:agent}
|
||||
println("\nExecuting YiemAgent decisionMaker()")
|
||||
@@ -127,6 +127,20 @@ function decisionMaker(a::T; recentevents::Integer=20, maxattempt=10
|
||||
|
||||
requiredKeys = ["plan", "actionname", "actioninput"]
|
||||
|
||||
context =
|
||||
"""
|
||||
<internal_context_for_LLM>
|
||||
$(a.memory["scratchpad"])
|
||||
</internal_context_for_LLM>
|
||||
"""
|
||||
|
||||
#WORKING add context to the latest message (in the front)
|
||||
for d in enumerate(a.chathistory[end]["content"])
|
||||
if d["type"] == "text"
|
||||
d["text"] = context * d["text"]
|
||||
break
|
||||
end
|
||||
end
|
||||
errornote = "N/A"
|
||||
response = nothing # placeholder for show when error msg show up
|
||||
|
||||
@@ -280,7 +294,6 @@ function decisionMaker(a::T; recentevents::Integer=20, maxattempt=10
|
||||
end
|
||||
error("DecisionMaker failed to generate a thought ", response)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
22
src/type.jl
22
src/type.jl
@@ -321,16 +321,30 @@ function virtualcustomer(
|
||||
)
|
||||
|
||||
""" Memory
|
||||
Ref: Chat prompt format https://huggingface.co/TheBloke/Llama-2-7B-Chat-GGML/discussions/3
|
||||
NO "system" message in chathistory because I want to add it at the inference time
|
||||
Ref: Chat prompt format is openai
|
||||
chathistory = [
|
||||
Dict("name"=>"user", "text"=> "Wassup!", "timestamp"=> Dates.now()),
|
||||
Dict("name"=>"assistant", "text"=> "Hi I'm your assistant.", "timestamp"=> Dates.now()),
|
||||
Dict(
|
||||
"role" => "system",
|
||||
"content" => [
|
||||
Dict("type" => "text", "text" => system_msg),
|
||||
]
|
||||
),
|
||||
Dict(
|
||||
"role" => "user",
|
||||
"content" => [
|
||||
Dict("type" => "text", "text" => "Do you know this wine? Just give me brief intro."),
|
||||
Dict(
|
||||
"type" => "image_url",
|
||||
"image_url" => Dict("url" => data1_uri)
|
||||
)
|
||||
]
|
||||
)
|
||||
]
|
||||
"""
|
||||
memory = Dict{String, Any}(
|
||||
"shortmem"=> OrderedDict{String, Any}(
|
||||
),
|
||||
"scratchpad"=> "",
|
||||
"events"=> Vector{Dict{String, Any}}(),
|
||||
"state"=> Dict{String, Any}(
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user