Skip to content

Commit 8e0b6f8

Browse files
authored
chore: upgrade aisdk-go lib, remove vestigial code (#18577)
1 parent e396b06 commit 8e0b6f8

File tree

7 files changed

+16
-112
lines changed

7 files changed

+16
-112
lines changed

cli/server.go

Lines changed: 0 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -2624,77 +2624,6 @@ func redirectHTTPToHTTPSDeprecation(ctx context.Context, logger slog.Logger, inv
26242624
}
26252625
}
26262626

2627-
func ReadAIProvidersFromEnv(environ []string) ([]codersdk.AIProviderConfig, error) {
2628-
// The index numbers must be in-order.
2629-
sort.Strings(environ)
2630-
2631-
var providers []codersdk.AIProviderConfig
2632-
for _, v := range serpent.ParseEnviron(environ, "CODER_AI_PROVIDER_") {
2633-
tokens := strings.SplitN(v.Name, "_", 2)
2634-
if len(tokens) != 2 {
2635-
return nil, xerrors.Errorf("invalid env var: %s", v.Name)
2636-
}
2637-
2638-
providerNum, err := strconv.Atoi(tokens[0])
2639-
if err != nil {
2640-
return nil, xerrors.Errorf("parse number: %s", v.Name)
2641-
}
2642-
2643-
var provider codersdk.AIProviderConfig
2644-
switch {
2645-
case len(providers) < providerNum:
2646-
return nil, xerrors.Errorf(
2647-
"provider num %v skipped: %s",
2648-
len(providers),
2649-
v.Name,
2650-
)
2651-
case len(providers) == providerNum:
2652-
// At the next next provider.
2653-
providers = append(providers, provider)
2654-
case len(providers) == providerNum+1:
2655-
// At the current provider.
2656-
provider = providers[providerNum]
2657-
}
2658-
2659-
key := tokens[1]
2660-
switch key {
2661-
case "TYPE":
2662-
provider.Type = v.Value
2663-
case "API_KEY":
2664-
provider.APIKey = v.Value
2665-
case "BASE_URL":
2666-
provider.BaseURL = v.Value
2667-
case "MODELS":
2668-
provider.Models = strings.Split(v.Value, ",")
2669-
}
2670-
providers[providerNum] = provider
2671-
}
2672-
for _, envVar := range environ {
2673-
tokens := strings.SplitN(envVar, "=", 2)
2674-
if len(tokens) != 2 {
2675-
continue
2676-
}
2677-
switch tokens[0] {
2678-
case "OPENAI_API_KEY":
2679-
providers = append(providers, codersdk.AIProviderConfig{
2680-
Type: "openai",
2681-
APIKey: tokens[1],
2682-
})
2683-
case "ANTHROPIC_API_KEY":
2684-
providers = append(providers, codersdk.AIProviderConfig{
2685-
Type: "anthropic",
2686-
APIKey: tokens[1],
2687-
})
2688-
case "GOOGLE_API_KEY":
2689-
providers = append(providers, codersdk.AIProviderConfig{
2690-
Type: "google",
2691-
APIKey: tokens[1],
2692-
})
2693-
}
2694-
}
2695-
return providers, nil
2696-
}
2697-
26982627
// ReadExternalAuthProvidersFromEnv is provided for compatibility purposes with
26992628
// the viper CLI.
27002629
func ReadExternalAuthProvidersFromEnv(environ []string) ([]codersdk.ExternalAuthConfig, error) {

codersdk/deployment.go

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3122,21 +3122,6 @@ Write out the current server config as YAML to stdout.`,
31223122
return opts
31233123
}
31243124

3125-
type AIProviderConfig struct {
3126-
// Type is the type of the API provider.
3127-
Type string `json:"type" yaml:"type"`
3128-
// APIKey is the API key to use for the API provider.
3129-
APIKey string `json:"-" yaml:"api_key"`
3130-
// Models is the list of models to use for the API provider.
3131-
Models []string `json:"models" yaml:"models"`
3132-
// BaseURL is the base URL to use for the API provider.
3133-
BaseURL string `json:"base_url" yaml:"base_url"`
3134-
}
3135-
3136-
type AIConfig struct {
3137-
Providers []AIProviderConfig `json:"providers,omitempty" yaml:"providers,omitempty"`
3138-
}
3139-
31403125
type SupportConfig struct {
31413126
Links serpent.Struct[[]LinkConfig] `json:"links" typescript:",notnull"`
31423127
}

codersdk/toolsdk/toolsdk.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@ import (
88
"io"
99

1010
"github.com/google/uuid"
11-
"github.com/kylecarbs/aisdk-go"
1211
"golang.org/x/xerrors"
1312

13+
"github.com/coder/aisdk-go"
14+
1415
"github.com/coder/coder/v2/codersdk"
1516
)
1617

codersdk/toolsdk/toolsdk_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,12 @@ import (
1010
"time"
1111

1212
"github.com/google/uuid"
13-
"github.com/kylecarbs/aisdk-go"
1413
"github.com/stretchr/testify/assert"
1514
"github.com/stretchr/testify/require"
1615
"go.uber.org/goleak"
1716

17+
"github.com/coder/aisdk-go"
18+
1819
"github.com/coder/coder/v2/coderd/coderdtest"
1920
"github.com/coder/coder/v2/coderd/database"
2021
"github.com/coder/coder/v2/coderd/database/dbfake"

go.mod

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -482,9 +482,9 @@ require (
482482

483483
require (
484484
github.com/coder/agentapi-sdk-go v0.0.0-20250505131810-560d1d88d225
485+
github.com/coder/aisdk-go v0.0.9
485486
github.com/coder/preview v1.0.1
486487
github.com/fsnotify/fsnotify v1.9.0
487-
github.com/kylecarbs/aisdk-go v0.0.8
488488
github.com/mark3labs/mcp-go v0.32.0
489489
)
490490

@@ -502,7 +502,7 @@ require (
502502
github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/metric v0.50.0 // indirect
503503
github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/resourcemapping v0.50.0 // indirect
504504
github.com/Masterminds/semver/v3 v3.3.1 // indirect
505-
github.com/anthropics/anthropic-sdk-go v0.2.0-beta.3 // indirect
505+
github.com/anthropics/anthropic-sdk-go v1.4.0 // indirect
506506
github.com/aquasecurity/go-version v0.0.1 // indirect
507507
github.com/aquasecurity/trivy v0.58.2 // indirect
508508
github.com/aws/aws-sdk-go v1.55.7 // indirect
@@ -520,7 +520,7 @@ require (
520520
github.com/klauspost/cpuid/v2 v2.2.10 // indirect
521521
github.com/moby/sys/user v0.4.0 // indirect
522522
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 // indirect
523-
github.com/openai/openai-go v0.1.0-beta.10 // indirect
523+
github.com/openai/openai-go v1.3.0 // indirect
524524
github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 // indirect
525525
github.com/puzpuzpuz/xsync/v3 v3.5.1 // indirect
526526
github.com/samber/lo v1.50.0 // indirect
@@ -535,6 +535,6 @@ require (
535535
go.opentelemetry.io/contrib/detectors/gcp v1.35.0 // indirect
536536
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.60.0 // indirect
537537
go.opentelemetry.io/otel/sdk/metric v1.35.0 // indirect
538-
google.golang.org/genai v0.7.0 // indirect
538+
google.golang.org/genai v1.10.0 // indirect
539539
k8s.io/utils v0.0.0-20241210054802-24370beab758 // indirect
540540
)

go.sum

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -720,8 +720,8 @@ github.com/andybalholm/brotli v1.1.1 h1:PR2pgnyFznKEugtsUo0xLdDop5SKXd5Qf5ysW+7X
720720
github.com/andybalholm/brotli v1.1.1/go.mod h1:05ib4cKhjx3OQYUY22hTVd34Bc8upXjOLL2rKwwZBoA=
721721
github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be h1:9AeTilPcZAjCFIImctFaOjnTIavg87rW78vTPkQqLI8=
722722
github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be/go.mod h1:ySMOLuWl6zY27l47sB3qLNK6tF2fkHG55UZxx8oIVo4=
723-
github.com/anthropics/anthropic-sdk-go v0.2.0-beta.3 h1:b5t1ZJMvV/l99y4jbz7kRFdUp3BSDkI8EhSlHczivtw=
724-
github.com/anthropics/anthropic-sdk-go v0.2.0-beta.3/go.mod h1:AapDW22irxK2PSumZiQXYUFvsdQgkwIWlpESweWZI/c=
723+
github.com/anthropics/anthropic-sdk-go v1.4.0 h1:fU1jKxYbQdQDiEXCxeW5XZRIOwKevn/PMg8Ay1nnUx0=
724+
github.com/anthropics/anthropic-sdk-go v1.4.0/go.mod h1:AapDW22irxK2PSumZiQXYUFvsdQgkwIWlpESweWZI/c=
725725
github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY=
726726
github.com/apache/arrow/go/v10 v10.0.1/go.mod h1:YvhnlEePVnBS4+0z3fhPfUy7W1Ikj0Ih0vcRo/gZ1M0=
727727
github.com/apache/arrow/go/v11 v11.0.0/go.mod h1:Eg5OsL5H+e299f7u5ssuXsuHQVEGC4xei5aX110hRiI=
@@ -897,6 +897,8 @@ github.com/cncf/xds/go v0.0.0-20250326154945-ae57f3c0d45f h1:C5bqEmzEPLsHm9Mv73l
897897
github.com/cncf/xds/go v0.0.0-20250326154945-ae57f3c0d45f/go.mod h1:W+zGtBO5Y1IgJhy4+A9GOqVhqLpfZi+vwmdNXUehLA8=
898898
github.com/coder/agentapi-sdk-go v0.0.0-20250505131810-560d1d88d225 h1:tRIViZ5JRmzdOEo5wUWngaGEFBG8OaE1o2GIHN5ujJ8=
899899
github.com/coder/agentapi-sdk-go v0.0.0-20250505131810-560d1d88d225/go.mod h1:rNLVpYgEVeu1Zk29K64z6Od8RBP9DwqCu9OfCzh8MR4=
900+
github.com/coder/aisdk-go v0.0.9 h1:Vzo/k2qwVGLTR10ESDeP2Ecek1SdPfZlEjtTfMveiVo=
901+
github.com/coder/aisdk-go v0.0.9/go.mod h1:KF6/Vkono0FJJOtWtveh5j7yfNrSctVTpwgweYWSp5M=
900902
github.com/coder/bubbletea v1.2.2-0.20241212190825-007a1cdb2c41 h1:SBN/DA63+ZHwuWwPHPYoCZ/KLAjHv5g4h2MS4f2/MTI=
901903
github.com/coder/bubbletea v1.2.2-0.20241212190825-007a1cdb2c41/go.mod h1:I9ULxr64UaOSUv7hcb3nX4kowodJCVS7vt7VVJk/kW4=
902904
github.com/coder/clistat v1.0.0 h1:MjiS7qQ1IobuSSgDnxcCSyBPESs44hExnh2TEqMcGnA=
@@ -1470,8 +1472,6 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
14701472
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
14711473
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
14721474
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
1473-
github.com/kylecarbs/aisdk-go v0.0.8 h1:hnKVbLM6U8XqX3t5I26J8k5saXdra595bGt1HP0PvKA=
1474-
github.com/kylecarbs/aisdk-go v0.0.8/go.mod h1:3nAhClwRNo6ZfU44GrBZ8O2fCCrxJdaHb9JIz+P3LR8=
14751475
github.com/kylecarbs/chroma/v2 v2.0.0-20240401211003-9e036e0631f3 h1:Z9/bo5PSeMutpdiKYNt/TTSfGM1Ll0naj3QzYX9VxTc=
14761476
github.com/kylecarbs/chroma/v2 v2.0.0-20240401211003-9e036e0631f3/go.mod h1:BUGjjsD+ndS6eX37YgTchSEG+Jg9Jv1GiZs9sqPqztk=
14771477
github.com/kylecarbs/opencensus-go v0.23.1-0.20220307014935-4d0325a68f8b/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E=
@@ -1613,8 +1613,8 @@ github.com/open-telemetry/opentelemetry-collector-contrib/pkg/sampling v0.120.1
16131613
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/sampling v0.120.1/go.mod h1:01TvyaK8x640crO2iFwW/6CFCZgNsOvOGH3B5J239m0=
16141614
github.com/open-telemetry/opentelemetry-collector-contrib/processor/probabilisticsamplerprocessor v0.120.1 h1:TCyOus9tym82PD1VYtthLKMVMlVyRwtDI4ck4SR2+Ok=
16151615
github.com/open-telemetry/opentelemetry-collector-contrib/processor/probabilisticsamplerprocessor v0.120.1/go.mod h1:Z/S1brD5gU2Ntht/bHxBVnGxXKTvZDr0dNv/riUzPmY=
1616-
github.com/openai/openai-go v0.1.0-beta.10 h1:CknhGXe8aXQMRuqg255PFnWzgRY9nEryMxoNIBBM9tU=
1617-
github.com/openai/openai-go v0.1.0-beta.10/go.mod h1:g461MYGXEXBVdV5SaR/5tNzNbSfwTBBefwc+LlDCK0Y=
1616+
github.com/openai/openai-go v1.3.0 h1:lBpvgXxGHUufk9DNTguval40y2oK0GHZwgWQyUtjPIQ=
1617+
github.com/openai/openai-go v1.3.0/go.mod h1:g461MYGXEXBVdV5SaR/5tNzNbSfwTBBefwc+LlDCK0Y=
16181618
github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U=
16191619
github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM=
16201620
github.com/opencontainers/image-spec v1.1.1 h1:y0fUlFfIZhPF1W537XOLg0/fcx6zcHCJwooC2xJA040=
@@ -2495,8 +2495,8 @@ google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCID
24952495
google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
24962496
google.golang.org/appengine v1.6.8 h1:IhEN5q69dyKagZPYMSdIjS2HqprW324FRQZJcGqPAsM=
24972497
google.golang.org/appengine v1.6.8/go.mod h1:1jJ3jBArFh5pcgW8gCtRJnepW8FzD1V44FJffLiz/Ds=
2498-
google.golang.org/genai v0.7.0 h1:TINBYXnP+K+D8b16LfVyb6XR3kdtieXy6nJsGoEXcBc=
2499-
google.golang.org/genai v0.7.0/go.mod h1:TyfOKRz/QyCaj6f/ZDt505x+YreXnY40l2I6k8TvgqY=
2498+
google.golang.org/genai v1.10.0 h1:ETP0Yksn5KUSEn5+ihMOnP3IqjZ+7Z4i0LjJslEXatI=
2499+
google.golang.org/genai v1.10.0/go.mod h1:TyfOKRz/QyCaj6f/ZDt505x+YreXnY40l2I6k8TvgqY=
25002500
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
25012501
google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
25022502
google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=

site/src/api/typesGenerated.ts

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

0 commit comments

Comments
 (0)