-
Notifications
You must be signed in to change notification settings - Fork 15
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
Chore: Add openai o1 support #366
base: main
Are you sure you want to change the base?
Conversation
4a4025b
to
f0ab964
Compare
openai-model-provider/proxy/proxy.go
Outdated
@@ -96,6 +101,41 @@ func (s *server) proxyDirector(req *http.Request) { | |||
if s.cfg.PathPrefix != "" && !strings.HasPrefix(req.URL.Path, s.cfg.PathPrefix) { | |||
req.URL.Path = s.cfg.PathPrefix + req.URL.Path | |||
} | |||
|
|||
if req.Body == nil || req.Method != http.MethodPost { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it make sense to do this?
if req.Body == nil || req.Method != http.MethodPost { | |
if req.Body == nil || s.cfg.UpstreamHost != "api.openai.com" || req.URL.Path != "/v1/chat/completion" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this, because it means that we can look for errors when we try to unmarshal the body later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yep, I will change this.
Signed-off-by: Daishan Peng <[email protected]>
Signed-off-by: Daishan Peng <[email protected]>
aa67dc3
to
bd15449
Compare
@thedadams Pushed a change that make the response compatiable with stream client in gptscript. |
return nil | ||
} | ||
|
||
func isModelO1(model string) bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The current PR only supports o1, as o1-mini doesn't seem to support system message which could screw a lot of things. We could investigate in a different issue.
bd15449
to
5a2759d
Compare
Add openai o1 support in proxy to modify request body.
obot-platform/obot#1131