MCPcopy Index your code
hub / github.com/coder/coder / createIntegrationAIProvider

Function createIntegrationAIProvider

coderd/x/chatd/integration_test.go:17–39  ·  view source on GitHub ↗
(
	ctx context.Context,
	t testing.TB,
	client *codersdk.ExperimentalClient,
	providerType codersdk.AIProviderType,
	apiKey string,
	baseURL string,
)

Source from the content-addressed store, hash-verified

15)
16
17func createIntegrationAIProvider(
18 ctx context.Context,
19 t testing.TB,
20 client *codersdk.ExperimentalClient,
21 providerType codersdk.AIProviderType,
22 apiKey string,
23 baseURL string,
24) codersdk.AIProvider {
25 t.Helper()
26 if baseURL == "" {
27 baseURL = defaultIntegrationAIProviderBaseURL(providerType)
28 }
29 provider, err := client.CreateAIProvider(ctx, codersdk.CreateAIProviderRequest{
30 Type: providerType,
31 Name: string(providerType) + "-" + uuid.NewString(),
32 DisplayName: aiProviderDisplayName(providerType),
33 Enabled: true,
34 BaseURL: baseURL,
35 APIKeys: []string{apiKey},
36 })
37 require.NoError(t, err)
38 return provider
39}
40
41func defaultIntegrationAIProviderBaseURL(providerType codersdk.AIProviderType) string {
42 switch providerType {

Calls 4

aiProviderDisplayNameFunction · 0.85
CreateAIProviderMethod · 0.80
HelperMethod · 0.65

Tested by

no test coverage detected