Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

29 setup openai client #34

Merged
merged 64 commits into from
Dec 27, 2023
Merged
Show file tree
Hide file tree
Changes from 49 commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
d5e90be
#29: openai client
mkrueger12 Dec 17, 2023
4282f55
#29: add sample
mkrueger12 Dec 17, 2023
33c8930
#29: Refactor OpenAI provider configuration
mkrueger12 Dec 17, 2023
fbbeb7e
#29: Refactor OpenAiClient struct and methods
mkrueger12 Dec 17, 2023
62cd933
#29: Refactor OpenAiClient struct and methods
mkrueger12 Dec 17, 2023
da76319
#29: refactor
mkrueger12 Dec 17, 2023
e3266ac
29: chat converted to Hertz
mkrueger12 Dec 19, 2023
f34604b
#29: Update OpenAI provider configuration and chat request validation
mkrueger12 Dec 19, 2023
1311228
#29: clean up
mkrueger12 Dec 19, 2023
08036df
#29: Remove unused code and refactor parseStreamingChatResponse function
mkrueger12 Dec 19, 2023
c91a81d
#29: Update dependencies in go.mod and go.sum files
mkrueger12 Dec 19, 2023
dd4985e
#29: build client init
mkrueger12 Dec 19, 2023
6128423
#29: CreatChatRequest
mkrueger12 Dec 19, 2023
f791d7a
#29: Fix import and log package names
mkrueger12 Dec 19, 2023
a5caa77
#29: add run method
mkrueger12 Dec 19, 2023
db38f44
#29: tests passing
mkrueger12 Dec 20, 2023
463401b
#29: tests passing
mkrueger12 Dec 20, 2023
e16c13c
#29: add todo
mkrueger12 Dec 20, 2023
71f5da8
#29: Merge branch 'develop' of https://github.com/modelgateway/Glide …
mkrueger12 Dec 20, 2023
c9d9402
#29: go mod tody
mkrueger12 Dec 20, 2023
2f3695a
#29: gofmt
mkrueger12 Dec 20, 2023
519128e
#29: gofumpt
mkrueger12 Dec 20, 2023
1d48263
#29: lint
mkrueger12 Dec 20, 2023
f54f300
#29: lint
mkrueger12 Dec 20, 2023
843997d
#29: lint
mkrueger12 Dec 20, 2023
4f9eda0
#29: fix Implicit memory aliasing
mkrueger12 Dec 20, 2023
388f01c
#29: lint
mkrueger12 Dec 20, 2023
f38473e
#29: update request from defaultParams
mkrueger12 Dec 20, 2023
cc13f38
#29: lint
mkrueger12 Dec 20, 2023
a9a9f0b
#29: lint
mkrueger12 Dec 20, 2023
fe9ad4f
#29: emove unused variable in OpenAiClient constructor
mkrueger12 Dec 21, 2023
bb85259
#29: Update client
mkrueger12 Dec 21, 2023
ae94197
#29: Refactor OpenAI chat functionality
mkrueger12 Dec 21, 2023
45d1959
#29: Fix OpenAI client error handling and validation
mkrueger12 Dec 21, 2023
93c3419
#29: Fix OpenAI client error handling and validation
mkrueger12 Dec 21, 2023
0edd274
#29: Set the appropriate base URL in OpenAiClient constructor
mkrueger12 Dec 21, 2023
fd9e21a
#29: Refactor OpenAI provider configuration
mkrueger12 Dec 21, 2023
c7d341c
#29: comments
mkrueger12 Dec 21, 2023
d922ee9
#29: Refactor OpenAI client and related functions
mkrueger12 Dec 21, 2023
236a319
#29: chores
mkrueger12 Dec 21, 2023
def24a0
#29: chores
mkrueger12 Dec 21, 2023
2e3a97e
#29: comment
mkrueger12 Dec 22, 2023
398829b
#29: create a yaml for provider global configs
mkrueger12 Dec 22, 2023
cda3fc9
#29: comments
mkrueger12 Dec 22, 2023
acac5bd
#29: comments
mkrueger12 Dec 22, 2023
3f8bf68
#29: update http client
mkrueger12 Dec 22, 2023
0065cde
#29: Add file path validation and error handling in openaiclient.go
mkrueger12 Dec 22, 2023
f5a8ecd
#29: move common helpers to types.go
mkrueger12 Dec 23, 2023
e8fef9f
#29: chores
mkrueger12 Dec 23, 2023
cbcfaf3
#29: Refactor OpenAI client and chat request creation
mkrueger12 Dec 26, 2023
9a14b71
#29: Remove unused dependencies and update dependencies
mkrueger12 Dec 26, 2023
906df8d
#29: Update Unified Data structure
mkrueger12 Dec 26, 2023
19e8f46
#29: remove provider
mkrueger12 Dec 26, 2023
597381c
#29: clean up
mkrueger12 Dec 26, 2023
6023254
#29: clean up
mkrueger12 Dec 26, 2023
1d369a3
#29: lint
mkrueger12 Dec 26, 2023
a9598e9
#29: remove hertz comment
mkrueger12 Dec 26, 2023
5a858a6
#29: Merge remote-tracking branch 'origin/develop' into 29-setup-open…
mkrueger12 Dec 26, 2023
98c029d
#29: pass unified data to chat method
mkrueger12 Dec 27, 2023
a4b41f0
#29: init logging
mkrueger12 Dec 27, 2023
80a28c9
#29: init logging
mkrueger12 Dec 27, 2023
8cbe50e
#29: init logging
mkrueger12 Dec 27, 2023
c0b6989
#29: lint
mkrueger12 Dec 27, 2023
5ee8f4a
Merge branch 'develop' into 29-setup-openai-client
mkrueger12 Dec 27, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
.idea
dist
.env
config.yaml
bin
glide
tmp
coverage.txt
precommit.txt
openai_test.go
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we ignore that test file? 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah... I was trying too but got lazy haha

12 changes: 7 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ require (
github.com/spf13/cobra v1.8.0
go.uber.org/goleak v1.3.0
go.uber.org/multierr v1.11.0
gopkg.in/yaml.v2 v2.4.0
)

require (
Expand All @@ -17,7 +18,7 @@ require (
github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 // indirect
github.com/cloudwego/netpoll v0.5.0 // indirect
github.com/fsnotify/fsnotify v1.5.4 // indirect
github.com/gabriel-vasile/mimetype v1.4.3 // indirect
github.com/gabriel-vasile/mimetype v1.4.2 // indirect
github.com/go-playground/locales v0.14.1 // indirect
github.com/go-playground/universal-translator v0.18.1 // indirect
github.com/golang/protobuf v1.5.0 // indirect
Expand All @@ -26,6 +27,7 @@ require (
github.com/henrylee2cn/goutil v0.0.0-20210127050712-89660552f6f8 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/klauspost/cpuid/v2 v2.0.9 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/leodido/go-urn v1.2.4 // indirect
github.com/nyaruka/phonenumbers v1.0.55 // indirect
github.com/spf13/pflag v1.0.5 // indirect
Expand All @@ -34,9 +36,9 @@ require (
github.com/tidwall/pretty v1.2.0 // indirect
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
golang.org/x/arch v0.0.0-20210923205945-b76863e36670 // indirect
golang.org/x/crypto v0.16.0 // indirect
golang.org/x/net v0.19.0 // indirect
golang.org/x/sys v0.15.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/crypto v0.7.0 // indirect
golang.org/x/net v0.8.0 // indirect
golang.org/x/sys v0.13.0 // indirect
golang.org/x/text v0.8.0 // indirect
google.golang.org/protobuf v1.27.1 // indirect
)
29 changes: 19 additions & 10 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,14 @@ github.com/cloudwego/hertz v0.7.3/go.mod h1:WliNtVbwihWHHgAaIQEbVXl0O3aWj0ks1eoP
github.com/cloudwego/netpoll v0.5.0 h1:oRrOp58cPCvK2QbMozZNDESvrxQaEHW2dCimmwH1lcU=
github.com/cloudwego/netpoll v0.5.0/go.mod h1:xVefXptcyheopwNDZjDPcfU6kIjZXZ4nY550k1yH9eQ=
github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/fsnotify/fsnotify v1.5.4 h1:jRbGcIw6P2Meqdwuo0H1p6JVLbL5DHKAKlYndzMwVZI=
github.com/fsnotify/fsnotify v1.5.4/go.mod h1:OVB6XrOHzAwXMpEM7uPOzcehqUV2UqJxmVXmkdnm1bU=
github.com/gabriel-vasile/mimetype v1.4.3 h1:in2uUcidCuFcDKtdcBxlR0rJ1+fsokWf+uqxgUFjbI0=
github.com/gabriel-vasile/mimetype v1.4.3/go.mod h1:d8uq/6HKRL6CGdk+aubisF/M5GcPfT7nKyLpA0lbSSk=
github.com/gabriel-vasile/mimetype v1.4.2 h1:w5qFW6JKBz9Y393Y4q372O9A7cUSequkh1Q7OhCmWKU=
github.com/gabriel-vasile/mimetype v1.4.2/go.mod h1:zApsH/mKG4w07erKIaJPFiX0Tsq9BFQgN3qGY5GnNgA=
github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s=
github.com/go-playground/assert/v2 v2.2.0/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=
github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA=
Expand Down Expand Up @@ -49,6 +50,10 @@ github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7
github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
github.com/klauspost/cpuid/v2 v2.0.9 h1:lgaqFMSdTdQYdZ04uHyN2d/eKdOMyi2YLSvlQIBFYa4=
github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/leodido/go-urn v1.2.4 h1:XlAE/cm/ms7TE/VMVoduSpNBoyc2dOxHs5MZSwAN63Q=
github.com/leodido/go-urn v1.2.4/go.mod h1:7ZrI8mTSeBSHl/UaRyKQW1qZeMgak41ANeCNaVckg+4=
github.com/nyaruka/phonenumbers v1.0.55 h1:bj0nTO88Y68KeUQ/n3Lo2KgK7lM1hF7L9NFuwcCl3yg=
Expand Down Expand Up @@ -92,27 +97,31 @@ golang.org/x/arch v0.0.0-20201008161808-52c3e6f60cff/go.mod h1:flIaEI6LNU6xOCD5P
golang.org/x/arch v0.0.0-20210923205945-b76863e36670 h1:18EFjUmQOcUvxNYSkA6jO9VAiXCnxFY6NyDX0bHDmkU=
golang.org/x/arch v0.0.0-20210923205945-b76863e36670/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.16.0 h1:mMMrFzRSCF0GvB7Ne27XVtVAaXLrPmgPC7/v0tkwHaY=
golang.org/x/crypto v0.16.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4=
golang.org/x/crypto v0.7.0 h1:AvwMYaRytfdeVt3u6mLaxYtErKYjxA2OXjJ1HHq6t3A=
golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU=
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.19.0 h1:zTwKpTd2XuCqf8huc7Fo2iSy+4RHPd10s4KzeTnVr1c=
golang.org/x/net v0.19.0/go.mod h1:CfAk/cbD4CthTvqiEl8NpboMuiuOYsAr/7NOjZJtv1U=
golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ=
golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc=
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20220110181412-a018aaa089fe/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc=
golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE=
golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
golang.org/x/text v0.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68=
golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
google.golang.org/protobuf v1.27.1 h1:SnqbnDw1V7RiZcXPx5MEeqPv2s79L9i7BJUlG/+RurQ=
google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
Expand Down
58 changes: 0 additions & 58 deletions pkg/buildAPIRequest.go

This file was deleted.

29 changes: 0 additions & 29 deletions pkg/providers/openai/api.go

This file was deleted.

Loading
Loading