From 4b5b1897799d5413814a204c803831cf212d0f52 Mon Sep 17 00:00:00 2001 From: tonaerospace Date: Wed, 13 Dec 2023 12:47:48 +0000 Subject: [PATCH] update --- src/interface.jl | 1 + src/type.jl | 4 ++-- src/utils.jl | 46 ++++++++++++++++++++++++++++++++++++++++------ 3 files changed, 43 insertions(+), 8 deletions(-) diff --git a/src/interface.jl b/src/interface.jl index 22881ee..b24e4e2 100755 --- a/src/interface.jl +++ b/src/interface.jl @@ -452,6 +452,7 @@ function conversation(a::agentReflex, usermsg::String; attemptlimit::Int=3) # end response = chat_mistral_openorca(a) + response = removeTrailingCharacters(response) _ = addNewMessage(a, "assistant", response) return response diff --git a/src/type.jl b/src/type.jl index 676e901..a07ff05 100644 --- a/src/type.jl +++ b/src/type.jl @@ -116,8 +116,8 @@ function agentReflex( subtopic= (imgAI="agent/api/v0.1.0/img/respond", txtAI="agent/api/v0.1.0/txt/respond"), keepalive= 30,), - role::Symbol=:assistant, - roles::Dict=Dict( + role::Symbol=:assistant, + roles::Dict=Dict( :assistant => """ You are a helpful assistant who respond to user as best you can. diff --git a/src/utils.jl b/src/utils.jl index e425262..73c5a62 100644 --- a/src/utils.jl +++ b/src/utils.jl @@ -4,7 +4,7 @@ export makeSummary, sendReceivePrompt, chunktext, extractStepFromPlan, checkTota detectCharacters, findDetectedCharacter, extract_number, toolNameBeingCalled, isUseTools, conversationSummary, checkReasonableness, replaceHeaders, addShortMem!, splittext, dictToString, removeHeaders, keepOnlyKeys, experience, - messagesToString + messagesToString, removeTrailingCharacters using UUIDs, Dates, DataStructures using CommUtils, GeneralUtils @@ -388,7 +388,6 @@ function isUseTools(a::agentReflex) From the user's message, ask yourself what do you need to do? <|im_end|> - <|im_start|>assistant """ @@ -431,13 +430,48 @@ function isUseTools(a::agentReflex) $conversation Use the following format: - 1. Objective: From your conversation with the user, ask yourself what do you need to do now? - 2. Plan: first you should always think about the stimulus, the info you need and the info you have thoroughly then extract and devise a step by step plan (pay attention to correct numeral calculation and commonsense). + Objective: From your conversation with the user, ask yourself what do you need to do now? <|im_end|> """ - assistant_objective_result = sendReceivePrompt(a, assistant_objective_prompt, temperature=0.2) - @show assistant_objective_result + result_objective = sendReceivePrompt(a, assistant_objective_prompt, temperature=0.2) + @show result_objective + + # assistant_plan_prompt = + # """ + # <|im_start|>system + # $(a.roles[a.role]) + # The info you need from the user to be able to help them selecting their best wine: + # - type of food + # - occasion + # - user's personal taste of wine + # - wine price range + # - ambient temperature at the serving location + # - wines we have in stock + # You provide a personalized recommendation of up to two wines based on the user's info above, and you describe the benefits of each wine in detail. + + # You have access to the following tools: + # $toollines + + # Use the following format: + # Stimulus: the input user gives to you and you must respond + # Plan: first you should always think about the stimulus, the info you need and the info you have thoroughly then extract and devise a step by step plan (pay attention to correct numeral calculation and commonsense). + # p.s.1 each step should be a single action. + # p.s.2 don't respond to the stimulus yet. + # <|im_end|> + # <|im_start|>user + # $result_objective + # <|im_end|> + # <|im_start|>assistant + # Plan: + # """ + # result_plan = sendReceivePrompt(a, assistant_plan_prompt, temperature=0.2) + # @show result_plan + + + + + end return isusetool, plan