Browse Source
expose underlying error on embedding failure (#7743)
Avoid a round-trip asking users for logs to see what went wrong.
jessegross/sample
Daniel Hiltgen
1 year ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with
1 additions and
1 deletions
-
server/routes.go
|
|
|
@ -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 |
|
|
|
} |
|
|
|
|
|
|
|
|