diff --git a/drivers/place/llm/llm.cr b/drivers/place/llm/llm.cr index a224caeb5a..b4065b8974 100644 --- a/drivers/place/llm/llm.cr +++ b/drivers/place/llm/llm.cr @@ -19,6 +19,10 @@ focus on key points in questions simplify complex issues with steps clarify unclear questions before answering correct errors in previous answers), + + user_hint: "Hi! I'm your workplace assistant.\n" + + "I can get you instant answers for almost anything as well as perform actions such as booking a meeting room.\n" + + "How can I help?", }) def on_load @@ -27,6 +31,11 @@ correct errors in previous answers), def on_update @prompt = setting(String, :prompt) + self[:user_hint] = setting?(String, :user_hint) || "Hi! I'm your workplace assistant." + + schedule.clear + schedule.in(5.seconds) { update_prompt } + schedule.every(5.minutes) { update_prompt } end getter! prompt : String @@ -47,4 +56,8 @@ correct errors in previous answers), system_id: system.id, } end + + protected def update_prompt + self[:prompt] = new_chat + end end diff --git a/drivers/place/llm/llm_spec.cr b/drivers/place/llm/llm_spec.cr index 7f3c602f8c..525f5aabf5 100644 --- a/drivers/place/llm/llm_spec.cr +++ b/drivers/place/llm/llm_spec.cr @@ -22,27 +22,27 @@ DriverSpecs.mock_driver "Place::LLM" do system(:DeskBookings_1).function_schemas.should eq([ { - function: "list_of_levels", + function: "list_of_levels", description: "returns the list of levels with available desks", - parameters: {} of String => JSON::Any + parameters: {} of String => JSON::Any, }, { - function: "book", + function: "book", description: "books a desk, you can optionally provide a preferred level or how many days from now if the booking is for tomorrow etc", - parameters: { + parameters: { "level" => { - "anyOf" => [{"type" => "null"}, {"type" => "string"}], - "title" => "(String | Nil)", - "default" => nil + "anyOf" => [{"type" => "null"}, {"type" => "string"}], + "title" => "(String | Nil)", + "default" => nil, }, "days_in_future" => { - "type" => "integer", - "format" => "Int32", - "title" => "Int32", - "default" => 0 - } - } - } + "type" => "integer", + "format" => "Int32", + "title" => "Int32", + "default" => 0, + }, + }, + }, ]) end diff --git a/drivers/place/llm/todo_list_spec.cr b/drivers/place/llm/todo_list_spec.cr index bfd658648c..e24be9155e 100644 --- a/drivers/place/llm/todo_list_spec.cr +++ b/drivers/place/llm/todo_list_spec.cr @@ -23,23 +23,23 @@ DriverSpecs.mock_driver "Place::TODOs" do exec(:function_schemas).get.should eq([ { - "function" => "list_tasks", + "function" => "list_tasks", "description" => "returns the list of tasks and their current status", - "parameters" => {} of String => JSON::Any + "parameters" => {} of String => JSON::Any, }, { - "function" => "add_task", + "function" => "add_task", "description" => "adds a new task to the list", - "parameters" => { - "description" => {"type" => "string", "title" => "String"} - } + "parameters" => { + "description" => {"type" => "string", "title" => "String"}, + }, }, { - "function" => "complete_task", + "function" => "complete_task", "description" => "marks a task as completed", - "parameters" => { - "index" => {"type" => "integer", "format" => "Int32", "title" => "Int32"} - } - } + "parameters" => { + "index" => {"type" => "integer", "format" => "Int32", "title" => "Int32"}, + }, + }, ]) end