-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
refactor: Refactor endpoint and model compatibility check #180
Conversation
Codecov Report
@@ Coverage Diff @@
## master #180 +/- ##
==========================================
+ Coverage 71.30% 71.84% +0.54%
==========================================
Files 21 21
Lines 568 579 +11
==========================================
+ Hits 405 416 +11
Misses 124 124
Partials 39 39
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
Hey, thank you for the PR! |
Hi, I am wondering if it is necessary to have compatibility checks between the endpoint and model, or if it can be removed and let it fail. Here are some points to consider:
|
@j178 What if we check for "incompability" — basically return error only when we are sure that the model is not supported? |
While technically possible, this approach would be very long and difficult to maintain. We would need to explicitly list all unsupported models for each endpoint check, like this: func checkEndpointSupportsModel(endpoint, model string) error {
switch endpoint {
case "/completions":
switch model {
case GPT3Dot5Turbo0301, GPT3Dot5Turbo, GPT4, GPT40314, GPT432K, GPT432K0314:
return ErrCompletionUnsupportedModel
}
case "/chat/completions":
switch model {
case GPT3TextDavinci003, GPT3TextDavinci002, GPT3TextCurie001, GPT3TextBabbage001, GPT3TextAda001, GPT3TextDavinci001, GPT3DavinciInstructBeta, GPT3Davinci, GPT3CurieInstructBeta, GPT3Curie, GPT3Ada, GPT3Babbage, CodexCodeDavinci002, CodexCodeCushman001, CodexCodeDavinci001:
return ErrChatCompletionInvalidModel
}
}
return nil
} |
@j178 here's a simpler approach: type endpointModelPair struct {
endpoint string
model string
}
var disabledPairs = map[endpointModelPair]bool{
{"/completions", "gpt-3.5-turbo"}: true,
}
func main() {
pairIsDisabled := disabledPairs[endpointModelPair{"/completions", "gpt-3.5-turbo"}]
fmt.Println("Pair is disabled:", pairIsDisabled)
}
// Output:
// Pair is disabled: true We can also use |
I applied your suggestion, but I also had to introduce a breaking change: I deleted |
The current CI failure is quite peculiar(I was able to pass the test locally). The panic stack trace appears at
|
In terms of panic: I don't even see the |
Thanks, should be fixed now. |
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.
Great work, thank you so much for the PR!
CreateCompletionStream
andCreateChatCompletionStream
.CreateCompletion
.