Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 707b404

Browse files
committed
chore: aibridge configs & experiment
1 parent 6d39077 commit 707b404

File tree

12 files changed

+406
-18
lines changed

12 files changed

+406
-18
lines changed

cli/testdata/coder_server_--help.golden

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,11 @@ OPTIONS:
7676
Periodically check for new releases of Coder and inform the owner. The
7777
check is performed once per day.
7878

79+
AIBRIDGE OPTIONS:
80+
--aibridge-enabled bool, $CODER_AIBRIDGE_ENABLED (default: true)
81+
Whether to start an in-memory aibridged instance ('aibridge'
82+
experiment must be enabled, too).
83+
7984
CLIENT OPTIONS:
8085
These options change the behavior of how clients interact with the Coder.
8186
Clients include the Coder CLI, Coder Desktop, IDE extensions, and the web UI.

cli/testdata/server-config.yaml.golden

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -709,3 +709,20 @@ workspace_prebuilds:
709709
# limit; disabled when set to zero.
710710
# (default: 3, type: int)
711711
failure_hard_limit: 3
712+
aibridge:
713+
# Whether to start an in-memory aibridged instance ('aibridge' experiment must be
714+
# enabled, too).
715+
# (default: true, type: bool)
716+
enabled: true
717+
# The base URL of the OpenAI API.
718+
# (default: https://api.openai.com/v1/, type: string)
719+
openai_base_url: https://api.openai.com/v1/
720+
# The key to authenticate against the OpenAI API.
721+
# (default: <unset>, type: string)
722+
openai_key: ""
723+
# The base URL of the Anthropic API.
724+
# (default: https://api.anthropic.com/, type: string)
725+
base_url: https://api.anthropic.com/
726+
# The key to authenticate against the Anthropic API.
727+
# (default: <unset>, type: string)
728+
key: ""

coderd/apidoc/docs.go

Lines changed: 52 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/apidoc/swagger.json

Lines changed: 52 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

codersdk/deployment.go

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -500,6 +500,7 @@ type DeploymentValues struct {
500500
WorkspaceHostnameSuffix serpent.String `json:"workspace_hostname_suffix,omitempty" typescript:",notnull"`
501501
Prebuilds PrebuildsConfig `json:"workspace_prebuilds,omitempty" typescript:",notnull"`
502502
HideAITasks serpent.Bool `json:"hide_ai_tasks,omitempty" typescript:",notnull"`
503+
AI AIConfig `json:"ai,omitempty"`
503504

504505
Config serpent.YAMLConfigPath `json:"config,omitempty" typescript:",notnull"`
505506
WriteConfig serpent.Bool `json:"write_config,omitempty" typescript:",notnull"`
@@ -1158,6 +1159,10 @@ func (c *DeploymentValues) Options() serpent.OptionSet {
11581159
Parent: &deploymentGroupNotifications,
11591160
YAML: "inbox",
11601161
}
1162+
deploymentGroupAIBridge = serpent.Group{
1163+
Name: "AIBridge",
1164+
YAML: "aibridge",
1165+
}
11611166
)
11621167

11631168
httpAddress := serpent.Option{
@@ -3208,11 +3213,88 @@ Write out the current server config as YAML to stdout.`,
32083213
Group: &deploymentGroupClient,
32093214
YAML: "hideAITasks",
32103215
},
3216+
3217+
// AIBridge Options
3218+
{
3219+
Name: "AIBridge Enabled",
3220+
Description: "Whether to start an in-memory aibridged instance ('aibridge' experiment must be enabled, too).",
3221+
Flag: "aibridge-enabled",
3222+
Env: "CODER_AIBRIDGE_ENABLED",
3223+
Value: &c.AI.BridgeConfig.Enabled,
3224+
Default: "true",
3225+
Group: &deploymentGroupAIBridge,
3226+
YAML: "enabled",
3227+
Hidden: false,
3228+
},
3229+
{
3230+
Name: "AIBridge OpenAI Base URL",
3231+
Description: "The base URL of the OpenAI API.",
3232+
Flag: "aibridge-openai-base-url",
3233+
Env: "CODER_AIBRIDGE_OPENAI_BASE_URL",
3234+
Value: &c.AI.BridgeConfig.OpenAI.BaseURL,
3235+
Default: "https://api.openai.com/v1/",
3236+
Group: &deploymentGroupAIBridge,
3237+
YAML: "openai_base_url",
3238+
Hidden: true,
3239+
},
3240+
{
3241+
Name: "AIBridge OpenAI Key",
3242+
Description: "The key to authenticate against the OpenAI API.",
3243+
Flag: "aibridge-openai-key",
3244+
Env: "CODER_AIBRIDGE_OPENAI_KEY",
3245+
Value: &c.AI.BridgeConfig.OpenAI.Key,
3246+
Default: "",
3247+
Group: &deploymentGroupAIBridge,
3248+
YAML: "openai_key",
3249+
Hidden: true,
3250+
},
3251+
{
3252+
Name: "AIBridge Anthropic Base URL",
3253+
Description: "The base URL of the Anthropic API.",
3254+
Flag: "aibridge-anthropic-base-url",
3255+
Env: "CODER_AIBRIDGE_ANTHROPIC_BASE_URL",
3256+
Value: &c.AI.BridgeConfig.Anthropic.BaseURL,
3257+
Default: "https://api.anthropic.com/",
3258+
Group: &deploymentGroupAIBridge,
3259+
YAML: "base_url",
3260+
Hidden: true,
3261+
},
3262+
{
3263+
Name: "AIBridge Anthropic KEY",
3264+
Description: "The key to authenticate against the Anthropic API.",
3265+
Flag: "aibridge-anthropic-key",
3266+
Env: "CODER_AIBRIDGE_ANTHROPIC_KEY",
3267+
Value: &c.AI.BridgeConfig.Anthropic.Key,
3268+
Default: "",
3269+
Group: &deploymentGroupAIBridge,
3270+
YAML: "key",
3271+
Hidden: true,
3272+
},
32113273
}
32123274

32133275
return opts
32143276
}
32153277

3278+
type AIBridgeConfig struct {
3279+
Enabled serpent.Bool `json:"enabled" typescript:",notnull"`
3280+
OpenAI AIBridgeOpenAIConfig `json:"openai" typescript:",notnull"`
3281+
Anthropic AIBridgeAnthropicConfig `json:"anthropic" typescript:",notnull"`
3282+
}
3283+
3284+
type AIBridgeOpenAIConfig struct {
3285+
BaseURL serpent.String `json:"base_url" typescript:",notnull"`
3286+
Key serpent.String `json:"key" typescript:",notnull"`
3287+
}
3288+
3289+
type AIBridgeAnthropicConfig struct {
3290+
BaseURL serpent.String `json:"base_url" typescript:",notnull"`
3291+
Key serpent.String `json:"key" typescript:",notnull"`
3292+
}
3293+
3294+
type AIConfig struct {
3295+
BridgeConfig AIBridgeConfig `json:"bridge,omitempty"`
3296+
}
3297+
32163298
type SupportConfig struct {
32173299
Links serpent.Struct[[]LinkConfig] `json:"links" typescript:",notnull"`
32183300
}
@@ -3436,6 +3518,7 @@ const (
34363518
ExperimentOAuth2 Experiment = "oauth2" // Enables OAuth2 provider functionality.
34373519
ExperimentMCPServerHTTP Experiment = "mcp-server-http" // Enables the MCP HTTP server functionality.
34383520
ExperimentWorkspaceSharing Experiment = "workspace-sharing" // Enables updating workspace ACLs for sharing with users and groups.
3521+
ExperimentAIBridge Experiment = "aibridge" // Enables AI Bridge functionality.
34393522
)
34403523

34413524
func (e Experiment) DisplayName() string {
@@ -3456,6 +3539,8 @@ func (e Experiment) DisplayName() string {
34563539
return "MCP HTTP Server Functionality"
34573540
case ExperimentWorkspaceSharing:
34583541
return "Workspace Sharing"
3542+
case ExperimentAIBridge:
3543+
return "AI Bridge"
34593544
default:
34603545
// Split on hyphen and convert to title case
34613546
// e.g. "web-push" -> "Web Push", "mcp-server-http" -> "Mcp Server Http"
@@ -3474,6 +3559,7 @@ var ExperimentsKnown = Experiments{
34743559
ExperimentOAuth2,
34753560
ExperimentMCPServerHTTP,
34763561
ExperimentWorkspaceSharing,
3562+
ExperimentAIBridge,
34773563
}
34783564

34793565
// ExperimentsSafe should include all experiments that are safe for

docs/reference/api/general.md

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)