From 4e49d700c255d04f131c4fc2efaae524965e6e20 Mon Sep 17 00:00:00 2001 From: ParthSareen Date: Tue, 19 Nov 2024 16:14:45 -0800 Subject: [PATCH] disallow-streaming-tools --- server/routes.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/server/routes.go b/server/routes.go index f5b05bb5b..a8be8c5b3 100644 --- a/server/routes.go +++ b/server/routes.go @@ -1398,6 +1398,12 @@ func (s *Server) ChatHandler(c *gin.Context) { return } + // Error if streaming is enabled and tools are present + if req.Stream != nil && *req.Stream && len(req.Tools) > 0 { + c.AbortWithStatusJSON(http.StatusBadRequest, gin.H{"error": "streaming is not supported with tools"}) + return + } + // expire the runner if len(req.Messages) == 0 && req.KeepAlive != nil && int(req.KeepAlive.Seconds()) == 0 { model, err := GetModel(req.Model)