update
This commit is contained in:
@@ -199,10 +199,43 @@ function planner_mistral_openorca(a::agentReflex)
|
||||
$(a.roleSpecificInstruction[a.role])
|
||||
"""
|
||||
|
||||
# assistant_plan_prompt =
|
||||
# """
|
||||
# <s>
|
||||
# <|system|>
|
||||
# <About yourself>
|
||||
# $aboutYourself
|
||||
# </About yourself>
|
||||
# <You have access to the following tools>
|
||||
# $toollines
|
||||
# </You have access to the following tools
|
||||
# <Your earlier work>
|
||||
# $shorttermMemory
|
||||
# </Your earlier work>
|
||||
# <Your job>
|
||||
# Plan: first you should always think about your conversation with the user and your earlier work thoroughly then extract and devise a complete, task by task, plan to achieve your objective (pay attention to correct numeral calculation and commonsense).
|
||||
# Keyword memory: using JSON format, list all variables in the plan you need to find out
|
||||
# P.S.1 each task of the plan should be a single action.
|
||||
# </Your job>
|
||||
# <Example>
|
||||
# Plan:
|
||||
# 1. Ask the user about how many miles per day they drive
|
||||
# 2. Ask the user about what stuff they usually carry with
|
||||
# 3. Ask the user about preferred type of car they want to buy (sedan, sport, SUV, etc)
|
||||
# 4. Ask the user about their price range
|
||||
# 5. Use inventory tool to find cars that match the user's preferences and are within their price range
|
||||
# 6. Use finalanswer tool to present the recommended car to the user.
|
||||
# Keyword memory: {"mile per day": null, "carry item": null, "car type": null, "price range": null}
|
||||
# </Example>
|
||||
# </s>
|
||||
# $conversation
|
||||
# <|assistant|>
|
||||
# Plan:
|
||||
# """
|
||||
|
||||
assistant_plan_prompt =
|
||||
"""
|
||||
<s>
|
||||
<|system|>
|
||||
<|im_start|>system
|
||||
<About yourself>
|
||||
$aboutYourself
|
||||
</About yourself>
|
||||
@@ -227,12 +260,13 @@ function planner_mistral_openorca(a::agentReflex)
|
||||
6. Use finalanswer tool to present the recommended car to the user.
|
||||
Keyword memory: {"mile per day": null, "carry item": null, "car type": null, "price range": null}
|
||||
</Example>
|
||||
</s>
|
||||
<|im_end|>
|
||||
$conversation
|
||||
<|assistant|>
|
||||
<|im_start|>assistant
|
||||
Plan:
|
||||
"""
|
||||
|
||||
|
||||
response = sendReceivePrompt(a, assistant_plan_prompt, max_tokens=1024, temperature=0.1,
|
||||
timeout=180, stopword=["<|user|>", "</"])
|
||||
response = split(response, "<|")[1]
|
||||
|
||||
12
src/utils.jl
12
src/utils.jl
@@ -471,7 +471,7 @@ end
|
||||
julia> messagesToString(agent.messages)
|
||||
"<|im_start|>user: Hi there.\n<|im_end|><|im_start|>assistant: Hello! How can I assist you today?\n<|im_end|>"
|
||||
```
|
||||
"""
|
||||
"""
|
||||
function messagesToString(messages::AbstractVector{T}; addressAIas="assistant") where {T<:AbstractDict}
|
||||
conversation = ""
|
||||
if length(messages)!= 0
|
||||
@@ -489,9 +489,9 @@ function messagesToString(messages::AbstractVector{T}; addressAIas="assistant")
|
||||
end
|
||||
|
||||
if role == "user"
|
||||
conversation *= "<|$role|>\n $(content[1:end-nouse])\n</|$role|>"
|
||||
conversation *= "<|im_start|>$role\n $(content[1:end-nouse])\n<|im_end|>"
|
||||
elseif role == "assistant"
|
||||
conversation *= "<|$addressAIas|>\n $(content[1:end-nouse])\n</|$addressAIas|>"
|
||||
conversation *= "<|im_start|>$addressAIas\n $(content[1:end-nouse])\n<|im_end|>"
|
||||
else
|
||||
error("undefied condition role = $role $(@__LINE__)")
|
||||
end
|
||||
@@ -502,6 +502,7 @@ function messagesToString(messages::AbstractVector{T}; addressAIas="assistant")
|
||||
|
||||
return conversation
|
||||
end
|
||||
|
||||
# function messagesToString(messages::AbstractVector{T}; addressAIas="assistant") where {T<:AbstractDict}
|
||||
# conversation = ""
|
||||
# if length(messages)!= 0
|
||||
@@ -519,9 +520,9 @@ end
|
||||
# end
|
||||
|
||||
# if role == "user"
|
||||
# conversation *= "<|$role|>\n $(content[1:end-nouse])\n</s>"
|
||||
# conversation *= "<|$role|>\n $(content[1:end-nouse])\n</|$role|>"
|
||||
# elseif role == "assistant"
|
||||
# conversation *= "<|$addressAIas|>\n $(content[1:end-nouse])\n</s>"
|
||||
# conversation *= "<|$addressAIas|>\n $(content[1:end-nouse])\n</|$addressAIas|>"
|
||||
# else
|
||||
# error("undefied condition role = $role $(@__LINE__)")
|
||||
# end
|
||||
@@ -534,6 +535,7 @@ end
|
||||
# end
|
||||
|
||||
|
||||
|
||||
""" Convert a vector of dict into 1-continous string.
|
||||
|
||||
Arguments:
|
||||
|
||||
Reference in New Issue
Block a user