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
Log which tools Metabot drops after a stream error (#83747)
Andrei Simionescubd03bac4c40e
diff --git a/src/metabase/metabot/self/core.clj b/src/metabase/metabot/self/core.cljindex 7ce0ede0b97..49a8383a56f 100644--- a/src/metabase/metabot/self/core.clj+++ b/src/metabase/metabot/self/core.clj@@ -1118,7 +1118,8 @@(let [cut-off (for [[id {:keys [task]}] @active :when (not task)] id)](vreset! errored? true)(when (seq cut-off)- (log/warn "Dropping tool calls that a stream error cut off" {:tool-calls cut-off})+ (log/warn "Dropping tool calls that a stream error cut off"+ {:tool-calls (into {} (map (juxt identity #(get-in @active [% :chunks 0 :toolName]))) cut-off)})(vswap! active #(apply dissoc % cut-off))));; otherwise: do nothingdiff --git a/test/metabase/metabot/self/openai/chat_completions_test.clj b/test/metabase/metabot/self/openai/chat_completions_test.cljindex 82a65328dc2..fb57d6fb54d 100644--- a/test/metabase/metabot/self/openai/chat_completions_test.clj+++ b/test/metabase/metabot/self/openai/chat_completions_test.clj@@ -861,6 +861,10 @@:error {:code "server_error" :message "Provider disconnected unexpectedly"}:choices [{:index 0 :delta {:content ""} :finish_reason "error"}]}"Provider disconnected unexpectedly"]+ ["OpenRouter's error finish reason without an error envelope"+ (openrouter/openrouter->aisdk-chunks-xf)+ {:choices [{:index 0 :delta {:content ""} :finish_reason "error"}]}+ "The model provider failed to complete the response"]["Mistral's error finish reason, which carries no message"(mistral/mistral->aisdk-chunks-xf){:id "cmpl-e5cc70bb28c444948073e77776eb30ef"diff --git a/test/metabase/metabot/self_test.clj b/test/metabase/metabot/self_test.cljindex 74a9feedd20..62f4420276f 100644--- a/test/metabase/metabot/self_test.clj+++ b/test/metabase/metabot/self_test.clj@@ -666,7 +666,7 @@(is (=? (conj (vec streamed) {:type :tool-output-available :toolCallId "call-1"})(into [] (self.core/tool-executor-xf test-util/TOOLS) (concat streamed [(last cut-off)]))))(testing "and a warning names the call that never ran"- (is (=? [{:level :warn :message #".*call-2.*"}] (messages))))))))+ (is (=? [{:level :warn :message #".*call-2.*get-time.*"}] (messages))))))));;; tool argument validation tests