null truncate

This commit is contained in:
Michael Yang 2025-08-22 16:57:34 -07:00
parent c457628090
commit d05fc26570
2 changed files with 2 additions and 7 deletions

View File

@ -382,7 +382,7 @@ type EmbedRequest struct {
// this request.
KeepAlive *Duration `json:"keep_alive,omitempty"`
Truncate *bool `json:"truncate,omitempty"`
Truncate types.Null[bool] `json:"truncate,omitempty"`
// Options lists model-specific options.
Options map[string]any `json:"options"`

View File

@ -487,12 +487,6 @@ func (s *Server) EmbedHandler(c *gin.Context) {
return
}
truncate := true
if req.Truncate != nil && !*req.Truncate {
truncate = false
}
var input []string
switch i := req.Input.(type) {
@ -541,6 +535,7 @@ func (s *Server) EmbedHandler(c *gin.Context) {
}
var count int
truncate := req.Truncate.Value(true)
for i, s := range input {
tokens, err := r.Tokenize(c.Request.Context(), s)
if err != nil {