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

Function createAIProviderForTest

coderd/exp_chats_test.go:10625–10646  ·  view source on GitHub ↗
(
	t testing.TB,
	client *codersdk.ExperimentalClient,
	provider string,
	apiKey string,
)

Source from the content-addressed store, hash-verified

10623}
10624
10625func createAIProviderForTest(
10626 t testing.TB,
10627 client *codersdk.ExperimentalClient,
10628 provider string,
10629 apiKey string,
10630) codersdk.AIProvider {
10631 t.Helper()
10632
10633 ctx := testutil.Context(t, testutil.WaitLong)
10634 req := codersdk.CreateAIProviderRequest{
10635 Type: codersdk.AIProviderType(provider),
10636 Name: "test-" + provider + "-" + uuid.NewString(),
10637 BaseURL: aiProviderBaseURLForTest(provider),
10638 Enabled: true,
10639 }
10640 if apiKey != "" {
10641 req.APIKeys = []string{apiKey}
10642 }
10643 aiProvider, err := client.CreateAIProvider(ctx, req)
10644 require.NoError(t, err)
10645 return aiProvider
10646}
10647
10648func aiProviderBaseURLForTest(provider string) string {
10649 switch provider {

Calls 5

ContextFunction · 0.92
AIProviderTypeTypeAlias · 0.92
aiProviderBaseURLForTestFunction · 0.85
CreateAIProviderMethod · 0.80
HelperMethod · 0.65

Tested by

no test coverage detected