From b9ba860781e2d49aaa5448b7c575c99d372cdc2c Mon Sep 17 00:00:00 2001 From: Daniel Mesquita Date: Thu, 15 Aug 2024 14:00:05 -0300 Subject: [PATCH] config google wire --- Makefile | 4 +- cmd/cli/main.go | 37 ++---------------- gen.go | 3 ++ go.mod | 1 + go.sum | 54 ++++++++++++++++++++++++++ internal/app/cli/main.go | 17 ++++++++ internal/app/lambda/lambda.go | 28 +------------ internal/app/wire.go | 43 ++++++++++++++++++++ internal/app/wire_gen.go | 31 +++++++++++++++ internal/domain/usecase/sync_one.go | 4 +- internal/provider/gpt/gpt.go | 2 +- internal/provider/gpt/openai/openai.go | 2 +- 12 files changed, 161 insertions(+), 65 deletions(-) create mode 100644 gen.go create mode 100644 internal/app/cli/main.go create mode 100644 internal/app/wire.go create mode 100644 internal/app/wire_gen.go diff --git a/Makefile b/Makefile index 2012605..f66e544 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -.PHONY: default install test lint update build copy clear zip +.PHONY: default install gen test lint update build copy clear zip default: dev @@ -8,6 +8,8 @@ run: @go run ./cmd/cli/main.go install: @go mod download +gen: + @go generate ./... test: @go test -count=1 -v ./... lint: diff --git a/cmd/cli/main.go b/cmd/cli/main.go index 28fa54c..6bdfddb 100644 --- a/cmd/cli/main.go +++ b/cmd/cli/main.go @@ -1,40 +1,9 @@ -package cli +package main -import ( - "log/slog" - - "github.com/danielmesquitta/openfinance/internal/config" - "github.com/danielmesquitta/openfinance/internal/domain/usecase" - "github.com/danielmesquitta/openfinance/internal/pkg/validator" - "github.com/danielmesquitta/openfinance/internal/provider/companyapi/brasilapi" - "github.com/danielmesquitta/openfinance/internal/provider/gpt/openai" - "github.com/danielmesquitta/openfinance/internal/provider/openfinance/meupluggyapi" - "github.com/danielmesquitta/openfinance/internal/provider/sheet/notionapi" -) +import "github.com/danielmesquitta/openfinance/internal/app/cli" func main() { - val := validator.NewValidator() - env := config.NewEnv(val) - companyAPIProvider := brasilapi.NewClient() - gptProvider := openai.NewOpenAIClient(env) - sheetProvider := notionapi.NewClient(env) - openFinanceAPIProvider := meupluggyapi.NewClient(env) - - u := usecase.NewSyncAll( - val, - env, - companyAPIProvider, - gptProvider, - sheetProvider, - openFinanceAPIProvider, - ) - - err := u.Execute(usecase.SyncAllDTO{}) - if err != nil { + if err := cli.Run(); err != nil { panic(err) } - - slog.Info( - "SyncAll executed successfully", - ) } diff --git a/gen.go b/gen.go new file mode 100644 index 0000000..d08bac4 --- /dev/null +++ b/gen.go @@ -0,0 +1,3 @@ +package main + +//go:generate go run -mod=mod github.com/google/wire/cmd/wire diff --git a/go.mod b/go.mod index eb5ad48..170a58e 100644 --- a/go.mod +++ b/go.mod @@ -7,6 +7,7 @@ require ( github.com/go-playground/locales v0.14.1 github.com/go-playground/universal-translator v0.18.1 github.com/go-playground/validator/v10 v10.22.0 + github.com/google/wire v0.6.0 github.com/sashabaranov/go-openai v1.28.1 github.com/spf13/viper v1.19.0 ) diff --git a/go.sum b/go.sum index 6a7378b..e0497c8 100644 --- a/go.sum +++ b/go.sum @@ -18,8 +18,12 @@ github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJn github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY= github.com/go-playground/validator/v10 v10.22.0 h1:k6HsTZ0sTnROkhS//R0O+55JgM8C4Bx7ia+JlgcnOao= github.com/go-playground/validator/v10 v10.22.0/go.mod h1:dbuPbCMFw/DrkbEynArYaCwl3amGuJotoKCe95atGMM= +github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/subcommands v1.2.0/go.mod h1:ZjhPrFU+Olkh9WazFPsl27BQ4UPiG37m3yTrtFlrHVk= +github.com/google/wire v0.6.0 h1:HBkoIh4BdSxoyo9PveV8giw7ZsaBOvzWKfcg/6MrVwI= +github.com/google/wire v0.6.0/go.mod h1:F4QhpQ9EDIdJ1Mbop/NZBRB+5yrR6qg3BnctaoUk6NA= github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= @@ -69,18 +73,68 @@ github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsT github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU= +github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc= +golang.org/x/crypto v0.18.0/go.mod h1:R0j02AL6hcrfOiy9T4ZYp/rcWeMxM3L6QYxlOuEG1mg= golang.org/x/crypto v0.26.0 h1:RrRspgV4mU+YwB4FYnuBoKsUapNIL5cohGAmSH3azsw= golang.org/x/crypto v0.26.0/go.mod h1:GY7jblb9wI+FOo5y8/S2oY4zWP07AkOJ4+jxCqdqn54= golang.org/x/exp v0.0.0-20240808152545-0cdaa3abc0fa h1:ELnwvuAXPNtPk1TJRuGkI9fDTwym6AYBu0qzT8AcHdI= golang.org/x/exp v0.0.0-20240808152545-0cdaa3abc0fa/go.mod h1:akd2r19cwCdwSwWeIdzYQGa/EZZyqcOdwWiwj5L5eKQ= +golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= +golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/mod v0.14.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= +golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= +golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk= +golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY= golang.org/x/net v0.28.0 h1:a9JDOJc5GMUJ0+UDqmLT86WiEy7iWyIhz8gz8E4e5hE= golang.org/x/net v0.28.0/go.mod h1:yqtgsTWOOnlGLG9GFRrK3++bGOUEkNBoHZc8MEDWPNg= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= +golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg= golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= +golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= +golang.org/x/term v0.12.0/go.mod h1:owVbMEjm3cBLCHdkQu9b1opXd4ETQWc3BhuQGKgXgvU= +golang.org/x/term v0.16.0/go.mod h1:yn7UURbUtPyrVJPGPq404EukNFxcm/foM+bV/bfcDsY= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/text v0.17.0 h1:XtiM5bkSOt+ewxlOE/aE/AKEHibwj/6gvWMl9Rsh0Qc= golang.org/x/text v0.17.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= +golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= +golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58= +golang.org/x/tools v0.17.0/go.mod h1:xsh6VxdV005rRVaS6SSAf9oiAqljS7UZUacMZ8Bnsps= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= diff --git a/internal/app/cli/main.go b/internal/app/cli/main.go new file mode 100644 index 0000000..11df323 --- /dev/null +++ b/internal/app/cli/main.go @@ -0,0 +1,17 @@ +package cli + +import ( + "github.com/danielmesquitta/openfinance/internal/app" + "github.com/danielmesquitta/openfinance/internal/domain/usecase" +) + +func Run() error { + syncAllUseCase := app.NewSyncAllUseCase() + + err := syncAllUseCase.Execute(usecase.SyncDTO{}) + if err != nil { + return err + } + + return nil +} diff --git a/internal/app/lambda/lambda.go b/internal/app/lambda/lambda.go index b86af59..f2e17b2 100644 --- a/internal/app/lambda/lambda.go +++ b/internal/app/lambda/lambda.go @@ -6,38 +6,14 @@ import ( "net/http" "github.com/aws/aws-lambda-go/events" - "github.com/danielmesquitta/openfinance/internal/config" + "github.com/danielmesquitta/openfinance/internal/app" "github.com/danielmesquitta/openfinance/internal/domain/usecase" - "github.com/danielmesquitta/openfinance/internal/pkg/validator" - "github.com/danielmesquitta/openfinance/internal/provider/companyapi/brasilapi" - "github.com/danielmesquitta/openfinance/internal/provider/gpt/openai" - "github.com/danielmesquitta/openfinance/internal/provider/openfinance/meupluggyapi" - "github.com/danielmesquitta/openfinance/internal/provider/sheet/notionapi" ) func Handler( _ events.APIGatewayProxyRequest, ) (events.APIGatewayProxyResponse, error) { - val := validator.NewValidator() - env := config.NewEnv(val) - companyAPIProvider := brasilapi.NewClient() - gptProvider := openai.NewOpenAIClient(env) - sheetProvider := notionapi.NewClient(env) - openFinanceAPIProvider := meupluggyapi.NewClient(env) - - syncOneUseCase := usecase.NewSyncOne( - val, - companyAPIProvider, - gptProvider, - sheetProvider, - openFinanceAPIProvider, - ) - - syncAllUseCase := usecase.NewSyncAll( - val, - env, - syncOneUseCase, - ) + syncAllUseCase := app.NewSyncAllUseCase() err := syncAllUseCase.Execute(usecase.SyncDTO{}) if err != nil { diff --git a/internal/app/wire.go b/internal/app/wire.go new file mode 100644 index 0000000..c6ce573 --- /dev/null +++ b/internal/app/wire.go @@ -0,0 +1,43 @@ +//go:build wireinject +// +build wireinject + +package app + +import ( + "github.com/danielmesquitta/openfinance/internal/config" + "github.com/danielmesquitta/openfinance/internal/domain/usecase" + "github.com/danielmesquitta/openfinance/internal/pkg/validator" + "github.com/danielmesquitta/openfinance/internal/provider/companyapi" + "github.com/danielmesquitta/openfinance/internal/provider/companyapi/brasilapi" + "github.com/danielmesquitta/openfinance/internal/provider/gpt" + "github.com/danielmesquitta/openfinance/internal/provider/gpt/openai" + "github.com/danielmesquitta/openfinance/internal/provider/openfinance" + "github.com/danielmesquitta/openfinance/internal/provider/openfinance/meupluggyapi" + "github.com/danielmesquitta/openfinance/internal/provider/sheet" + "github.com/danielmesquitta/openfinance/internal/provider/sheet/notionapi" + "github.com/google/wire" +) + +func NewSyncAllUseCase() *usecase.SyncAll { + wire.Build( + validator.NewValidator, + config.NewEnv, + + wire.Bind(new(companyapi.APIProvider), new(*brasilapi.Client)), + brasilapi.NewClient, + + wire.Bind(new(gpt.Provider), new(*openai.OpenAIClient)), + openai.NewOpenAIClient, + + wire.Bind(new(sheet.Provider), new(*notionapi.Client)), + notionapi.NewClient, + + wire.Bind(new(openfinance.APIProvider), new(*meupluggyapi.Client)), + meupluggyapi.NewClient, + + usecase.NewSyncOne, + usecase.NewSyncAll, + ) + + return &usecase.SyncAll{} +} diff --git a/internal/app/wire_gen.go b/internal/app/wire_gen.go new file mode 100644 index 0000000..b91b730 --- /dev/null +++ b/internal/app/wire_gen.go @@ -0,0 +1,31 @@ +// Code generated by Wire. DO NOT EDIT. + +//go:generate go run -mod=mod github.com/google/wire/cmd/wire +//go:build !wireinject +// +build !wireinject + +package app + +import ( + "github.com/danielmesquitta/openfinance/internal/config" + "github.com/danielmesquitta/openfinance/internal/domain/usecase" + "github.com/danielmesquitta/openfinance/internal/pkg/validator" + "github.com/danielmesquitta/openfinance/internal/provider/companyapi/brasilapi" + "github.com/danielmesquitta/openfinance/internal/provider/gpt/openai" + "github.com/danielmesquitta/openfinance/internal/provider/openfinance/meupluggyapi" + "github.com/danielmesquitta/openfinance/internal/provider/sheet/notionapi" +) + +// Injectors from wire.go: + +func NewSyncAllUseCase() *usecase.SyncAll { + validatorValidator := validator.NewValidator() + env := config.NewEnv(validatorValidator) + client := brasilapi.NewClient() + openAIClient := openai.NewOpenAIClient(env) + notionapiClient := notionapi.NewClient(env) + meupluggyapiClient := meupluggyapi.NewClient(env) + syncOne := usecase.NewSyncOne(validatorValidator, client, openAIClient, notionapiClient, meupluggyapiClient) + syncAll := usecase.NewSyncAll(validatorValidator, env, syncOne) + return syncAll +} diff --git a/internal/domain/usecase/sync_one.go b/internal/domain/usecase/sync_one.go index 1dbe116..03b50c2 100644 --- a/internal/domain/usecase/sync_one.go +++ b/internal/domain/usecase/sync_one.go @@ -20,7 +20,7 @@ import ( type SyncOne struct { val *validator.Validator companyAPIProvider companyapi.APIProvider - gptProvider gpt.GPTProvider + gptProvider gpt.Provider sheetProvider sheet.Provider openFinanceAPIProvider openfinance.APIProvider } @@ -28,7 +28,7 @@ type SyncOne struct { func NewSyncOne( val *validator.Validator, companyAPIProvider companyapi.APIProvider, - gptProvider gpt.GPTProvider, + gptProvider gpt.Provider, sheetProvider sheet.Provider, openFinanceAPIProvider openfinance.APIProvider, ) *SyncOne { diff --git a/internal/provider/gpt/gpt.go b/internal/provider/gpt/gpt.go index 0ef1bac..520df18 100644 --- a/internal/provider/gpt/gpt.go +++ b/internal/provider/gpt/gpt.go @@ -1,5 +1,5 @@ package gpt -type GPTProvider interface { +type Provider interface { CreateChatCompletion(message string) (string, error) } diff --git a/internal/provider/gpt/openai/openai.go b/internal/provider/gpt/openai/openai.go index 18f3b68..9b0eb29 100644 --- a/internal/provider/gpt/openai/openai.go +++ b/internal/provider/gpt/openai/openai.go @@ -42,4 +42,4 @@ func (o *OpenAIClient) CreateChatCompletion(message string) (string, error) { return resp.Choices[0].Message.Content, nil } -var _ gpt.GPTProvider = (*OpenAIClient)(nil) +var _ gpt.Provider = (*OpenAIClient)(nil)