1package provider
 2
 3import (
 4	"github.com/openai/openai-go"
 5	"github.com/openai/openai-go/azure"
 6	"github.com/openai/openai-go/option"
 7)
 8
 9type azureClient struct {
10	*openaiClient
11}
12
13type AzureClient ProviderClient
14
15func newAzureClient(opts providerClientOptions) AzureClient {
16	apiVersion := opts.extraParams["apiVersion"]
17	if apiVersion == "" {
18		apiVersion = "2025-01-01-preview"
19	}
20
21	reqOpts := []option.RequestOption{
22		azure.WithEndpoint(opts.baseURL, apiVersion),
23	}
24
25	reqOpts = append(reqOpts, azure.WithAPIKey(opts.apiKey))
26	base := &openaiClient{
27		providerOptions: opts,
28		client:          openai.NewClient(reqOpts...),
29	}
30
31	return &azureClient{openaiClient: base}
32}