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

Function bedrockConfigFromRow

cli/aibridged.go:330–348  ·  view source on GitHub ↗

bedrockConfigFromRow returns nil when the settings have no Bedrock discriminator or when the Bedrock fields are not actually configured. The provider row's BaseUrl is the generic upstream endpoint and is always non-empty, so it cannot serve as a Bedrock detection signal; gate on the settings blob al

(row database.AIProvider, settings codersdk.AIProviderSettings)

Source from the content-addressed store, hash-verified

328// always non-empty, so it cannot serve as a Bedrock detection signal;
329// gate on the settings blob alone via [codersdk.AIProviderBedrockSettings.IsConfigured].
330func bedrockConfigFromRow(row database.AIProvider, settings codersdk.AIProviderSettings) *aibridge.AWSBedrockConfig {
331 if settings.Bedrock == nil {
332 return nil
333 }
334 bedrockSettings := *settings.Bedrock
335 if !bedrockSettings.IsConfigured() {
336 return nil
337 }
338 accessKey := ptr.NilToEmpty(bedrockSettings.AccessKey)
339 accessKeySecret := ptr.NilToEmpty(bedrockSettings.AccessKeySecret)
340 return &aibridge.AWSBedrockConfig{
341 BaseURL: row.BaseUrl,
342 Region: bedrockSettings.Region,
343 AccessKey: accessKey,
344 AccessKeySecret: accessKeySecret,
345 Model: bedrockSettings.Model,
346 SmallFastModel: bedrockSettings.SmallFastModel,
347 }
348}
349
350// circuitBreakerConfig returns nil when the breaker is disabled.
351func circuitBreakerConfig(cfg codersdk.AIBridgeConfig) *config.CircuitBreaker {

Callers 2

TestBuildProvidersFunction · 0.85
buildAIProviderFromRowFunction · 0.85

Calls 2

NilToEmptyFunction · 0.92
IsConfiguredMethod · 0.80

Tested by 1

TestBuildProvidersFunction · 0.68