mirror of
https://github.com/ollama/ollama.git
synced 2026-04-27 19:25:55 +02:00
use float32
This commit is contained in:
@@ -414,12 +414,12 @@ func (s *Server) EmbedHandler(c *gin.Context) {
|
||||
return s, nil
|
||||
}
|
||||
|
||||
embeddings := [][]float64{}
|
||||
embeddings := [][]float32{}
|
||||
|
||||
switch reqEmbed := req.Input.(type) {
|
||||
case string:
|
||||
if reqEmbed == "" {
|
||||
c.JSON(http.StatusOK, api.EmbedResponse{Embeddings: [][]float64{}})
|
||||
c.JSON(http.StatusOK, api.EmbedResponse{Embeddings: [][]float32{}})
|
||||
return
|
||||
}
|
||||
reqEmbed, err = checkFit(reqEmbed, *req.Truncate)
|
||||
@@ -430,7 +430,7 @@ func (s *Server) EmbedHandler(c *gin.Context) {
|
||||
embeddings, err = runner.llama.Embed(c.Request.Context(), []string{reqEmbed})
|
||||
case []any:
|
||||
if reqEmbed == nil {
|
||||
c.JSON(http.StatusOK, api.EmbedResponse{Embeddings: [][]float64{}})
|
||||
c.JSON(http.StatusOK, api.EmbedResponse{Embeddings: [][]float32{}})
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -610,7 +610,7 @@ type mockLlm struct {
|
||||
completionResp error
|
||||
embeddingResp []float64
|
||||
embeddingRespErr error
|
||||
embedResp [][]float64
|
||||
embedResp [][]float32
|
||||
embedRespErr error
|
||||
tokenizeResp []int
|
||||
tokenizeRespErr error
|
||||
@@ -631,7 +631,7 @@ func (s *mockLlm) Completion(ctx context.Context, req llm.CompletionRequest, fn
|
||||
func (s *mockLlm) Embedding(ctx context.Context, prompt string) ([]float64, error) {
|
||||
return s.embeddingResp, s.embeddingRespErr
|
||||
}
|
||||
func (s *mockLlm) Embed(ctx context.Context, input []string) ([][]float64, error) {
|
||||
func (s *mockLlm) Embed(ctx context.Context, input []string) ([][]float32, error) {
|
||||
return s.embedResp, s.embedRespErr
|
||||
}
|
||||
func (s *mockLlm) Tokenize(ctx context.Context, content string) ([]int, error) {
|
||||
|
||||
Reference in New Issue
Block a user