You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: client.go
    path of file: ./repos/erda/internal/pkg/ai-functions/sdk
    
    the code of the file until where you have to start completion: // Copyright (c) 2021 Terminus, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package sdk

import (
	"bytes"
	"context"
	_ "embed"
	"e
    
func (c *Client) CreateCompletion(ctx context.Context, req *openai.ChatCompletionRequest) (*openai.ChatCompletionResponse, error) {
	req.Stream = false
	logrus.Infof("CreateCompletion with req: %+v\n", *req)

	var buf bytes.Buffer

	if err := json.NewEncoder(&buf).Encode(req); err != nil {
		return nil, errors.Wrap(err, "failed to Encode CreateCompletionOptions")
	}
	aiProxyClientAK := os.Getenv(AIProxyClientAK)
	if aiProxyClientAK == "" {
		err := errors.Errorf("env %s not set", AIProxyClientAK)
		return nil, errors.Wrap(err, "failed to get ai proxy client ak")
	}
	request, err := http.NewRequest(http.MethodPost, c.URLV1ChatCompletion(), &buf)
	if err != nil {
		return nil, errors.Wrapf(err, "failed to NewRequest, uri: %s", c.URLV1ChatCompletion())
	}
	request.Header.Set(httputil.ContentTypeHeader, "application/json")
	request.Header.Set(httputil.AuthorizationHeader, "Bearer "+aiProxyClientAK)
	for _, o := range c.options {
		o(request)
	}

	logrus.Debugf("Post AI-Proxy Request: %+v", request)
	response, err := c.HttpClient().Do(request)
	if err != nil {
		return nil, errors.Wrapf(err, "failed to Do http request to %s", c.URLV1ChatCompletion())
	}
	defer func() { _ = response.Body.Close() }()

	if response.StatusCode != 200 {
		data, err := io.ReadAll(response.Body)
		if err != nil {
			return nil, errors.Wrap(err, "failed to read response body")
		}
		return nil, errors.Errorf("response not ok, status: %s, message: %s", response.Status, string(data))
	}
	var chatCompletion openai.ChatCompletionResponse
	if err = json.NewDecoder(response.Body).Decode(&chatCompletion); err != nil {
		return nil, errors.Wrap(err, "failed to Decode response to ChatCompletion")
	}

	return &chatCompletion, nil
}