Skip to content

The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:

Let Metabot write a brief response after using autogen_dashboard (#71758)

Noah Mossadc3c025c5e2
diff --git a/src/metabase/metabot/tools/autogen_dashboard.clj b/src/metabase/metabot/tools/autogen_dashboard.clj
index 7892dc0a8f3..08b9848e694 100644
--- a/src/metabase/metabot/tools/autogen_dashboard.clj
+++ b/src/metabase/metabot/tools/autogen_dashboard.clj
@@ -98,7 +98,7 @@
Returns map with:
- :structured-output - Message and dashboard info
- :reactions - Navigation action to show the dashboard
- - :final-response? - Signals that the agent should stop (user is viewing dashboard)"
+ - :instructions - Guidance for the LLM on how to respond"
[{:keys [source memory-atom]}]
(log/info "Creating autogenerated dashboard" {:source source})
@@ -114,8 +114,7 @@
{:structured-output {:message response-message
:path path}
:reactions [{:type :metabot.reaction/redirect :url path}]
- :final-response? true
- :instructions "The dashboard has been created and the user has been navigated to view it. Do not describe the dashboard contents."}))
+ :instructions "The dashboard has been created and the user has been navigated to view it. Briefly acknowledge this (1 sentence) and stop. Do not describe the dashboard contents."}))
(def ^:private autogen-dashboard-schema
[:map {:closed true}
@@ -147,10 +146,9 @@
:memory-atom shared/*memory-atom*})
structured (:structured-output result)
reactions (:reactions result)]
- (cond-> {:output (:message structured)
+ (cond-> {:output (:message structured)
:structured-output structured
- :final-response? (:final-response? result)
- :instructions (:instructions result)}
+ :instructions (:instructions result)}
(seq reactions) (assoc :reactions reactions)))
(catch Exception e
(log/error e "Error creating autogenerated dashboard")
diff --git a/test/metabase/metabot/tools/autogen_dashboard_test.clj b/test/metabase/metabot/tools/autogen_dashboard_test.clj
index 4d345660217..7b20c785c23 100644
--- a/test/metabase/metabot/tools/autogen_dashboard_test.clj
+++ b/test/metabase/metabot/tools/autogen_dashboard_test.clj
@@ -29,14 +29,14 @@
;;; Response Structure Tests
(deftest response-structure-test
- (testing "returns final-response? flag"
+ (testing "returns instructions for LLM"
;; We need to test the structure without actually hitting the database
;; Using mt/with-temp for table creation
(mt/with-temp [:model/Table table {:name (mt/random-name) :db_id (mt/id)}]
(let [result (autogen-dashboard/create-autogenerated-dashboard
{:source {:table_id (:id table)}
:memory-atom (atom {:state {}})})]
- (is (true? (:final-response? result))))))
+ (is (string? (:instructions result))))))
(testing "returns redirect reaction"
(mt/with-temp [:model/Table table {:name (mt/random-name) :db_id (mt/id)}]