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

require (
github.com/cloudwego/hertz v0.7.3
github.com/go-playground/validator/v10 v10.16.0
github.com/hertz-contrib/logger/zap v1.1.0
github.com/joho/godotenv v1.5.1
github.com/spf13/cobra v1.8.0
github.com/stretchr/testify v1.8.2
go.uber.org/goleak v1.3.0
Expand All @@ -22,27 +22,21 @@ require (
github.com/cloudwego/netpoll v0.5.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/fsnotify/fsnotify v1.5.4 // indirect
github.com/gabriel-vasile/mimetype v1.4.3 // 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
github.com/google/go-cmp v0.6.0 // indirect
github.com/henrylee2cn/ameda v1.4.10 // indirect
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/leodido/go-urn v1.2.4 // indirect
github.com/nyaruka/phonenumbers v1.0.55 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/stretchr/testify v1.8.2 // indirect
github.com/tidwall/gjson v1.14.4 // indirect
github.com/tidwall/match v1.1.1 // indirect
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/sys v0.13.0 // indirect
google.golang.org/protobuf v1.27.1 // indirect
)
28 changes: 4 additions & 24 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,6 @@ 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/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=
github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY=
github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY=
github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY=
github.com/go-playground/validator/v10 v10.16.0 h1:x+plE831WK4vaKHO/jpgUGsvLKIqRRkz6M78GuJAfGE=
github.com/go-playground/validator/v10 v10.16.0/go.mod h1:9iXMNT7sEkjXb0I+enO7QXmzG6QCsPWY4zveKFVRSyU=
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.5.0 h1:LUVKkCeviFUMKqHa4tXIIij/lbhnMbP7Fn5wKdKkRh4=
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
Expand All @@ -47,16 +37,12 @@ github.com/hertz-contrib/logger/zap v1.1.0 h1:4efINiIDJrXEtAFeEdDJvc3Hye0VFxp+0X
github.com/hertz-contrib/logger/zap v1.1.0/go.mod h1:D/rJJgsYn+SGaHVfVqWS3vHTbbc7ODAlJO+6smWgTeE=
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0=
github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4=
github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo=
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=
github.com/nyaruka/phonenumbers v1.0.55/go.mod h1:sDaTZ/KPX5f8qyV9qN+hIm+4ZBARJrupC6LuhshJq1U=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
Expand Down Expand Up @@ -100,20 +86,14 @@ 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/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/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/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=
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