embedding type 64
This commit is contained in:
parent
bcb63e6e0e
commit
fb390b8902
@ -215,7 +215,7 @@ type EmbeddingRequest struct {
|
|||||||
|
|
||||||
// EmbeddingResponse is the response from [Client.Embeddings].
|
// EmbeddingResponse is the response from [Client.Embeddings].
|
||||||
type EmbeddingResponse struct {
|
type EmbeddingResponse struct {
|
||||||
Embedding []float32 `json:"embedding"`
|
Embedding []float64 `json:"embedding"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// CreateRequest is the request passed to [Client.Create].
|
// CreateRequest is the request passed to [Client.Create].
|
||||||
|
@ -504,7 +504,7 @@ func (s *Server) EmbeddingsHandler(c *gin.Context) {
|
|||||||
|
|
||||||
// an empty request loads the model
|
// an empty request loads the model
|
||||||
if req.Prompt == "" {
|
if req.Prompt == "" {
|
||||||
c.JSON(http.StatusOK, api.EmbeddingResponse{Embedding: []float32{}})
|
c.JSON(http.StatusOK, api.EmbeddingResponse{Embedding: []float64{}})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -515,8 +515,14 @@ func (s *Server) EmbeddingsHandler(c *gin.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
embedding64 := make([]float64, len(embedding[0]))
|
||||||
|
|
||||||
|
for i, v := range embedding[0] {
|
||||||
|
embedding64[i] = float64(v)
|
||||||
|
}
|
||||||
|
|
||||||
resp := api.EmbeddingResponse{
|
resp := api.EmbeddingResponse{
|
||||||
Embedding: embedding[0],
|
Embedding: embedding64,
|
||||||
}
|
}
|
||||||
c.JSON(http.StatusOK, resp)
|
c.JSON(http.StatusOK, resp)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user