Skip to content

Commit

Permalink
use float64 for embedding
Browse files Browse the repository at this point in the history
  • Loading branch information
devinyf committed May 28, 2024
1 parent d474851 commit fabee62
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion embedding/dtypes.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ type Response struct {

type Embedding struct {
TextIndex int `json:"text_index"`
Embedding []float32 `json:"embedding"`
Embedding []float64 `json:"embedding"`
}

type Output struct {
Expand Down
4 changes: 2 additions & 2 deletions tongyiclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ func (q *TongyiClient) CreateSpeechToTextGeneration(ctx context.Context, request
return nil
}

func (q *TongyiClient) CreateEmbedding(ctx context.Context, r *embedding.Request) ([][]float32, int, error) {
func (q *TongyiClient) CreateEmbedding(ctx context.Context, r *embedding.Request) ([][]float64, int, error) {
resp, err := embedding.CreateEmbedding(ctx, r, q.httpCli, q.token)
if err != nil {
return nil, 0, err
Expand All @@ -235,7 +235,7 @@ func (q *TongyiClient) CreateEmbedding(ctx context.Context, r *embedding.Request
return nil, 0, ErrEmptyResponse
}

embeddings := make([][]float32, 0)
embeddings := make([][]float64, 0)
for i := 0; i < len(resp.Output.Embeddings); i++ {
embeddings = append(embeddings, resp.Output.Embeddings[i].Embedding)
}
Expand Down

0 comments on commit fabee62

Please sign in to comment.