expose underlying error on embedding failure (#7743)

Avoid a round-trip asking users for logs to see what went wrong.
This commit is contained in:
Daniel Hiltgen 2024-11-19 16:26:05 -08:00 committed by GitHub
parent 807ace5b1f
commit f602ab4de4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -507,7 +507,7 @@ func (s *Server) EmbeddingsHandler(c *gin.Context) {
embedding, err := r.Embedding(c.Request.Context(), req.Prompt)
if err != nil {
slog.Info(fmt.Sprintf("embedding generation failed: %v", err))
c.JSON(http.StatusInternalServerError, gin.H{"error": "failed to generate embedding"})
c.JSON(http.StatusInternalServerError, gin.H{"error": fmt.Errorf("failed to generate embedding: %v", err)})
return
}