refactor: Refactor endpoint and model compatibility check (#180)
* Add model check for chat stream * Sync model checks * Fix typo * Fix functino * refactor: Refactor endpoint and model compatibility check * apply review suggestions * minor fix * invert return boolean flag * fix test
This commit is contained in:
@@ -37,8 +37,14 @@ func (c *Client) CreateChatCompletionStream(
|
||||
ctx context.Context,
|
||||
request ChatCompletionRequest,
|
||||
) (stream *ChatCompletionStream, err error) {
|
||||
urlSuffix := "/chat/completions"
|
||||
if !checkEndpointSupportsModel(urlSuffix, request.Model) {
|
||||
err = ErrChatCompletionInvalidModel
|
||||
return
|
||||
}
|
||||
|
||||
request.Stream = true
|
||||
req, err := c.newStreamRequest(ctx, "POST", "/chat/completions", request)
|
||||
req, err := c.newStreamRequest(ctx, "POST", urlSuffix, request)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user