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

Function AIProviderWithOptionalKey

coderd/database/dbgen/dbgen.go:253–269  ·  view source on GitHub ↗

AIProviderWithOptionalKey inserts an AI provider and, when apiKey is not empty, inserts a provider-scoped key for it.

(
	t testing.TB,
	db database.Store,
	seed database.AIProvider,
	apiKey string,
	munge ...func(*database.InsertAIProviderParams),
)

Source from the content-addressed store, hash-verified

251// AIProviderWithOptionalKey inserts an AI provider and, when apiKey is not
252// empty, inserts a provider-scoped key for it.
253func AIProviderWithOptionalKey(
254 t testing.TB,
255 db database.Store,
256 seed database.AIProvider,
257 apiKey string,
258 munge ...func(*database.InsertAIProviderParams),
259) database.AIProvider {
260 t.Helper()
261 provider := AIProvider(t, db, seed, munge...)
262 if apiKey != "" {
263 AIProviderKey(t, db, database.AIProviderKey{
264 ProviderID: provider.ID,
265 APIKey: apiKey,
266 })
267 }
268 return provider
269}
270
271func ChatProvider(t testing.TB, db database.Store, seed database.ChatProvider, munge ...func(*database.InsertChatProviderParams)) database.ChatProvider {
272 t.Helper()

Callers 2

TestGetChatsFilterFunction · 0.92
insertInternalAIProviderFunction · 0.92

Calls 3

AIProviderFunction · 0.70
AIProviderKeyFunction · 0.70
HelperMethod · 0.65

Tested by 2

TestGetChatsFilterFunction · 0.74
insertInternalAIProviderFunction · 0.74