@@ -19,11 +19,11 @@ type Usage struct {
1919 TotalTokens int `json:"total_tokens"`
2020}
2121
22- // Embedding is openai API vector embedding.
22+ // Embedding is openai API embedding.
2323type Embedding struct {
24- Object string `json:"object"`
25- Index int `json:"index"`
26- Embedding []float64 `json:"embedding "`
24+ Object string `json:"object"`
25+ Index int `json:"index"`
26+ Vector []float64 `json:"vector "`
2727}
2828
2929// EmbeddingString is base64 encoded embedding.
@@ -87,9 +87,9 @@ func ToEmbeddings[T any](resp io.Reader) ([]*Embedding, error) {
8787 return nil , err
8888 }
8989 emb := & Embedding {
90- Object : d .Object ,
91- Index : d .Index ,
92- Embedding : floats ,
90+ Object : d .Object ,
91+ Index : d .Index ,
92+ Vector : floats ,
9393 }
9494 embs = append (embs , emb )
9595 }
@@ -98,9 +98,9 @@ func ToEmbeddings[T any](resp io.Reader) ([]*Embedding, error) {
9898 embs := make ([]* Embedding , 0 , len (e .Data ))
9999 for _ , d := range e .Data {
100100 emb := & Embedding {
101- Object : d .Object ,
102- Index : d .Index ,
103- Embedding : d .Embedding ,
101+ Object : d .Object ,
102+ Index : d .Index ,
103+ Vector : d .Embedding ,
104104 }
105105 embs = append (embs , emb )
106106 }
@@ -112,7 +112,7 @@ func ToEmbeddings[T any](resp io.Reader) ([]*Embedding, error) {
112112
113113// Embeddings returns embeddings for every object in EmbeddingRequest.
114114func (c * Client ) Embeddings (ctx context.Context , embReq * EmbeddingRequest ) ([]* Embedding , error ) {
115- u , err := url .Parse (c .baseURL + "/embeddings" )
115+ u , err := url .Parse (c .baseURL + "/" + c . version + "/ embeddings" )
116116 if err != nil {
117117 return nil , err
118118 }
0 commit comments