Skip to content

Commit

Permalink
#29: gofumpt
Browse files Browse the repository at this point in the history
  • Loading branch information
mkrueger12 committed Dec 20, 2023
1 parent 2f3695a commit 519128e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
2 changes: 0 additions & 2 deletions pkg/providers/openai/chat.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ type ChatUsage struct {
}

func (c *Client) CreateChatRequest(message []byte) *ChatRequest {

err := json.Unmarshal(message, &requestBody)
if err != nil {
slog.Error("Error:", err)
Expand Down Expand Up @@ -181,7 +180,6 @@ func (c *Client) CreateChatResponse(ctx context.Context, r *ChatRequest) (*ChatR
}

func (c *Client) createChatHertz(ctx context.Context, payload *ChatRequest) (*ChatResponse, error) {

slog.Info("running createChat")

if payload.StreamingFunc != nil {
Expand Down
12 changes: 4 additions & 8 deletions pkg/providers/openai/openaiclient.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//TODO: Explore resource pooling
// TODO: Explore resource pooling
// TODO: Optimize Type use
// TODO: Explore Hertz TLS & resource pooling

Expand All @@ -8,10 +8,11 @@ import (
"context"
"errors"
"fmt"
"gopkg.in/yaml.v2"
"log/slog"
"os"

"gopkg.in/yaml.v2"

"glide/pkg/providers"

"github.com/cloudwego/hertz/pkg/app/client"
Expand Down Expand Up @@ -55,7 +56,6 @@ type Client struct {
}

func (c *Client) Run(poolName string, modelName string, payload []byte) (*ChatResponse, error) {

c, err := c.NewClient(poolName, modelName)
if err != nil {
slog.Error("Error:" + err.Error())
Expand Down Expand Up @@ -84,11 +84,10 @@ func (c *Client) NewClient(poolName string, modelName string) (*Client, error) {
// modelName is determined by the model pool
// poolName is determined by the route the request came from

var providerName = "openai"
providerName := "openai"

// Read the YAML file
data, err := os.ReadFile("/Users/max/code/Glide/config.yaml")

if err != nil {
slog.Error("Failed to read file: %v", err)
return nil, err
Expand Down Expand Up @@ -144,15 +143,12 @@ func (c *Client) NewClient(poolName string, modelName string) (*Client, error) {
}

return client, nil

}

func HttpClient() *client.Client {

Check warning on line 148 in pkg/providers/openai/openaiclient.go

View workflow job for this annotation

GitHub Actions / Static Checks

var-naming: func HttpClient should be HTTPClient (revive)

c, err := client.NewClient()
if err != nil {
slog.Error(err.Error())
}
return c

}

0 comments on commit 519128e

Please sign in to comment.