Get up and running with Kimi, GLM, MiniMax, DeepSeek, gpt-oss, Qwen, Gemma and other models.
runner: always truncate embeddings requests (#12714)
Jeffrey Morgan5fe7ba1b9b1c
diff --git a/integration/embed_test.go b/integration/embed_test.goindex a68524486..3a8bcd248 100644--- a/integration/embed_test.go+++ b/integration/embed_test.go@@ -258,6 +258,19 @@ func TestAllMiniLMEmbedTruncate(t *testing.T) {}},},+ {+ name: "boundary truncation",+ request: api.EmbedRequest{+ Model: "all-minilm",+ Input: "why is the sky blue? Why is the sky blue? hi there my",+ Options: map[string]any{"num_ctx": 16},+ },+ check: func(res *api.EmbedResponse, err error) {+ if err != nil {+ t.Fatal(err)+ }+ },+ },}for _, req := range cases {diff --git a/runner/llamarunner/runner.go b/runner/llamarunner/runner.goindex 163aaa62d..a5e7eb331 100644--- a/runner/llamarunner/runner.go+++ b/runner/llamarunner/runner.go@@ -697,7 +697,14 @@ func (s *Server) embeddings(w http.ResponseWriter, r *http.Request) {w.Header().Set("Content-Type", "application/json")- seq, err := s.NewSequence(req.Content, nil, NewSequenceParams{embedding: true})+ seq, err := s.NewSequence(req.Content, nil, NewSequenceParams{+ embedding: true,++ // TODO (jmorganca): this should be provided by the server via the+ // request options and truncated here in the runner, instead of relying on+ // the server's truncate logic+ truncate: true,+ })if err != nil {http.Error(w, fmt.Sprintf("Failed to create new sequence: %v", err), http.StatusInternalServerError)returndiff --git a/runner/ollamarunner/runner.go b/runner/ollamarunner/runner.goindex af212ecef..7b72bf92d 100644--- a/runner/ollamarunner/runner.go+++ b/runner/ollamarunner/runner.go@@ -946,7 +946,14 @@ func (s *Server) embeddings(w http.ResponseWriter, r *http.Request) {}w.Header().Set("Content-Type", "application/json")- seq, err := s.NewSequence(req.Content, nil, NewSequenceParams{embedding: true})+ seq, err := s.NewSequence(req.Content, nil, NewSequenceParams{+ embedding: true,++ // TODO (jmorganca): this should be provided by the server via the+ // request options and truncated here in the runner, instead of relying on+ // the server's truncate logic+ truncate: true,+ })if err != nil {http.Error(w, fmt.Sprintf("failed to create new sequence: %v", err), http.StatusInternalServerError)return