Skip to content

Commit

Permalink
done linting
Browse files Browse the repository at this point in the history
  • Loading branch information
AyushSawant18588 committed Nov 23, 2024
1 parent 8730782 commit 5b15527
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
18 changes: 9 additions & 9 deletions embeddings.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,10 @@ type EmbeddingRequest struct {
EncodingFormat EmbeddingEncodingFormat `json:"encoding_format,omitempty"`
// Dimensions The number of dimensions the resulting output embeddings should have.
// Only supported in text-embedding-3 and later models.
Dimensions int `json:"dimensions,omitempty"`
Dimensions int `json:"dimensions,omitempty"`
// The ExtraBody field allows for the inclusion of arbitrary key-value pairs
// in the request body that may not be explicitly defined in this struct.
ExtraBody map[string]any `json:"extra_body,omitempty"`
ExtraBody map[string]any `json:"extra_body,omitempty"`
}

func (r EmbeddingRequest) Convert() EmbeddingRequest {
Expand All @@ -189,10 +189,10 @@ type EmbeddingRequestStrings struct {
EncodingFormat EmbeddingEncodingFormat `json:"encoding_format,omitempty"`
// Dimensions The number of dimensions the resulting output embeddings should have.
// Only supported in text-embedding-3 and later models.
Dimensions int `json:"dimensions,omitempty"`
Dimensions int `json:"dimensions,omitempty"`
// The ExtraBody field allows for the inclusion of arbitrary key-value pairs
// in the request body that may not be explicitly defined in this struct.
ExtraBody map[string]any `json:"extra_body,omitempty"`
ExtraBody map[string]any `json:"extra_body,omitempty"`
}

func (r EmbeddingRequestStrings) Convert() EmbeddingRequest {
Expand Down Expand Up @@ -225,10 +225,10 @@ type EmbeddingRequestTokens struct {
EncodingFormat EmbeddingEncodingFormat `json:"encoding_format,omitempty"`
// Dimensions The number of dimensions the resulting output embeddings should have.
// Only supported in text-embedding-3 and later models.
Dimensions int `json:"dimensions,omitempty"`
Dimensions int `json:"dimensions,omitempty"`
// The ExtraBody field allows for the inclusion of arbitrary key-value pairs
// in the request body that may not be explicitly defined in this struct.
ExtraBody map[string]any `json:"extra_body,omitempty"`
ExtraBody map[string]any `json:"extra_body,omitempty"`
}

func (r EmbeddingRequestTokens) Convert() EmbeddingRequest {
Expand All @@ -254,8 +254,8 @@ func (c *Client) CreateEmbeddings(
baseReq := conv.Convert()

// Prepare the body with only the provided fields.
// The body map is used to dynamically construct the request payload for the embedding API.
// Instead of relying on a fixed struct, the body map allows for flexible inclusion of fields
// The body map is used to dynamically construct the request payload for the embedding API.
// Instead of relying on a fixed struct, the body map allows for flexible inclusion of fields
// based on their presence, avoiding unnecessary or empty fields in the request.
body := make(map[string]any)
body["input"] = baseReq.Input
Expand All @@ -273,7 +273,7 @@ func (c *Client) CreateEmbeddings(
ctx,
http.MethodPost,
c.fullURL("/embeddings", withModel(string(baseReq.Model))),
withBody(body), // Main request body.
withBody(body), // Main request body.
withExtraBody(baseReq.ExtraBody), // Merge ExtraBody fields.
)
if err != nil {
Expand Down
1 change: 1 addition & 0 deletions test.mp3
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
hello

0 comments on commit 5b15527

Please sign in to comment.