Move passthrough model name to constant and clarify error message.

Signed-off-by: Jacob Howard <jacob.howard@docker.com>
This commit is contained in:
Jacob Howard 2025-07-11 15:05:37 +03:00
parent 74c9839a5b
commit d370bbddbc
No known key found for this signature in database
GPG Key ID: 3E8B8F7FEB46FC66
2 changed files with 5 additions and 2 deletions

View File

@ -25,6 +25,9 @@ const (
// defaultRunnerIdleTimeout is the default maximum amount of time that a
// runner can sit idle (i.e. without any requests) before being terminated.
defaultRunnerIdleTimeout = 5 * time.Minute
// passthroughModelName is the model name used for runners associated with
// passthrough backends.
passthroughModelName = "passthrough"
)
var (

View File

@ -321,7 +321,7 @@ func (s *Scheduler) handleOpenAIInference(w http.ResponseWriter, r *http.Request
// backends, we assume they have external model management.
if backendMode == inference.BackendModeCompletion || backendMode == inference.BackendModeEmbedding {
if request.Model == "" {
http.Error(w, "invalid request, model is required", http.StatusBadRequest)
http.Error(w, `invalid request - "model" is required`, http.StatusBadRequest)
return
}
model, err := s.modelManager.GetModel(request.Model)
@ -343,7 +343,7 @@ func (s *Scheduler) handleOpenAIInference(w http.ResponseWriter, r *http.Request
// runners (one for each model used by a passthrough backend).
runnerModel := request.Model
if backendMode == inference.BackendModePassthrough {
runnerModel = "passthrough"
runnerModel = passthroughModelName
}
// Request a runner to execute the request and defer its release.