The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:
TypeScript analyticsbibusiness-intelligencebusinessintelligenceclojuredashboarddatadata-analysisdata-visualizationdatabasemetabasemysqlpostgrespostgresqlreportingslacksql-editorvisualization
metabot llm calls: tools are optional/maybe (#71555)
Oleksandr Solovyovb93319ab5754
diff --git a/src/metabase/metabot/self/core.clj b/src/metabase/metabot/self/core.cljindex 607eb3c4b11..ca40a88da92 100644--- a/src/metabase/metabot/self/core.clj+++ b/src/metabase/metabot/self/core.clj@@ -46,7 +46,7 @@[:model {:optional true} :string][:system {:optional true} [:maybe :string]][:input {:optional true} [:sequential :map]]- [:tools {:optional true} [:sequential ToolEntry]]+ [:tools {:optional true} [:maybe [:sequential ToolEntry]]][:tool_choice {:optional true} [:maybe [:enum "auto" "required"]]][:temperature {:optional true} [:maybe number?]][:max-tokens {:optional true} [:maybe :int]]@@ -96,6 +96,9 @@(str/starts-with? line ":")(recur acc)+ (str/starts-with? line "event:")+ (recur acc)+:else(do(log/warn "SSE unexpected line" {:line line})diff --git a/test/metabase/metabot/test_util.clj b/test/metabase/metabot/test_util.cljindex 9116c58a225..3d6fead7e3e 100644--- a/test/metabase/metabot/test_util.clj+++ b/test/metabase/metabot/test_util.clj@@ -53,10 +53,14 @@;;; ──────────────────────────────────────────────────────────────────(defn make-sse- "Encode a sequence of values as an SSE data stream string."+ "Encode a sequence of values as an SSE data stream string.+ Includes `event:` lines like the real Anthropic/OpenAI APIs do."^String [v]- (->> (map json/encode v)- (map #(str "data: " % "\n\n"))+ (->> v+ (map (fn [item]+ (let [event-type (or (some-> (:type item) name)+ "message")]+ (str "event: " event-type "\ndata: " (json/encode item) "\n\n"))))(str/join)));;; ──────────────────────────────────────────────────────────────────