diff --git a/src/interface.jl b/src/interface.jl index eea2c7c..d0756af 100644 --- a/src/interface.jl +++ b/src/interface.jl @@ -129,10 +129,10 @@ function decisionMaker(a::T; recentevents::Integer=20, maxattempt=10 includelatest=true) timeline = createTimeline(a.memory[:events]; eventindex=recentevents_ind) - recentchat_ind = GeneralUtils.recentElementsIndex(length(a.chathistory), recentevents; - includelatest=true) - recentchat = createChatLog(a.chathistory; index=recentchat_ind) - # recentEventsDict = createEventsLog(recentevents; index=recent_ind) + # recentchat_ind = GeneralUtils.recentElementsIndex(length(a.chathistory), recentevents; + # includelatest=true) + # recentchat = createChatLog(a.chathistory; index=recentchat_ind) + recentEvents = createEventsLog(a.memory[:events]; index=recentevents_ind) # # recap as caching @@ -180,43 +180,51 @@ function decisionMaker(a::T; recentevents::Integer=20, maxattempt=10 systemmsg = """ - Your name is $(a.name). You are a sommelier for website-based $(a.retailername)'s wine store. You are working under your mentor supervision. - Your goal includes: - 1) Establish a connection with the customer by greeting them warmly - 2) Guide them to select the best wines only from your store's inventory that align with their preferences. - - Your responsibility includes: - 1) According to the store's policy and guidelines, make an informed decision about what you need to do to achieve the goal - 2) Value your mentor's suggestions. - - Your responsibility does NOT includes: - 1) Requesting the user to place an order, make a purchase, or confirm the order. These are the job of our sales team at the store. - 2) Processing sales orders or engaging in any other sales-related activities. These are the job of our sales team at the store. - 3) Answering questions or offering additional services beyond those related to your store's wine recommendations such as discounts, quantity, rewards programs, promotions, delivery options, shipping, boxes, gift wrapping, packaging, personalized messages or something similar. These are the job of our sales team at the store. - At each round of conversation, you will be given the following information: - context: additional information about the current situation - - You should then respond to the user with interleaving Plan, Action_name, Action_input: - 1) plan: Based on the current situation, state a complete action plan to complete the task. Be specific. - 2) action_name: (Typically corresponds to the execution of the first step in your plan) Can be one of the available tool name - 3) action_input: The input to the action you are about to perform according to your plan. - - You should only respond in JSON format as described below: + + Your name is $(a.name). You are a sommelier for website-based $(a.retailername)'s wine store. You are working under your mentor supervision. + + + Your customer is coming into the store + + + 1) Establish a connection with the customer by talking to them politely and showing your enthusiasm for their wine preferences. + 2) Provide relevant information and guide them to select the best wines only from your store's inventory that align with their preferences. + + + 1) According to the store's policy and guidelines, make an informed decision about what you need to do to achieve the goal + 2) Keep the conversation with the customer going smoothly + 2) Obey your mentor's suggestions. + + + 1) Requesting the user to place an order, make a purchase, or confirm the order. These are the job of our sales team at the store. + 2) Processing sales orders or engaging in any other sales-related activities. These are the job of our sales team at the store. + 3) Answering questions or offering additional services beyond those related to your store's wine recommendations such as discounts, quantity, rewards programs, promotions, delivery options, shipping, boxes, gift wrapping, packaging, personalized messages or something similar. These are the job of our sales team at the store. + + + context: additional information about the current situation + + + 1) plan: Based on the current situation, state a complete action plan to complete the task. Be specific. + 2) action_name: (Typically corresponds to the execution of the first step in your plan) Can be one of the available tool name + 3) action_input: The input to the action you are about to perform according to your plan. + + { "plan": "...", "action_name": "...", "action_input": "..." } + Let's begin! """ requiredKeys = [:plan, :action_name, :action_input] - database_search_result = - if length(a.memory[:shortmem][:db_search_result]) != 0 - availableWineToText(a.memory[:shortmem][:db_search_result]) - else - "N/A" - end + # database_search_result = + # if length(a.memory[:shortmem][:db_search_result]) != 0 + # availableWineToText(a.memory[:shortmem][:db_search_result]) + # else + # "N/A" + # end errornote = "N/A" response = nothing # placeholder for show when error msg show up @@ -233,27 +241,32 @@ function decisionMaker(a::T; recentevents::Integer=20, maxattempt=10 - Generally speaking, the store inventory has some wines from France, the United States, Australia, Spain, and Italy, but you won't know exactly until you check your inventory. - - If you found wines in the store's database, they are in stock - - Approach each customer with open-ended questions to understand their preferences, budget, and occasion. Once you have these information, you can check your inventory. - - Do not ask the user about wine's flavor e.g. floral, citrusy, nutty or some thing similar as these terms cannot be used to search the database. Other wine characteristics useful for CHECKINVENTORY tools are allowed. + - If you found wines in the store's database, they are in stock. + - You can only recommend wines that are currently in our inventory + - Before searching the database for wine, ensure you have at least the following information: 1) budget, 2) wine type, and 3) occasion. Additional details are always helpful. If the user is unsure, provide relevant information and gather insights to make reasonable inferences. + - Ask the user one question at a time. + - Do not ask the user about wine's flavor e.g. floral, citrusy, nutty or some thing similar as these terms cannot be used to search the database. - Once the user has selected their wine, if you haven't already, ask the user whether they need any further assistance. Do not offer any additional services. - - If the user is ending the conversation, say goodbye and invite them to come back next time. - - Spicy foods should not be paired with medium and full-bodied red wines. - - We do not sell organic, sustainability and sulfite wine. + - Only end the conversation when the user explicitly intends to do so. When ending, ensure a polite farewell and an invitation to return in the future. + - Spicy foods should be paired only with light red wines. + - We do not sell organic, sustainable, gluten-free, and sulfite-free wine. Inform the user imediately if they are looking for these types of wines. Do not sell our wines as such. - Gift box, gift card, and custom messages are available. Inform the user to contact our sales team. + - Greeting the customer warmly by ask them how could you help. Do not ask any other questions during this greeting. - Encourage the customer to explore different options and try new things. - If you are unable to locate the desired item in the database after 2 attempts, it may not be available in your inventory. In such cases, inform the user that the item is unavailable and suggest an alternative instead. - Your store carries only wine. - Vintage 0 means non-vintage. - + - Start searching the database as broadly as possible within the given information boundary to maximize the chances of finding. Avoid unnecessary parameters unless specified by the user. Refine the search subsequently. + Search the database as broad as possible under the informantion you have will increase the chance to find wine. Avoid uneccessary parameter such as region, country, tasting notes unless the user specify - CHATBOX which you can use to talk with the user. Be specific. - CHECKWINE allows you to check information about wines you want in your inventory's database. The input must be supported search criteria includeing: wine price, winery, name, vintage, region, country, type, grape varietal, tasting notes, occasion, food pairing, intensity, tannin, sweetness, and acidity. - Example query 1: "Dry, full-bodied red wine from Burgundy region, France or Tuscany region, Italy. Merlot varietal. price 100 to 1000 USD." - Example query 2: "Red wine, bold intensity, price under 300 USD" - - PRESENTBOX which you can use to present wines you have found in your inventory to the user. The input are wine names that you want to present. + Example query 1: "Dry, full-bodied red wine from 1) region: Burgundy, country: France or 2) region: Tuscany, country: Italy. Grape varietal: Merlot or Syrah. price 100 to 1000 USD." + Example query 2: "Red or white wine, medium tannin, price under 700 USD" + Example query 3: "white wine, region: Tuscany or Bordeaux, country: Italy or France + - PRESENTBOX which you can use to present wines you have found in your inventory to the user. The input are wine names that you want to present. The output is presentation of the wines. - ENDCONVERSATION which you can use to properly end the conversation with the user. Input is a dialogue where you wrap up the conversation, thank the user, and invite them to return next time. $(a.memory[:shortmem][:scratchpad]) @@ -266,7 +279,7 @@ function decisionMaker(a::T; recentevents::Integer=20, maxattempt=10 Dict(:name => "system", :text => systemmsg), ] - unformatPrompt = vcat(unformatPrompt, recentchat) + unformatPrompt = vcat(unformatPrompt, recentEvents) # put in model format prompt = GeneralUtils.formatLLMtext(unformatPrompt, a.llmFormatName) # add info @@ -387,7 +400,7 @@ function decisionMaker(a::T; recentevents::Integer=20, maxattempt=10 isWineInEvent = false for winename in mentioned_winery for event in a.memory[:events] - if event[:outcome] !== nothing && occursin(winename, event[:outcome]) + if event[:observation] !== nothing && occursin(winename, event[:observation]) isWineInEvent = true break end @@ -405,17 +418,14 @@ function decisionMaker(a::T; recentevents::Integer=20, maxattempt=10 delete!(responsedict, :mentioned_winery) # check whether responsedict[:action_input] is the same as previous dialogue - if responsedict[:action_input] == a.chathistory[end][:text] + if !isempty(a.chathistory) && responsedict[:action_input] == a.chathistory[end][:text] errornote = "In your previous attempt, you repeated the previous dialogue. Please try again." println("\nERROR YiemAgent decisionMaker() $response ", @__FILE__, ":", @__LINE__, " $(Dates.now())") continue end - println("\nYiemAgent decisionMaker() ", @__FILE__, ":", @__LINE__, " $(Dates.now())") - println("\n$response") - evaluationdict = evaluator(a, timeline, responsedict, context) - if evaluationdict[:approved] == "no" + if evaluationdict[:approval] == "no" mentor_comment = evaluationdict[:suggestion] errornote = "Your previous attempt was not good enough. Please try again. Here is the mentor's suggestion: $mentor_comment" println("\nERROR YiemAgent decisionMaker() $errornote --(not qualify response)--> \n$response ", @__FILE__, ":", @__LINE__, " $(Dates.now())") @@ -425,7 +435,7 @@ function decisionMaker(a::T; recentevents::Integer=20, maxattempt=10 # store for later training responsedict[:system] = systemmsg responsedict[:unformatPrompt] = unformatPrompt - responsedict[:recentchat] = recentchat + # responsedict[:recentchat] = recentchat responsedict[:prompt] = prompt responsedict[:context] = context responsedict[:think] = think @@ -460,7 +470,7 @@ function decisionMaker(a::T; recentevents::Integer=20, maxattempt=10 # end # end # println("\nYiemAgent decisionMaker() saved to disk is done. agent $(a.id)") - + responsedict[:prompt] = prompt return responsedict @@ -747,7 +757,7 @@ end # isWineInEvent = false # for winename in mentioned_winery # for event in a.memory[:events] -# if event[:outcome] !== nothing && occursin(winename, event[:outcome]) +# if event[:observation] !== nothing && occursin(winename, event[:observation]) # isWineInEvent = true # break # end @@ -804,10 +814,6 @@ serving as a heuristic to steer the search algorithm towards the most promising julia> ``` -# TODO - - [WORKING] Implement the function. - - # Signature """ function evaluator(a::T1, timeline, decisiondict, evaluateecontext @@ -848,7 +854,7 @@ function evaluator(a::T1, timeline, decisiondict, evaluateecontext 2) decision_evaluation: - Examine how the trainee's decisions align with the store's policies and guidelines before proceeding. 3) suggestion: Based store policy and guidelines, provide a suggestion for the immediate decision step only. - 4) approved: Based on suggestion, decide whether to let the trainee proceed with the decision. Can be "yes" or "no" + 4) approval: Can be "yes" or "no". "no" if the suggestion contradict the trainee's decision; otherwise, it is "yes". @@ -856,13 +862,13 @@ function evaluator(a::T1, timeline, decisiondict, evaluateecontext "trajectory_evaluation": "...", "decision_evaluation": "...", "suggestion": "...", - "approved": "...", + "approval": "...", } Let's begin! """ - requiredKeys = [:trajectory_evaluation, :decision_evaluation, :approved, :suggestion] + requiredKeys = [:trajectory_evaluation, :decision_evaluation, :approval, :suggestion] errornote = "N/A" for attempt in 1:10 @@ -1016,18 +1022,31 @@ julia> response = ChatAgent.conversation(newAgent, "Hi! how are you?") # Signature """ -function conversation(a::sommelier, userinput::Dict; maximumMsg=50) - +function conversation(a::sommelier; userinput::Union{Dict, Nothing}=nothing, + maximumMsg=50) + #[WORKING] add the ability to start the conversation by sommelier # place holder actionname = nothing result = nothing chatresponse = nothing - userinput[:text] = GeneralUtils.remove_french_accents(userinput[:text]) - if userinput[:text] == "newtopic" + if userinput === nothing + # thinking loop until AI wants to communicate with the user + chatresponse = nothing + while chatresponse === nothing + actionname, result = think(a) + if actionname ∈ ["CHATBOX", "PRESENTBOX", "ENDCONVERSATION"] + chatresponse = result + end + end + addNewMessage(a, "assistant", chatresponse; maximumMsg=maximumMsg) + + return chatresponse + elseif userinput[:text] == "newtopic" clearhistory(a) return "Okay. What shall we talk about?" else + userinput[:text] = GeneralUtils.remove_french_accents(userinput[:text]) # add usermsg to a.chathistory addNewMessage(a, "user", userinput[:text]; maximumMsg=maximumMsg) @@ -1037,8 +1056,8 @@ function conversation(a::sommelier, userinput::Dict; maximumMsg=50) event_description="the user talks to the assistant.", timestamp=Dates.now(), subject="user", - actionname="CHATBOX", - actioninput=userinput[:text], + action_name="CHATBOX", + action_input=userinput[:text], ) ) @@ -1075,7 +1094,8 @@ function conversation(a::Union{companion, virtualcustomer}, userinput::Dict; event_description="the user talks to the assistant.", timestamp=Dates.now(), subject="user", - actioninput=userinput[:text], + action_name="CHATBOX", + action_input=userinput[:text], ) ) chatresponse = generatechat(a; converPartnerName=converPartnerName, recentEventNum=20) @@ -1087,7 +1107,8 @@ function conversation(a::Union{companion, virtualcustomer}, userinput::Dict; event_description="the assistant talks to the user.", timestamp=Dates.now(), subject="assistant", - actioninput=chatresponse, + action_name="CHATBOX", + action_input=chatresponse, ) ) return chatresponse @@ -1162,8 +1183,8 @@ function think(a::T)::NamedTuple{(:actionname, :result),Tuple{String,String}} wh timestamp=Dates.now(), subject="assistant", thought=thoughtDict, - actionname=actionname, - actioninput=actioninput, + action_name=actionname, + action_input=actioninput, ) ) result = actioninput @@ -1188,8 +1209,8 @@ function think(a::T)::NamedTuple{(:actionname, :result),Tuple{String,String}} wh timestamp=Dates.now(), subject="assistant", thought=thoughtDict, - actionname=actionname, - actioninput=chatresponse, + action_name=actionname, + action_input=chatresponse, ) ) result = chatresponse @@ -1197,7 +1218,7 @@ function think(a::T)::NamedTuple{(:actionname, :result),Tuple{String,String}} wh elseif actionname == "CHECKWINE" if rawresponse !== nothing vd = GeneralUtils.dfToVectorDict(rawresponse) # comes in dataframe format - a.memory[:shortmem][:found_wine] = vd # used by decisionMaker() as a short note + # a.memory[:shortmem][:found_wine] = vd # used by decisionMaker() as a short note #[PENDING] a.memory[:shortmem][:available_wine] should be OrderedDict instead of vector dict so that no duplicate item are listed? if length(a.memory[:shortmem][:db_search_result]) != 0 a.memory[:shortmem][:db_search_result] = vcat(a.memory[:shortmem][:db_search_result], vd) @@ -1205,20 +1226,20 @@ function think(a::T)::NamedTuple{(:actionname, :result),Tuple{String,String}} wh a.memory[:shortmem][:db_search_result] = vd end - # add to scratchpad - a.memory[:shortmem][:scratchpad] *= - """ - - I searched the database with this search term: $actioninput \nThis is what I found: $result - - """ + # # add to scratchpad + # a.memory[:shortmem][:scratchpad] *= + # """ + # + # I searched the database with this search term: $actioninput \nThis is what I found: $result + # + # """ else - a.memory[:shortmem][:scratchpad] *= - """ - - I searched the database with this search term: $actioninput \nThis is what I found: $result - - """ + # a.memory[:shortmem][:scratchpad] *= + # """ + # + # I searched the database with this search term: $actioninput \nThis is what I found: $result + # + # """ end push!(a.memory[:events], @@ -1227,9 +1248,9 @@ function think(a::T)::NamedTuple{(:actionname, :result),Tuple{String,String}} wh timestamp= Dates.now(), subject= "assistant", thought=thoughtDict, - actionname=actionname, - actioninput= "I search the database with this search term: $actioninput", - outcome= "This is what I found:, $result" + action_name=actionname, + action_input= "I search the database with this search term: $actioninput", + observation= "This is what I found:, $result" ) ) @@ -1248,7 +1269,7 @@ function presentbox(a::sommelier, thoughtDict; maxtattempt::Integer=10, recentev systemmsg = """ - Your name is $(a.name). You are a helpful English-speaking assistant, acting as a polite, website-based sommelier for $(a.retailername)'s wine store. + Your name is $(a.name). You are a helpful English-speaking assistant, acting as a polite, website-based sommelier for $(a.retailername)'s wine store. You have checked the inventory and found wines that may match what the user wants @@ -1399,7 +1420,7 @@ function presentbox(a::sommelier, thoughtDict; maxtattempt::Integer=10, recentev isWineInEvent = false for winename in mentioned_winery for event in a.memory[:events] - if event[:outcome] !== nothing && occursin(winename, event[:outcome]) + if event[:observation] !== nothing && occursin(winename, event[:observation]) isWineInEvent = true break end @@ -1580,7 +1601,7 @@ end # isWineInEvent = false # for winename in mentioned_winery # for event in a.memory[:events] -# if event[:outcome] !== nothing && occursin(winename, event[:outcome]) +# if event[:observation] !== nothing && occursin(winename, event[:observation]) # isWineInEvent = true # break # end @@ -1791,7 +1812,7 @@ function generatechat(a::sommelier, thoughtDict; maxattempt::Integer=10) isWineInEvent = false for winename in mentioned_winery for event in a.memory[:events] - if event[:outcome] !== nothing && occursin(winename, event[:outcome]) + if event[:observation] !== nothing && occursin(winename, event[:observation]) isWineInEvent = true break end @@ -1997,7 +2018,7 @@ function generatechat(a::virtualcustomer; end # check if the dialogue is the same as the previous one - if responsedict[:dialogue] == a.chathistory[end][:text] + if length(responsedict[:dialogue]) != 0 && responsedict[:dialogue] == a.chathistory[end][:text] errornote = "In your previous attempt you said $(responsedict[:dialogue]) which was the same as the previous one." println("\nYiemAgent generatechat() $errornote:\n$response ", @__FILE__, ":", @__LINE__, " $(Dates.now())") continue @@ -2195,7 +2216,7 @@ function generatequestion(a, text2textInstructLLM::Function, timeline)::String isWineInEvent = false for winename in mentioned_winery for event in a.memory[:events] - if event[:outcome] !== nothing && occursin(winename, event[:outcome]) + if event[:observation] !== nothing && occursin(winename, event[:observation]) isWineInEvent = true break end diff --git a/src/llmfunction.jl b/src/llmfunction.jl index 4a8febb..09f9a14 100644 --- a/src/llmfunction.jl +++ b/src/llmfunction.jl @@ -373,8 +373,8 @@ function extractWineAttributes_1(a::T1, input::T2; maxattempt=10 wine_name: name of the wine winery: name of the winery vintage: the year of the wine - region: a region, such as Burgundy, Bordeaux, Champagne, Napa Valley, Tuscany, California, Oregon, etc - country: a country where wine is produced. Can be "Austria", "Australia", "France", "Germany", "Italy", "Portugal", "Spain", "United States" + region: a region, such as Burgundy, Bordeaux, Champagne, Napa Valley, Tuscany, California, Oregon, etc. Use "or" if there are multiple regions. + country: a country where wine is produced. Can be "Austria", "Australia", "France", "Germany", "Italy", "Portugal", "Spain", "United States". Use "or" if there are multiple countries. wine_type: can be one of: "red", "white", "sparkling", "rose", "dessert" or "fortified" grape_varietal: the name of the primary grape used to make the wine tasting_notes: a word describe the wine's flavor, such as "butter", "oak", "fruity", "raspberry", "earthy", "floral", etc @@ -866,8 +866,7 @@ function paraphrase(text2textInstructLLM::Function, text::String) Let's begin! """ - #[WORKING] use JSON3 the same as extractWineAttributes_1 is better - #[WORKING] change this function to use the same format use decisionMater + #[PENDING] use JSON3 the same as extractWineAttributes_1 is better. change this function to use the same format use decisionMaker header = ["Paraphrase:"] dictkey = ["paraphrase"] diff --git a/src/util.jl b/src/util.jl index 763d37c..3f57a9f 100644 --- a/src/util.jl +++ b/src/util.jl @@ -231,12 +231,12 @@ function eventdict(; timestamp::Union{DateTime, Nothing}=nothing, subject::Union{String, Nothing}=nothing, thought::Union{AbstractDict, Nothing}=nothing, - actionname::Union{String, Nothing}=nothing, # "CHAT", "CHECKINVENTORY", "PRESENTBOX", etc - actioninput::Union{String, Nothing}=nothing, + action_name::Union{String, Nothing}=nothing, # "CHAT", "CHECKINVENTORY", "PRESENTBOX", etc + action_input::Union{String, Nothing}=nothing, location::Union{String, Nothing}=nothing, equipment_used::Union{String, Nothing}=nothing, material_used::Union{String, Nothing}=nothing, - outcome::Union{String, Nothing}=nothing, + observation::Union{String, Nothing}=nothing, note::Union{String, Nothing}=nothing, ) @@ -245,12 +245,12 @@ function eventdict(; :timestamp=> timestamp, :subject=> subject, :thought=> thought, - :actionname=> actionname, - :actioninput=> actioninput, + :action_name=> action_name, + :action_input=> action_input, :location=> location, :equipment_used=> equipment_used, :material_used=> material_used, - :outcome=> outcome, + :observation=> observation, :note=> note, ) @@ -266,7 +266,7 @@ end Each event dictionary should have the following keys: - :subject - The subject or entity performing the action - :actioninput - The action or input performed by the subject - - :outcome - (Optional) The result or outcome of the action + - :observation - (Optional) The result or outcome of the action # Returns - `timeline::String` @@ -276,8 +276,8 @@ end # Example events = [ - Dict(:subject => "User", :actioninput => "Hello", :outcome => nothing), - Dict(:subject => "Assistant", :actioninput => "Hi there!", :outcome => "with a smile") + Dict(:subject => "User", :actioninput => "Hello", :observation => nothing), + Dict(:subject => "Assistant", :actioninput => "Hi there!", :observation => "with a smile") ] timeline = createTimeline(events) # 1) User> Hello @@ -297,19 +297,19 @@ function createTimeline(events::T1; eventindex::Union{UnitRange, Nothing}=nothin 1:length(events) end - #[WORKING] Iterate through events and format each one + # Iterate through events and format each one for i in ind event = events[i] # If no outcome exists, format without outcome # if event[:actionname] == "CHATBOX" # timeline *= "Event_$i $(event[:subject])> action_name: $(event[:actionname]), action_input: $(event[:actioninput])\n" - # elseif event[:actionname] == "CHECKINVENTORY" && event[:outcome] === nothing + # elseif event[:actionname] == "CHECKINVENTORY" && event[:observation] === nothing # timeline *= "Event_$i $(event[:subject])> action_name: $(event[:actionname]), action_input: $(event[:actioninput]), observation: Not done yet.\n" # If outcome exists, include it in formatting - if event[:actionname] == "CHECKWINE" - timeline *= "Event_$i $(event[:subject])> action_name: $(event[:actionname]), action_input: $(event[:actioninput]), observation: $(event[:outcome])\n" + if event[:action_name] == "CHECKWINE" + timeline *= "Event_$i $(event[:subject])> action_name: $(event[:action_name]), action_input: $(event[:action_input]), observation: $(event[:observation])\n" else - timeline *= "Event_$i $(event[:subject])> action_name: $(event[:actionname]), action_input: $(event[:actioninput])\n" + timeline *= "Event_$i $(event[:subject])> action_name: $(event[:action_name]), action_input: $(event[:action_input])\n" end end @@ -333,11 +333,11 @@ end # for i in ind # event = events[i] # # If no outcome exists, format without outcome -# if event[:outcome] === nothing +# if event[:observation] === nothing # timeline *= "Event_$i $(event[:subject])> action_name: $(event[:actionname]), action_input: $(event[:actioninput]), observation: Not done yet.\n" # # If outcome exists, include it in formatting # else -# timeline *= "Event_$i $(event[:subject])> action_name: $(event[:actionname]), action_input: $(event[:actioninput]), observation: $(event[:outcome])\n" +# timeline *= "Event_$i $(event[:subject])> action_name: $(event[:actionname]), action_input: $(event[:actioninput]), observation: $(event[:observation])\n" # end # end @@ -363,16 +363,19 @@ function createEventsLog(events::T1; index::Union{UnitRange, Nothing}=nothing for i in ind event = events[i] # If no outcome exists, format without outcome - if event[:outcome] === nothing + if event[:observation] === nothing subject = event[:subject] - actioninput = event[:actioninput] - d = Dict{Symbol, String}(:name=>subject, :text=>actioninput) + action_name = event[:action_name] + action_input = event[:action_input] + str = "Action_name: $action_name, Action_input: $action_input" + d = Dict{Symbol, String}(:name=>subject, :text=>str) push!(log, d) else subject = event[:subject] - actioninput = event[:actioninput] - outcome = event[:outcome] - str = "Action: $actioninput Outcome: $outcome" + action_name = event[:action_name] + action_input = event[:action_input] + observation = event[:observation] + str = "Action_name: $action_name, Action_input: $action_input, Observation: $observation" d = Dict{Symbol, String}(:name=>subject, :text=>str) push!(log, d) end