go-openai icon indicating copy to clipboard operation
go-openai copied to clipboard

Use setters pattern for `fullURL` method

Open sashabaranov opened this issue 1 year ago • 0 comments

Currently client's fullURL method expects optional first argument to be an Azure model name:

// fullURL returns full URL for request.
// args[0] is model name, if API type is Azure, model name is required to get deployment name.
func (c *Client) fullURL(suffix string, args ...any) string {

Let's make this more straighforward by using setters pattern similar to newRequest method:

func (c *Client) newRequest(ctx context.Context, method, url string, setters ...requestOption) (*http.Request, error) {

sashabaranov avatar Jan 15 '24 12:01 sashabaranov