diff --git a/src/interface.jl b/src/interface.jl index 4750fca..8c1ca5c 100644 --- a/src/interface.jl +++ b/src/interface.jl @@ -776,16 +776,14 @@ function generatechat!(a::T; maxattempt::Integer=10 - Processing sales orders or engaging in any other sales-related activities. These are the job of our sales team at the store. - 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. - # you should then respond to the user with interleaving plan, action_name, action_input + # you should then respond to the user with interleaving plan, action_name, action_input in JSON format 1) "plan", Based on the current situation, state a complete action plan to complete the task and rationale. Be specific. - 2) "action_name", Must be "CHAT_BOX + 2) "action_name", action_name must be CHAT_BOX. 3) "action_input", Dialogue you want to chat with the user according to your plan. After the action is executed you gets "action_result". It is the output from the action you selected. - - # you should only respond in JSON format as described below - "plan": "...", - "action_name": "...", - "action_input": "..." + + # available actions + "CHAT_BOX", which you can use to talk with the user. The input is dialogue you want to chat with the user according to your plan. """ system_msg = Dict( @@ -807,11 +805,39 @@ function generatechat!(a::T; maxattempt::Integer=10 if attempt > 1 println("\nYiemAgent generatechat() attempt $attempt/$maxattempt ", @__FILE__, ":", @__LINE__, " $(Dates.now())") end + + response_format = Dict( + "type"=> "json_schema", + "json_schema"=> Dict( + "name"=> "user_profile", + "strict"=> true, + "schema"=> Dict( + "type"=> "object", + "properties"=> Dict( + "plan"=> Dict( + "type"=> "string", + "description" => "Based on the current situation, state a complete action plan to complete the task and rationale. Be specific.", + ), + "action_name"=> Dict( + "type"=> "string", + "description" => "action_name must be CHAT_BOX", + ), + "action_input"=> Dict( + "type"=> "string", + "description" => "Dialogue you want to chat with the user according to your plan.", + ), + ), + "required"=> ["plan", "action_name", "action_input"], + "additionalProperties"=> false + ) + ) + ) msg = Dict( "model" => "gemma-4-E4B-it-UD-Q4_K_XL", "messages" => chathistory, - "temperature" => 0.7 + "temperature" => 0.7, + "response_format"=> response_format, ) response = a.context.text2textInstructLLM(a.id, msg) diff --git a/src/type.jl b/src/type.jl index f960b78..d554f2a 100644 --- a/src/type.jl +++ b/src/type.jl @@ -226,7 +226,7 @@ function sommelier( return newAgent end - + mutable struct virtualcustomer <: agent name::String # agent name