-
Notifications
You must be signed in to change notification settings - Fork 4
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
Added the azure openai proxy resource endpoint #56
Conversation
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.
We'll need to add some options to the config page to handle this too.
I'm not sure whether we should support multiple providers being configured at the same time... right now I don't see why not though!
pkg/plugin/settings.go
Outdated
OrganizationID string `json:"organizationId"` | ||
URL string `json:"url"` | ||
OrganizationID string `json:"organizationId"` | ||
UseAzure bool `json:"azureOpenAI"` |
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.
It might be nicer to use an open type here rather than a bool
. Something like
type openAIType string
const (
openAITypeOpenAI openAIType "openai"
openAITypeAzure openAIType "azure"
)
above, then
UseAzure bool `json:"azureOpenAI"` | |
Type openAIType `json:"type"` |
in the settings.
(in case in future people want support for other providers which look and act like OpenAI)
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.
This will need rebasing on main
where there are some important changes in path handling in stream.go - basically when creating the path we should no longer use the request's path, instead we should just hardcode /chat/completions
.
@sd2k Attempted to try handling the proxy errors, but couldn't really find a good working method. currently just collecting the errors and logging. |
690297d
to
21dad62
Compare
Yeah that is a bit annoying, guess there's not much more we can do? I wonder if anyone else has encountered this while using Go's HTTP proxy... Looks like there's 1 unhandled error still left btw 🙏 |
Found the last unhandled error |
Co-authored-by: Ben Sully <[email protected]>
164959e
to
966a493
Compare
@edwardcqian I found a way to nicely return early if we can't parse the URL, unmarshal the body, find a matching deployment, etc. Added a few tests too. I think this is good to go now, but could you test it out when you get a chance? |
…ully By wrapping the ReverseProxy structs with our own structs implementing http.Handler we can return early and send a nicer HTTP response if the user has misconfigured their app (e.g. by omitting a model->deployment entry or adding a bad URL). This also adds a few tests for common cases to make sure we handle such cases correctly.
966a493
to
241120a
Compare
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.
Let's get this merged, I'll take a look at switching the useAzure
boolean to an open type in a separate PR.
Build: Introduce ESM build and Treeshaking
Implements #55
Added proxy implementation for Azure OpenAI
User can opt to use Azure OpenAI backend updating the following logics:
No changes required on the frontend.