Skip to content

Commit fa4ec52

Browse files
Update SDK from 49383bf
1 parent b1701fb commit fa4ec52

File tree

41 files changed

+1074
-80
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+1074
-80
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# This GitHub Action is managed by the Vellum SDK Generator Repo and copied into each SDK repository.
2+
name: Auto-merge Release PRs
3+
4+
on:
5+
pull_request:
6+
types: [labeled, synchronize]
7+
branches:
8+
- main
9+
10+
jobs:
11+
auto-merge:
12+
runs-on: ubuntu-latest
13+
if: contains(github.event.pull_request.labels.*.name, 'release')
14+
steps:
15+
- name: Checkout repo
16+
uses: actions/checkout@v4
17+
18+
- name: Set up Node.js
19+
uses: actions/setup-node@v3
20+
with:
21+
node-version: "18.18.0"
22+
23+
- name: Install dependencies
24+
run: npm install
25+
working-directory: ee/automation
26+
27+
- name: Wait for checks and auto-merge
28+
env:
29+
VELLUM_AUTOMATION_APP_ID: ${{ secrets.VELLUM_AUTOMATION_APP_ID }}
30+
VELLUM_AUTOMATION_PRIVATE_KEY: ${{ secrets.VELLUM_AUTOMATION_PRIVATE_KEY }}
31+
VELLUM_AUTOMATION_INSTALLATION_ID: ${{ secrets.VELLUM_AUTOMATION_INSTALLATION_ID }}
32+
PR_NUMBER: ${{ github.event.pull_request.number }}
33+
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
34+
run: npm run auto-merge
35+
working-directory: ee/automation

.github/workflows/release.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# This GitHub Action is managed by the Vellum SDK Generator Repo and copied into each SDK repository.
2+
name: Release
3+
4+
on:
5+
pull_request:
6+
types: [closed]
7+
branches:
8+
- main
9+
workflow_dispatch:
10+
11+
jobs:
12+
create-release:
13+
runs-on: ubuntu-latest
14+
if: (github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'release')) || github.event_name == 'workflow_dispatch'
15+
steps:
16+
- name: Checkout repo
17+
uses: actions/checkout@v4
18+
19+
- name: Set up Node.js
20+
uses: actions/setup-node@v3
21+
with:
22+
node-version: "18.18.0"
23+
24+
- name: Install dependencies
25+
run: npm install
26+
working-directory: ee/automation
27+
28+
- name: Create release
29+
env:
30+
VELLUM_AUTOMATION_APP_ID: ${{ secrets.VELLUM_AUTOMATION_APP_ID }}
31+
VELLUM_AUTOMATION_PRIVATE_KEY: ${{ secrets.VELLUM_AUTOMATION_PRIVATE_KEY }}
32+
VELLUM_AUTOMATION_INSTALLATION_ID: ${{ secrets.VELLUM_AUTOMATION_INSTALLATION_ID }}
33+
run: npm run create-release
34+
working-directory: ee/automation

adhoc/client.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import (
1212
option "github.com/vellum-ai/vellum-client-go/option"
1313
io "io"
1414
http "net/http"
15-
os "os"
1615
)
1716

1817
type Client struct {
@@ -23,8 +22,8 @@ type Client struct {
2322

2423
func NewClient(opts ...option.RequestOption) *Client {
2524
options := core.NewRequestOptions(opts...)
26-
if options.ApiVersion == "" {
27-
options.ApiVersion = os.Getenv("VELLUM_API_VERSION")
25+
if options.ApiVersion == nil || *options.ApiVersion == "" {
26+
options.ApiVersion = core.GetDefaultApiVersion()
2827
}
2928
return &Client{
3029
baseURL: options.BaseURL,

client/client.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ import (
3737
workspacesecrets "github.com/vellum-ai/vellum-client-go/workspacesecrets"
3838
io "io"
3939
http "net/http"
40-
os "os"
4140
)
4241

4342
type Client struct {
@@ -74,8 +73,8 @@ type Client struct {
7473

7574
func NewClient(opts ...option.RequestOption) *Client {
7675
options := core.NewRequestOptions(opts...)
77-
if options.ApiVersion == "" {
78-
options.ApiVersion = os.Getenv("VELLUM_API_VERSION")
76+
if options.ApiVersion == nil || *options.ApiVersion == "" {
77+
options.ApiVersion = core.GetDefaultApiVersion()
7978
}
8079
return &Client{
8180
baseURL: options.BaseURL,

containerimages/client.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import (
88
core "github.com/vellum-ai/vellum-client-go/core"
99
option "github.com/vellum-ai/vellum-client-go/option"
1010
http "net/http"
11-
os "os"
1211
)
1312

1413
type Client struct {
@@ -19,8 +18,8 @@ type Client struct {
1918

2019
func NewClient(opts ...option.RequestOption) *Client {
2120
options := core.NewRequestOptions(opts...)
22-
if options.ApiVersion == "" {
23-
options.ApiVersion = os.Getenv("VELLUM_API_VERSION")
21+
if options.ApiVersion == nil || *options.ApiVersion == "" {
22+
options.ApiVersion = core.GetDefaultApiVersion()
2423
}
2524
return &Client{
2625
baseURL: options.BaseURL,

core/request_option.go

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,20 @@ package core
44

55
import (
66
fmt "fmt"
7-
vellumclientgo "github.com/vellum-ai/vellum-client-go"
7+
"os"
88
http "net/http"
99
url "net/url"
1010
)
1111

12+
// * `2024-10-25` - V2024_10_25
13+
// * `2025-07-30` - V2025_07_30
14+
type ApiVersionEnum string
15+
16+
const (
17+
ApiVersionEnumTwoThousandTwentyFour1025 ApiVersionEnum = "2024-10-25"
18+
ApiVersionEnumTwoThousandTwentyFive0730 ApiVersionEnum = "2025-07-30"
19+
)
20+
1221
// RequestOption adapts the behavior of the client or an individual request.
1322
type RequestOption interface {
1423
applyRequestOptions(*RequestOptions)
@@ -26,7 +35,7 @@ type RequestOptions struct {
2635
QueryParameters url.Values
2736
MaxAttempts uint
2837
ApiKey string
29-
ApiVersion *vellumclientgo.ApiVersionEnum
38+
ApiVersion *ApiVersionEnum
3039
}
3140

3241
// NewRequestOptions returns a new *RequestOptions value.
@@ -131,9 +140,22 @@ func (a *ApiKeyOption) applyRequestOptions(opts *RequestOptions) {
131140

132141
// ApiVersionOption implements the RequestOption interface.
133142
type ApiVersionOption struct {
134-
ApiVersion *vellumclientgo.ApiVersionEnum
143+
ApiVersion *ApiVersionEnum
135144
}
136145

137146
func (a *ApiVersionOption) applyRequestOptions(opts *RequestOptions) {
138147
opts.ApiVersion = a.ApiVersion
139148
}
149+
150+
func getEnvWithDefault(key, defaultValue string) string {
151+
if value := os.Getenv(key); value != "" {
152+
return value
153+
}
154+
return defaultValue
155+
}
156+
157+
func GetDefaultApiVersion() *ApiVersionEnum {
158+
envVersion := getEnvWithDefault("VELLUM_API_VERSION", "2025-07-30")
159+
apiVersion := ApiVersionEnum(envVersion)
160+
return &apiVersion
161+
}

deployments/client.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import (
1212
option "github.com/vellum-ai/vellum-client-go/option"
1313
io "io"
1414
http "net/http"
15-
os "os"
1615
)
1716

1817
type Client struct {
@@ -23,8 +22,8 @@ type Client struct {
2322

2423
func NewClient(opts ...option.RequestOption) *Client {
2524
options := core.NewRequestOptions(opts...)
26-
if options.ApiVersion == "" {
27-
options.ApiVersion = os.Getenv("VELLUM_API_VERSION")
25+
if options.ApiVersion == nil || *options.ApiVersion == "" {
26+
options.ApiVersion = core.GetDefaultApiVersion()
2827
}
2928
return &Client{
3029
baseURL: options.BaseURL,

documentindexes/client.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import (
88
core "github.com/vellum-ai/vellum-client-go/core"
99
option "github.com/vellum-ai/vellum-client-go/option"
1010
http "net/http"
11-
os "os"
1211
)
1312

1413
type Client struct {
@@ -19,8 +18,8 @@ type Client struct {
1918

2019
func NewClient(opts ...option.RequestOption) *Client {
2120
options := core.NewRequestOptions(opts...)
22-
if options.ApiVersion == "" {
23-
options.ApiVersion = os.Getenv("VELLUM_API_VERSION")
21+
if options.ApiVersion == nil || *options.ApiVersion == "" {
22+
options.ApiVersion = core.GetDefaultApiVersion()
2423
}
2524
return &Client{
2625
baseURL: options.BaseURL,

ee/automation/.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
v18.18.0

ee/automation/README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Vellum SDK Automation
2+
3+
This is a mini package hosting all of the automation scripts needed for managing Vellum SDKs from within each SDK repository. During the release process of this repository, this directory is copied into the `ee/automation` directory of each of the respective SDKs.
4+
5+
## Scripts
6+
7+
Here are all the scripts we support.
8+
9+
### `npm run create-release`
10+
11+
This script is used to create a release for a given SDK. It is triggered by a pull request in the SDK repository being merged into the `main` branch with the `release` label. The GitHub action for this trigger is defined in `release.yml` and copied into the SDK repository within the `.github/workflows` directory.

0 commit comments

Comments
 (0)