From 57f13ded2053eddd7962e94ae199276716eb44cf Mon Sep 17 00:00:00 2001 From: "fern-api[bot]" <115122769+fern-api[bot]@users.noreply.github.com> Date: Thu, 5 Feb 2026 18:07:45 +0000 Subject: [PATCH 1/2] SDK regeneration --- .github/workflows/auto-merge-release.yml | 35 -- .github/workflows/release.yml | 34 -- adhoc/client.go | 5 +- client/client.go | 5 +- containerimages/client.go | 5 +- core/request_option.go | 30 +- deployments/client.go | 5 +- documentindexes/client.go | 5 +- ee/automation/.nvmrc | 1 - ee/automation/README.md | 11 - ee/automation/ci-workflow-server.yaml | 46 -- ee/automation/package-lock.json | 517 ------------------- ee/automation/package.json | 18 - ee/automation/src/auth.ts | 33 -- ee/automation/src/auto-merge.ts | 149 ------ ee/automation/src/create-release.ts | 52 -- ee/automation/src/upgrade-workflow-server.ts | 30 -- ee/automation/src/utils.ts | 36 -- ee/automation/tsconfig.json | 34 -- environments/client.go | 5 +- events/client.go | 5 +- folderentities/client.go | 5 +- go.mod | 2 - integration_auth_configs.go | 6 +- integrationauthconfigs/client.go | 5 +- integrationproviders/client.go | 5 +- integrations/client.go | 5 +- metricdefinitions/client.go | 5 +- ml_models.go | 136 ----- mlmodels/client.go | 5 +- option/request_option.go | 3 +- organizations/client.go | 5 +- prompts/client.go | 5 +- sandboxes/client.go | 5 +- testsuiteruns/client.go | 5 +- testsuites/client.go | 5 +- types.go | 136 +++++ uploadedfiles/client.go | 5 +- workflow_deployments.go | 190 ++++++- workflowdeployments/client.go | 5 +- workflowexecutions/client.go | 5 +- workflows/client.go | 5 +- workflowsandboxes/client.go | 5 +- workspaces/client.go | 5 +- workspacesecrets/client.go | 5 +- 45 files changed, 408 insertions(+), 1216 deletions(-) delete mode 100644 .github/workflows/auto-merge-release.yml delete mode 100644 .github/workflows/release.yml delete mode 100644 ee/automation/.nvmrc delete mode 100644 ee/automation/README.md delete mode 100644 ee/automation/ci-workflow-server.yaml delete mode 100644 ee/automation/package-lock.json delete mode 100644 ee/automation/package.json delete mode 100644 ee/automation/src/auth.ts delete mode 100644 ee/automation/src/auto-merge.ts delete mode 100644 ee/automation/src/create-release.ts delete mode 100644 ee/automation/src/upgrade-workflow-server.ts delete mode 100644 ee/automation/src/utils.ts delete mode 100644 ee/automation/tsconfig.json diff --git a/.github/workflows/auto-merge-release.yml b/.github/workflows/auto-merge-release.yml deleted file mode 100644 index a5ed738b..00000000 --- a/.github/workflows/auto-merge-release.yml +++ /dev/null @@ -1,35 +0,0 @@ -# This GitHub Action is managed by the Vellum SDK Generator Repo and copied into each SDK repository. -name: Auto-merge Release PRs - -on: - pull_request: - types: [labeled, synchronize] - branches: - - main - -jobs: - auto-merge: - runs-on: ubuntu-latest - if: contains(github.event.pull_request.labels.*.name, 'release') - steps: - - name: Checkout repo - uses: actions/checkout@v4 - - - name: Set up Node.js - uses: actions/setup-node@v3 - with: - node-version: "18.18.0" - - - name: Install dependencies - run: npm install - working-directory: ee/automation - - - name: Wait for checks and auto-merge - env: - VELLUM_AUTOMATION_APP_ID: ${{ secrets.VELLUM_AUTOMATION_APP_ID }} - VELLUM_AUTOMATION_PRIVATE_KEY: ${{ secrets.VELLUM_AUTOMATION_PRIVATE_KEY }} - VELLUM_AUTOMATION_INSTALLATION_ID: ${{ secrets.VELLUM_AUTOMATION_INSTALLATION_ID }} - PR_NUMBER: ${{ github.event.pull_request.number }} - HEAD_SHA: ${{ github.event.pull_request.head.sha }} - run: npm run auto-merge - working-directory: ee/automation diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index 5de4db20..00000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,34 +0,0 @@ -# This GitHub Action is managed by the Vellum SDK Generator Repo and copied into each SDK repository. -name: Release - -on: - pull_request: - types: [closed] - branches: - - main - workflow_dispatch: - -jobs: - create-release: - runs-on: ubuntu-latest - if: (github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'release')) || github.event_name == 'workflow_dispatch' - steps: - - name: Checkout repo - uses: actions/checkout@v4 - - - name: Set up Node.js - uses: actions/setup-node@v3 - with: - node-version: "18.18.0" - - - name: Install dependencies - run: npm install - working-directory: ee/automation - - - name: Create release - env: - VELLUM_AUTOMATION_APP_ID: ${{ secrets.VELLUM_AUTOMATION_APP_ID }} - VELLUM_AUTOMATION_PRIVATE_KEY: ${{ secrets.VELLUM_AUTOMATION_PRIVATE_KEY }} - VELLUM_AUTOMATION_INSTALLATION_ID: ${{ secrets.VELLUM_AUTOMATION_INSTALLATION_ID }} - run: npm run create-release - working-directory: ee/automation diff --git a/adhoc/client.go b/adhoc/client.go index 68833fc9..b08a4246 100644 --- a/adhoc/client.go +++ b/adhoc/client.go @@ -12,6 +12,7 @@ import ( option "github.com/vellum-ai/vellum-client-go/option" io "io" http "net/http" + os "os" ) type Client struct { @@ -22,8 +23,8 @@ type Client struct { func NewClient(opts ...option.RequestOption) *Client { options := core.NewRequestOptions(opts...) - if options.ApiVersion == nil || *options.ApiVersion == "" { - options.ApiVersion = core.GetDefaultApiVersion() + if options.ApiVersion == "" { + options.ApiVersion = os.Getenv("VELLUM_API_VERSION") } return &Client{ baseURL: options.BaseURL, diff --git a/client/client.go b/client/client.go index 27e9416a..79ed7d47 100644 --- a/client/client.go +++ b/client/client.go @@ -37,6 +37,7 @@ import ( workspacesecrets "github.com/vellum-ai/vellum-client-go/workspacesecrets" io "io" http "net/http" + os "os" ) type Client struct { @@ -73,8 +74,8 @@ type Client struct { func NewClient(opts ...option.RequestOption) *Client { options := core.NewRequestOptions(opts...) - if options.ApiVersion == nil || *options.ApiVersion == "" { - options.ApiVersion = core.GetDefaultApiVersion() + if options.ApiVersion == "" { + options.ApiVersion = os.Getenv("VELLUM_API_VERSION") } return &Client{ baseURL: options.BaseURL, diff --git a/containerimages/client.go b/containerimages/client.go index 11164aa8..9ed2e199 100644 --- a/containerimages/client.go +++ b/containerimages/client.go @@ -8,6 +8,7 @@ import ( core "github.com/vellum-ai/vellum-client-go/core" option "github.com/vellum-ai/vellum-client-go/option" http "net/http" + os "os" ) type Client struct { @@ -18,8 +19,8 @@ type Client struct { func NewClient(opts ...option.RequestOption) *Client { options := core.NewRequestOptions(opts...) - if options.ApiVersion == nil || *options.ApiVersion == "" { - options.ApiVersion = core.GetDefaultApiVersion() + if options.ApiVersion == "" { + options.ApiVersion = os.Getenv("VELLUM_API_VERSION") } return &Client{ baseURL: options.BaseURL, diff --git a/core/request_option.go b/core/request_option.go index 1fe22785..e3ef64e6 100644 --- a/core/request_option.go +++ b/core/request_option.go @@ -4,20 +4,11 @@ package core import ( fmt "fmt" - "os" + vellumclientgo "github.com/vellum-ai/vellum-client-go" http "net/http" url "net/url" ) -// * `2024-10-25` - V2024_10_25 -// * `2025-07-30` - V2025_07_30 -type ApiVersionEnum string - -const ( - ApiVersionEnumTwoThousandTwentyFour1025 ApiVersionEnum = "2024-10-25" - ApiVersionEnumTwoThousandTwentyFive0730 ApiVersionEnum = "2025-07-30" -) - // RequestOption adapts the behavior of the client or an individual request. type RequestOption interface { applyRequestOptions(*RequestOptions) @@ -35,7 +26,7 @@ type RequestOptions struct { QueryParameters url.Values MaxAttempts uint ApiKey string - ApiVersion *ApiVersionEnum + ApiVersion *vellumclientgo.ApiVersionEnum } // NewRequestOptions returns a new *RequestOptions value. @@ -71,7 +62,7 @@ func (r *RequestOptions) cloneHeader() http.Header { headers := r.HTTPHeader.Clone() headers.Set("X-Fern-Language", "Go") headers.Set("X-Fern-SDK-Name", "github.com/vellum-ai/vellum-client-go") - headers.Set("X-Fern-SDK-Version", "v1.14.2") + headers.Set("X-Fern-SDK-Version", "v1.14.3") return headers } @@ -140,22 +131,9 @@ func (a *ApiKeyOption) applyRequestOptions(opts *RequestOptions) { // ApiVersionOption implements the RequestOption interface. type ApiVersionOption struct { - ApiVersion *ApiVersionEnum + ApiVersion *vellumclientgo.ApiVersionEnum } func (a *ApiVersionOption) applyRequestOptions(opts *RequestOptions) { opts.ApiVersion = a.ApiVersion } - -func getEnvWithDefault(key, defaultValue string) string { - if value := os.Getenv(key); value != "" { - return value - } - return defaultValue -} - -func GetDefaultApiVersion() *ApiVersionEnum { - envVersion := getEnvWithDefault("VELLUM_API_VERSION", "2025-07-30") - apiVersion := ApiVersionEnum(envVersion) - return &apiVersion -} diff --git a/deployments/client.go b/deployments/client.go index 2cb70cd6..9094b572 100644 --- a/deployments/client.go +++ b/deployments/client.go @@ -12,6 +12,7 @@ import ( option "github.com/vellum-ai/vellum-client-go/option" io "io" http "net/http" + os "os" ) type Client struct { @@ -22,8 +23,8 @@ type Client struct { func NewClient(opts ...option.RequestOption) *Client { options := core.NewRequestOptions(opts...) - if options.ApiVersion == nil || *options.ApiVersion == "" { - options.ApiVersion = core.GetDefaultApiVersion() + if options.ApiVersion == "" { + options.ApiVersion = os.Getenv("VELLUM_API_VERSION") } return &Client{ baseURL: options.BaseURL, diff --git a/documentindexes/client.go b/documentindexes/client.go index 83558f54..f01b8fd3 100644 --- a/documentindexes/client.go +++ b/documentindexes/client.go @@ -8,6 +8,7 @@ import ( core "github.com/vellum-ai/vellum-client-go/core" option "github.com/vellum-ai/vellum-client-go/option" http "net/http" + os "os" ) type Client struct { @@ -18,8 +19,8 @@ type Client struct { func NewClient(opts ...option.RequestOption) *Client { options := core.NewRequestOptions(opts...) - if options.ApiVersion == nil || *options.ApiVersion == "" { - options.ApiVersion = core.GetDefaultApiVersion() + if options.ApiVersion == "" { + options.ApiVersion = os.Getenv("VELLUM_API_VERSION") } return &Client{ baseURL: options.BaseURL, diff --git a/ee/automation/.nvmrc b/ee/automation/.nvmrc deleted file mode 100644 index 6aab9b43..00000000 --- a/ee/automation/.nvmrc +++ /dev/null @@ -1 +0,0 @@ -v18.18.0 diff --git a/ee/automation/README.md b/ee/automation/README.md deleted file mode 100644 index 87a9135d..00000000 --- a/ee/automation/README.md +++ /dev/null @@ -1,11 +0,0 @@ -# Vellum SDK Automation - -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. - -## Scripts - -Here are all the scripts we support. - -### `npm run create-release` - -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. diff --git a/ee/automation/ci-workflow-server.yaml b/ee/automation/ci-workflow-server.yaml deleted file mode 100644 index 9d7476af..00000000 --- a/ee/automation/ci-workflow-server.yaml +++ /dev/null @@ -1,46 +0,0 @@ -name: ci-workflow-server - -on: - push: - branches: - - main - tags: - - "*" - -jobs: - publish: - permissions: - contents: "read" - id-token: "write" - - if: github.event_name == 'push' && contains(github.ref, 'refs/tags/') - runs-on: ubuntu-latest - steps: - - name: Checkout repo - uses: actions/checkout@v4 - - - name: Set up Node.js - uses: actions/setup-node@v3 - with: - node-version: "18.18.0" - - - name: Install dependencies - run: npm install - working-directory: ee/automation - - - id: auth - uses: google-github-actions/auth@v2 - with: - token_format: "access_token" - create_credentials_file: true - workload_identity_provider: "projects/585775334980/locations/global/workloadIdentityPools/github-pool/providers/github-actions-provider" - service_account: "github-gcr-service-account@vocify-prod.iam.gserviceaccount.com" - access_token_lifetime: "1200s" - - - name: Bump Workflow Server - env: - VELLUM_AUTOMATION_APP_ID: ${{ secrets.VELLUM_AUTOMATION_APP_ID }} - VELLUM_AUTOMATION_PRIVATE_KEY: ${{ secrets.VELLUM_AUTOMATION_PRIVATE_KEY }} - VELLUM_AUTOMATION_INSTALLATION_ID: ${{ secrets.VELLUM_AUTOMATION_INSTALLATION_ID }} - run: npm run upgrade-workflow-server - working-directory: ee/automation diff --git a/ee/automation/package-lock.json b/ee/automation/package-lock.json deleted file mode 100644 index e8b96e98..00000000 --- a/ee/automation/package-lock.json +++ /dev/null @@ -1,517 +0,0 @@ -{ - "name": "vellum-automation", - "version": "0.0.1", - "lockfileVersion": 3, - "requires": true, - "packages": { - "": { - "name": "vellum-automation", - "version": "0.0.1", - "devDependencies": { - "@octokit/auth-app": "^7.1.4", - "@octokit/rest": "^21.1.0", - "@types/node": "^22.10.7", - "dotenv": "^16.4.7", - "ts-node": "^10.9.2", - "typescript": "^5.7.3" - } - }, - "node_modules/@cspotcode/source-map-support": { - "version": "0.8.1", - "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz", - "integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==", - "dev": true, - "dependencies": { - "@jridgewell/trace-mapping": "0.3.9" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/@jridgewell/resolve-uri": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", - "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", - "dev": true, - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/@jridgewell/sourcemap-codec": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz", - "integrity": "sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==", - "dev": true - }, - "node_modules/@jridgewell/trace-mapping": { - "version": "0.3.9", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz", - "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==", - "dev": true, - "dependencies": { - "@jridgewell/resolve-uri": "^3.0.3", - "@jridgewell/sourcemap-codec": "^1.4.10" - } - }, - "node_modules/@octokit/auth-app": { - "version": "7.1.4", - "resolved": "https://registry.npmjs.org/@octokit/auth-app/-/auth-app-7.1.4.tgz", - "integrity": "sha512-5F+3l/maq9JfWQ4bV28jT2G/K8eu9OJ317yzXPTGe4Kw+lKDhFaS4dQ3Ltmb6xImKxfCQdqDqMXODhc9YLipLw==", - "dev": true, - "dependencies": { - "@octokit/auth-oauth-app": "^8.1.2", - "@octokit/auth-oauth-user": "^5.1.2", - "@octokit/request": "^9.1.4", - "@octokit/request-error": "^6.1.6", - "@octokit/types": "^13.6.2", - "toad-cache": "^3.7.0", - "universal-github-app-jwt": "^2.2.0", - "universal-user-agent": "^7.0.0" - }, - "engines": { - "node": ">= 18" - } - }, - "node_modules/@octokit/auth-oauth-app": { - "version": "8.1.2", - "resolved": "https://registry.npmjs.org/@octokit/auth-oauth-app/-/auth-oauth-app-8.1.2.tgz", - "integrity": "sha512-3woNZgq5/S6RS+9ZTq+JdymxVr7E0s4EYxF20ugQvgX3pomdPUL5r/XdTY9wALoBM2eHVy4ettr5fKpatyTyHw==", - "dev": true, - "dependencies": { - "@octokit/auth-oauth-device": "^7.1.2", - "@octokit/auth-oauth-user": "^5.1.2", - "@octokit/request": "^9.1.4", - "@octokit/types": "^13.6.2", - "universal-user-agent": "^7.0.0" - }, - "engines": { - "node": ">= 18" - } - }, - "node_modules/@octokit/auth-oauth-device": { - "version": "7.1.2", - "resolved": "https://registry.npmjs.org/@octokit/auth-oauth-device/-/auth-oauth-device-7.1.2.tgz", - "integrity": "sha512-gTOIzDeV36OhVfxCl69FmvJix7tJIiU6dlxuzLVAzle7fYfO8UDyddr9B+o4CFQVaMBLMGZ9ak2CWMYcGeZnPw==", - "dev": true, - "dependencies": { - "@octokit/oauth-methods": "^5.1.3", - "@octokit/request": "^9.1.4", - "@octokit/types": "^13.6.2", - "universal-user-agent": "^7.0.0" - }, - "engines": { - "node": ">= 18" - } - }, - "node_modules/@octokit/auth-oauth-user": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/@octokit/auth-oauth-user/-/auth-oauth-user-5.1.2.tgz", - "integrity": "sha512-PgVDDPJgZYb3qSEXK4moksA23tfn68zwSAsQKZ1uH6IV9IaNEYx35OXXI80STQaLYnmEE86AgU0tC1YkM4WjsA==", - "dev": true, - "dependencies": { - "@octokit/auth-oauth-device": "^7.1.2", - "@octokit/oauth-methods": "^5.1.2", - "@octokit/request": "^9.1.4", - "@octokit/types": "^13.6.2", - "universal-user-agent": "^7.0.0" - }, - "engines": { - "node": ">= 18" - } - }, - "node_modules/@octokit/auth-token": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/@octokit/auth-token/-/auth-token-5.1.1.tgz", - "integrity": "sha512-rh3G3wDO8J9wSjfI436JUKzHIxq8NaiL0tVeB2aXmG6p/9859aUOAjA9pmSPNGGZxfwmaJ9ozOJImuNVJdpvbA==", - "dev": true, - "engines": { - "node": ">= 18" - } - }, - "node_modules/@octokit/core": { - "version": "6.1.3", - "resolved": "https://registry.npmjs.org/@octokit/core/-/core-6.1.3.tgz", - "integrity": "sha512-z+j7DixNnfpdToYsOutStDgeRzJSMnbj8T1C/oQjB6Aa+kRfNjs/Fn7W6c8bmlt6mfy3FkgeKBRnDjxQow5dow==", - "dev": true, - "dependencies": { - "@octokit/auth-token": "^5.0.0", - "@octokit/graphql": "^8.1.2", - "@octokit/request": "^9.1.4", - "@octokit/request-error": "^6.1.6", - "@octokit/types": "^13.6.2", - "before-after-hook": "^3.0.2", - "universal-user-agent": "^7.0.0" - }, - "engines": { - "node": ">= 18" - } - }, - "node_modules/@octokit/endpoint": { - "version": "10.1.2", - "resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-10.1.2.tgz", - "integrity": "sha512-XybpFv9Ms4hX5OCHMZqyODYqGTZ3H6K6Vva+M9LR7ib/xr1y1ZnlChYv9H680y77Vd/i/k+thXApeRASBQkzhA==", - "dev": true, - "dependencies": { - "@octokit/types": "^13.6.2", - "universal-user-agent": "^7.0.2" - }, - "engines": { - "node": ">= 18" - } - }, - "node_modules/@octokit/graphql": { - "version": "8.1.2", - "resolved": "https://registry.npmjs.org/@octokit/graphql/-/graphql-8.1.2.tgz", - "integrity": "sha512-bdlj/CJVjpaz06NBpfHhp4kGJaRZfz7AzC+6EwUImRtrwIw8dIgJ63Xg0OzV9pRn3rIzrt5c2sa++BL0JJ8GLw==", - "dev": true, - "dependencies": { - "@octokit/request": "^9.1.4", - "@octokit/types": "^13.6.2", - "universal-user-agent": "^7.0.0" - }, - "engines": { - "node": ">= 18" - } - }, - "node_modules/@octokit/oauth-authorization-url": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/@octokit/oauth-authorization-url/-/oauth-authorization-url-7.1.1.tgz", - "integrity": "sha512-ooXV8GBSabSWyhLUowlMIVd9l1s2nsOGQdlP2SQ4LnkEsGXzeCvbSbCPdZThXhEFzleGPwbapT0Sb+YhXRyjCA==", - "dev": true, - "engines": { - "node": ">= 18" - } - }, - "node_modules/@octokit/oauth-methods": { - "version": "5.1.3", - "resolved": "https://registry.npmjs.org/@octokit/oauth-methods/-/oauth-methods-5.1.3.tgz", - "integrity": "sha512-M+bDBi5H8FnH0xhCTg0m9hvcnppdDnxUqbZyOkxlLblKpLAR+eT2nbDPvJDp0eLrvJWA1I8OX0KHf/sBMQARRA==", - "dev": true, - "dependencies": { - "@octokit/oauth-authorization-url": "^7.0.0", - "@octokit/request": "^9.1.4", - "@octokit/request-error": "^6.1.6", - "@octokit/types": "^13.6.2" - }, - "engines": { - "node": ">= 18" - } - }, - "node_modules/@octokit/openapi-types": { - "version": "23.0.1", - "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-23.0.1.tgz", - "integrity": "sha512-izFjMJ1sir0jn0ldEKhZ7xegCTj/ObmEDlEfpFrx4k/JyZSMRHbO3/rBwgE7f3m2DHt+RrNGIVw4wSmwnm3t/g==", - "dev": true - }, - "node_modules/@octokit/plugin-paginate-rest": { - "version": "11.4.0", - "resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-11.4.0.tgz", - "integrity": "sha512-ttpGck5AYWkwMkMazNCZMqxKqIq1fJBNxBfsFwwfyYKTf914jKkLF0POMS3YkPBwp5g1c2Y4L79gDz01GhSr1g==", - "dev": true, - "dependencies": { - "@octokit/types": "^13.7.0" - }, - "engines": { - "node": ">= 18" - }, - "peerDependencies": { - "@octokit/core": ">=6" - } - }, - "node_modules/@octokit/plugin-request-log": { - "version": "5.3.1", - "resolved": "https://registry.npmjs.org/@octokit/plugin-request-log/-/plugin-request-log-5.3.1.tgz", - "integrity": "sha512-n/lNeCtq+9ofhC15xzmJCNKP2BWTv8Ih2TTy+jatNCCq/gQP/V7rK3fjIfuz0pDWDALO/o/4QY4hyOF6TQQFUw==", - "dev": true, - "engines": { - "node": ">= 18" - }, - "peerDependencies": { - "@octokit/core": ">=6" - } - }, - "node_modules/@octokit/plugin-rest-endpoint-methods": { - "version": "13.3.0", - "resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-13.3.0.tgz", - "integrity": "sha512-LUm44shlmkp/6VC+qQgHl3W5vzUP99ZM54zH6BuqkJK4DqfFLhegANd+fM4YRLapTvPm4049iG7F3haANKMYvQ==", - "dev": true, - "dependencies": { - "@octokit/types": "^13.7.0" - }, - "engines": { - "node": ">= 18" - }, - "peerDependencies": { - "@octokit/core": ">=6" - } - }, - "node_modules/@octokit/request": { - "version": "9.1.4", - "resolved": "https://registry.npmjs.org/@octokit/request/-/request-9.1.4.tgz", - "integrity": "sha512-tMbOwGm6wDII6vygP3wUVqFTw3Aoo0FnVQyhihh8vVq12uO3P+vQZeo2CKMpWtPSogpACD0yyZAlVlQnjW71DA==", - "dev": true, - "dependencies": { - "@octokit/endpoint": "^10.0.0", - "@octokit/request-error": "^6.0.1", - "@octokit/types": "^13.6.2", - "fast-content-type-parse": "^2.0.0", - "universal-user-agent": "^7.0.2" - }, - "engines": { - "node": ">= 18" - } - }, - "node_modules/@octokit/request-error": { - "version": "6.1.6", - "resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-6.1.6.tgz", - "integrity": "sha512-pqnVKYo/at0NuOjinrgcQYpEbv4snvP3bKMRqHaD9kIsk9u1LCpb2smHZi8/qJfgeNqLo5hNW4Z7FezNdEo0xg==", - "dev": true, - "dependencies": { - "@octokit/types": "^13.6.2" - }, - "engines": { - "node": ">= 18" - } - }, - "node_modules/@octokit/rest": { - "version": "21.1.0", - "resolved": "https://registry.npmjs.org/@octokit/rest/-/rest-21.1.0.tgz", - "integrity": "sha512-93iLxcKDJboUpmnUyeJ6cRIi7z7cqTZT1K7kRK4LobGxwTwpsa+2tQQbRQNGy7IFDEAmrtkf4F4wBj3D5rVlJQ==", - "dev": true, - "dependencies": { - "@octokit/core": "^6.1.3", - "@octokit/plugin-paginate-rest": "^11.4.0", - "@octokit/plugin-request-log": "^5.3.1", - "@octokit/plugin-rest-endpoint-methods": "^13.3.0" - }, - "engines": { - "node": ">= 18" - } - }, - "node_modules/@octokit/types": { - "version": "13.7.0", - "resolved": "https://registry.npmjs.org/@octokit/types/-/types-13.7.0.tgz", - "integrity": "sha512-BXfRP+3P3IN6fd4uF3SniaHKOO4UXWBfkdR3vA8mIvaoO/wLjGN5qivUtW0QRitBHHMcfC41SLhNVYIZZE+wkA==", - "dev": true, - "dependencies": { - "@octokit/openapi-types": "^23.0.1" - } - }, - "node_modules/@tsconfig/node10": { - "version": "1.0.11", - "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.11.tgz", - "integrity": "sha512-DcRjDCujK/kCk/cUe8Xz8ZSpm8mS3mNNpta+jGCA6USEDfktlNvm1+IuZ9eTcDbNk41BHwpHHeW+N1lKCz4zOw==", - "dev": true - }, - "node_modules/@tsconfig/node12": { - "version": "1.0.11", - "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz", - "integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==", - "dev": true - }, - "node_modules/@tsconfig/node14": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz", - "integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==", - "dev": true - }, - "node_modules/@tsconfig/node16": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.4.tgz", - "integrity": "sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==", - "dev": true - }, - "node_modules/@types/node": { - "version": "22.10.7", - "resolved": "https://registry.npmjs.org/@types/node/-/node-22.10.7.tgz", - "integrity": "sha512-V09KvXxFiutGp6B7XkpaDXlNadZxrzajcY50EuoLIpQ6WWYCSvf19lVIazzfIzQvhUN2HjX12spLojTnhuKlGg==", - "dev": true, - "dependencies": { - "undici-types": "~6.20.0" - } - }, - "node_modules/acorn": { - "version": "8.14.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.14.0.tgz", - "integrity": "sha512-cl669nCJTZBsL97OF4kUQm5g5hC2uihk0NxY3WENAC0TYdILVkAyHymAntgxGkl7K+t0cXIrH5siy5S4XkFycA==", - "dev": true, - "bin": { - "acorn": "bin/acorn" - }, - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/acorn-walk": { - "version": "8.3.4", - "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.3.4.tgz", - "integrity": "sha512-ueEepnujpqee2o5aIYnvHU6C0A42MNdsIDeqy5BydrkuC5R1ZuUFnm27EeFJGoEHJQgn3uleRvmTXaJgfXbt4g==", - "dev": true, - "dependencies": { - "acorn": "^8.11.0" - }, - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/arg": { - "version": "4.1.3", - "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", - "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", - "dev": true - }, - "node_modules/before-after-hook": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/before-after-hook/-/before-after-hook-3.0.2.tgz", - "integrity": "sha512-Nik3Sc0ncrMK4UUdXQmAnRtzmNQTAAXmXIopizwZ1W1t8QmfJj+zL4OA2I7XPTPW5z5TDqv4hRo/JzouDJnX3A==", - "dev": true - }, - "node_modules/create-require": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", - "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", - "dev": true - }, - "node_modules/diff": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", - "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", - "dev": true, - "engines": { - "node": ">=0.3.1" - } - }, - "node_modules/dotenv": { - "version": "16.4.7", - "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.4.7.tgz", - "integrity": "sha512-47qPchRCykZC03FhkYAhrvwU4xDBFIj1QPqaarj6mdM/hgUzfPHcpkHJOn3mJAufFeeAxAzeGsr5X0M4k6fLZQ==", - "dev": true, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://dotenvx.com" - } - }, - "node_modules/fast-content-type-parse": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/fast-content-type-parse/-/fast-content-type-parse-2.0.1.tgz", - "integrity": "sha512-nGqtvLrj5w0naR6tDPfB4cUmYCqouzyQiz6C5y/LtcDllJdrcc6WaWW6iXyIIOErTa/XRybj28aasdn4LkVk6Q==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/fastify" - }, - { - "type": "opencollective", - "url": "https://opencollective.com/fastify" - } - ] - }, - "node_modules/make-error": { - "version": "1.3.6", - "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", - "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", - "dev": true - }, - "node_modules/toad-cache": { - "version": "3.7.0", - "resolved": "https://registry.npmjs.org/toad-cache/-/toad-cache-3.7.0.tgz", - "integrity": "sha512-/m8M+2BJUpoJdgAHoG+baCwBT+tf2VraSfkBgl0Y00qIWt41DJ8R5B8nsEw0I58YwF5IZH6z24/2TobDKnqSWw==", - "dev": true, - "engines": { - "node": ">=12" - } - }, - "node_modules/ts-node": { - "version": "10.9.2", - "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.2.tgz", - "integrity": "sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==", - "dev": true, - "dependencies": { - "@cspotcode/source-map-support": "^0.8.0", - "@tsconfig/node10": "^1.0.7", - "@tsconfig/node12": "^1.0.7", - "@tsconfig/node14": "^1.0.0", - "@tsconfig/node16": "^1.0.2", - "acorn": "^8.4.1", - "acorn-walk": "^8.1.1", - "arg": "^4.1.0", - "create-require": "^1.1.0", - "diff": "^4.0.1", - "make-error": "^1.1.1", - "v8-compile-cache-lib": "^3.0.1", - "yn": "3.1.1" - }, - "bin": { - "ts-node": "dist/bin.js", - "ts-node-cwd": "dist/bin-cwd.js", - "ts-node-esm": "dist/bin-esm.js", - "ts-node-script": "dist/bin-script.js", - "ts-node-transpile-only": "dist/bin-transpile.js", - "ts-script": "dist/bin-script-deprecated.js" - }, - "peerDependencies": { - "@swc/core": ">=1.2.50", - "@swc/wasm": ">=1.2.50", - "@types/node": "*", - "typescript": ">=2.7" - }, - "peerDependenciesMeta": { - "@swc/core": { - "optional": true - }, - "@swc/wasm": { - "optional": true - } - } - }, - "node_modules/typescript": { - "version": "5.7.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.7.3.tgz", - "integrity": "sha512-84MVSjMEHP+FQRPy3pX9sTVV/INIex71s9TL2Gm5FG/WG1SqXeKyZ0k7/blY/4FdOzI12CBy1vGc4og/eus0fw==", - "dev": true, - "bin": { - "tsc": "bin/tsc", - "tsserver": "bin/tsserver" - }, - "engines": { - "node": ">=14.17" - } - }, - "node_modules/undici-types": { - "version": "6.20.0", - "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.20.0.tgz", - "integrity": "sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg==", - "dev": true - }, - "node_modules/universal-github-app-jwt": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/universal-github-app-jwt/-/universal-github-app-jwt-2.2.0.tgz", - "integrity": "sha512-G5o6f95b5BggDGuUfKDApKaCgNYy2x7OdHY0zSMF081O0EJobw+1130VONhrA7ezGSV2FNOGyM+KQpQZAr9bIQ==", - "dev": true - }, - "node_modules/universal-user-agent": { - "version": "7.0.2", - "resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-7.0.2.tgz", - "integrity": "sha512-0JCqzSKnStlRRQfCdowvqy3cy0Dvtlb8xecj/H8JFZuCze4rwjPZQOgvFvn0Ws/usCHQFGpyr+pB9adaGwXn4Q==", - "dev": true - }, - "node_modules/v8-compile-cache-lib": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz", - "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==", - "dev": true - }, - "node_modules/yn": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", - "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", - "dev": true, - "engines": { - "node": ">=6" - } - } - } -} diff --git a/ee/automation/package.json b/ee/automation/package.json deleted file mode 100644 index ab9cce98..00000000 --- a/ee/automation/package.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "name": "vellum-automation", - "version": "0.0.1", - "type": "module", - "scripts": { - "create-release": "ts-node-esm ./src/create-release.ts", - "upgrade-workflow-server": "ts-node-esm ./src/upgrade-workflow-server.ts", - "auto-merge": "ts-node-esm ./src/auto-merge.ts" - }, - "devDependencies": { - "@octokit/auth-app": "^7.1.4", - "@octokit/rest": "^21.1.0", - "@types/node": "^22.10.7", - "dotenv": "^16.4.7", - "ts-node": "^10.9.2", - "typescript": "^5.7.3" - } -} diff --git a/ee/automation/src/auth.ts b/ee/automation/src/auth.ts deleted file mode 100644 index 8b8a43c0..00000000 --- a/ee/automation/src/auth.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { createAppAuth } from "@octokit/auth-app"; - -export const getGithubToken = async () => { - const appId = process.env.VELLUM_AUTOMATION_APP_ID; - const privateKey = process.env.VELLUM_AUTOMATION_PRIVATE_KEY; - const installationId = process.env.VELLUM_AUTOMATION_INSTALLATION_ID; - - if (!appId || !privateKey || !installationId) { - throw new Error( - "VELLUM_AUTOMATION_APP_ID, VELLUM_AUTOMATION_PRIVATE_KEY, and VELLUM_AUTOMATION_INSTALLATION_ID must be set" - ); - } - - if ( - !privateKey.startsWith("-----BEGIN RSA PRIVATE KEY-----") || - !privateKey.endsWith("-----END RSA PRIVATE KEY-----") - ) { - throw new Error( - `VELLUM_AUTOMATION_PRIVATE_KEY is an invalid. Please use the valid private key from \ -1password and store in your .env file. Also be sure to \`unset\` any VELLUM_AUTOMATION_* \ -env vars from your shell before running the script again.` - ); - } - - const auth = createAppAuth({ - appId, - privateKey, - installationId, - }); - - const { token } = await auth({ type: "installation" }); - return token; -}; diff --git a/ee/automation/src/auto-merge.ts b/ee/automation/src/auto-merge.ts deleted file mode 100644 index 08525b4d..00000000 --- a/ee/automation/src/auto-merge.ts +++ /dev/null @@ -1,149 +0,0 @@ -import { Octokit } from '@octokit/rest'; -import { getGithubToken } from './auth.js'; -import * as dotenv from 'dotenv'; - -dotenv.config(); - -const SDK_REPO = "vellum-client-go"; -const PR_NUMBER = parseInt(process.env.PR_NUMBER || '0'); -const HEAD_SHA = process.env.HEAD_SHA; - -const POLL_INTERVAL = 30000; // 30 seconds -const MAX_WAIT_TIME = 30 * 60 * 1000; // 30 minutes - -interface CheckRun { - status: string; - conclusion: string | null; - name: string; -} - -const isAutoMergeCheck = (checkName: string): boolean => { - return checkName.toLowerCase().includes('auto-merge'); -}; - -const main = async () => { - if (!SDK_REPO || !PR_NUMBER || !HEAD_SHA) { - throw new Error('Missing required environment variables: FERN_SDK_REPO, PR_NUMBER, HEAD_SHA'); - } - - console.log(`Starting auto-merge process for PR #${PR_NUMBER} in ${SDK_REPO}`); - console.log(`Head SHA: ${HEAD_SHA}`); - - const auth = await getGithubToken(); - const octokit = new Octokit({ auth }); - - const owner = "vellum-ai"; - const repo = SDK_REPO; - - const { data: pr } = await octokit.rest.pulls.get({ - owner, - repo, - pull_number: PR_NUMBER, - }); - - if (!pr.labels.some(label => label.name === 'release')) { - console.log('PR does not have release label, skipping auto-merge'); - return; - } - - if (pr.state !== 'open') { - console.log(`PR is ${pr.state}, skipping auto-merge`); - return; - } - - if (pr.user?.login !== 'fern-api' && pr.user?.login !== 'fern-api[bot]') { - console.log(`PR was not opened by fern-api user (opened by: ${pr.user?.login}), skipping auto-merge`); - return; - } - - console.log(`PR #${PR_NUMBER} is open, has release label, and was opened by authorized user (${pr.user?.login}), waiting for checks...`); - - const startTime = Date.now(); - - while (Date.now() - startTime < MAX_WAIT_TIME) { - try { - const { data: checkRuns } = await octokit.rest.checks.listForRef({ - owner, - repo, - ref: HEAD_SHA, - }); - - console.log(`Found ${checkRuns.total_count} check runs`); - - const checks: CheckRun[] = checkRuns.check_runs.map(run => ({ - status: run.status, - conclusion: run.conclusion, - name: run.name, - })); - - const autoMergeChecks = checks.filter(check => isAutoMergeCheck(check.name)); - if (autoMergeChecks.length > 0) { - console.log(`Excluding ${autoMergeChecks.length} auto-merge checks:`, - autoMergeChecks.map(c => c.name).join(', ')); - } - - if (checkRuns.total_count === 0) { - console.log('No check runs found, waiting...'); - await sleep(POLL_INTERVAL); - continue; - } - - const pendingChecks = checks.filter(check => - check.status !== 'completed' && !isAutoMergeCheck(check.name) - ); - if (pendingChecks.length > 0) { - console.log(`Waiting for ${pendingChecks.length} checks to complete:`, - pendingChecks.map(c => c.name).join(', ')); - await sleep(POLL_INTERVAL); - continue; - } - - const failedChecks = checks.filter(check => - check.conclusion !== 'success' && - check.conclusion !== 'neutral' && - check.conclusion !== 'skipped' && - !isAutoMergeCheck(check.name) - ); - - if (failedChecks.length > 0) { - console.log('Some checks failed, cannot auto-merge:'); - failedChecks.forEach(check => { - console.log(` - ${check.name}: ${check.conclusion}`); - }); - return; - } - - console.log('All checks passed! Attempting to merge PR...'); - - try { - await octokit.rest.pulls.merge({ - owner, - repo, - pull_number: PR_NUMBER, - merge_method: 'squash', - commit_title: `${pr.title} (#${PR_NUMBER})`, - }); - - console.log(`Successfully auto-merged PR #${PR_NUMBER}`); - return; - } catch (mergeError: any) { - if (mergeError.status === 405) { - console.log('PR cannot be merged (may have conflicts or branch protection rules)'); - } else { - console.error('Error merging PR:', mergeError.message); - } - return; - } - - } catch (error: any) { - console.error('Error checking status:', error.message); - await sleep(POLL_INTERVAL); - } - } - - console.log('Timeout reached, stopping auto-merge process'); -}; - -const sleep = (ms: number) => new Promise(resolve => setTimeout(resolve, ms)); - -main().catch(console.error); diff --git a/ee/automation/src/create-release.ts b/ee/automation/src/create-release.ts deleted file mode 100644 index ef34e57f..00000000 --- a/ee/automation/src/create-release.ts +++ /dev/null @@ -1,52 +0,0 @@ -import { Octokit } from '@octokit/rest'; -import { getGithubToken } from './auth.js'; -import dotenv from 'dotenv'; -import { getVersion } from './utils.js'; - -dotenv.config(); - -const SDK_REPO = "vellum-client-go"; - -const main = async () => { - const version = getVersion(); - - // Create the release - const auth = await getGithubToken(); - const octokit = new Octokit({ - auth, - }); - - const sdkReleases = await octokit.rest.repos.listReleases({ - owner: "vellum-ai", - repo: SDK_REPO, - }); - if (sdkReleases.data.find((release) => release.name === version)) { - throw new Error(`Release '${version}' already exists in '${SDK_REPO}'`); - } - - const generatorReleases = await octokit.rest.repos.listReleases({ - owner: "vellum-ai", - repo: "vellum-client-generator", - }); - const targetedRelease = generatorReleases.data.find( - (release) => release.name === version - ); - if (!targetedRelease?.body) { - throw new Error( - `Release '${version}' does not exist in 'vellum-client-generator'` - ); - } - - await octokit.rest.repos.createRelease({ - owner: "vellum-ai", - repo: SDK_REPO, - tag_name: version, - make_latest: "true", - name: version, - body: targetedRelease.body, - }); - - console.log(`Successfully created release '${version}'`); -}; - -main(); diff --git a/ee/automation/src/upgrade-workflow-server.ts b/ee/automation/src/upgrade-workflow-server.ts deleted file mode 100644 index 45a49d0f..00000000 --- a/ee/automation/src/upgrade-workflow-server.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { Octokit } from "@octokit/rest"; -import { getGithubToken } from './auth.js'; -import { getVersion } from './utils.js'; - -/* - * This triggers the workflow server version release and lives here for convenience - * so it can take advantage of the existing github app auth token. - */ -const main = async () => { - const version = getVersion(); - console.log("Upgrading workflow server to version", version); - const octokit = new Octokit({ auth: await getGithubToken() }); - await octokit.actions.createWorkflowDispatch({ - owner: "vellum-ai", - repo: "vembda-service", - workflow_id: "version-python-workflow-server.yaml", - ref: "main", - inputs: { - version, - }, - }); - - console.log( - "Successfully triggered workflow server github workflow, version:", - version - ); - process.exit(0); -}; - -main(); diff --git a/ee/automation/src/utils.ts b/ee/automation/src/utils.ts deleted file mode 100644 index 18e41a04..00000000 --- a/ee/automation/src/utils.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { fileURLToPath } from 'url'; -import path from 'path'; -import fs from 'fs'; - -export function getVersion() { - // Read and parse manifest file from environment variable - const __filename = fileURLToPath(import.meta.url); - const __dirname = path.dirname(__filename); - - const manifestFile = "go.mod"; - if (!manifestFile) { - throw new Error('FERN_MANIFEST_FILE environment variable is required'); - } - - const manifestPath = path.join(__dirname, '..', '..', '..', manifestFile); - const manifestContent = fs.readFileSync(manifestPath, 'utf8'); - - // Extract version using regex from environment variable - const versionRegexPattern = "// Version:\\s+v([0-9]+\\.[0-9]+\\.[0-9]+)"; - if (!versionRegexPattern) { - throw new Error('FERN_VERSION_REGEX environment variable is required'); - } - - const versionRegex = new RegExp(versionRegexPattern); - const version = manifestContent.match(versionRegex)?.[1]; - - if (!version) { - throw new Error(`Could not find version in ${manifestFile} using pattern ${versionRegexPattern}`); - } - - // Sanitize version by removing 'v' prefix if present - const sanitizedVersion = version.replace(/^v\.?/, ''); - - console.log('Found Version:', sanitizedVersion); - return sanitizedVersion; -} diff --git a/ee/automation/tsconfig.json b/ee/automation/tsconfig.json deleted file mode 100644 index ed37b674..00000000 --- a/ee/automation/tsconfig.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "compilerOptions": { - "composite": true, - "outDir": "lib", - "module": "esnext", - "target": "esnext", - "lib": ["dom", "dom.iterable", "esnext"], - "jsx": "react-jsx", - "moduleResolution": "node", - "resolveJsonModule": true, - "noImplicitAny": true, - "noImplicitThis": true, - "skipLibCheck": true, - "noFallthroughCasesInSwitch": true, - "forceConsistentCasingInFileNames": true, - "esModuleInterop": true, - "allowSyntheticDefaultImports": true, - "strict": true, - "isolatedModules": true, - "baseUrl": "./src", - "paths": { - "src/*": ["*"] - }, - "declaration": true, - "noUncheckedIndexedAccess": true, - "noImplicitReturns": true, - "types": ["node"] - }, - "include": ["./src/**/*"], - "ts-node": { - "esm": true, - "experimentalSpecifierResolution": "node" - } -} diff --git a/environments/client.go b/environments/client.go index 83e3e482..f4558c33 100644 --- a/environments/client.go +++ b/environments/client.go @@ -8,6 +8,7 @@ import ( core "github.com/vellum-ai/vellum-client-go/core" option "github.com/vellum-ai/vellum-client-go/option" http "net/http" + os "os" ) type Client struct { @@ -18,8 +19,8 @@ type Client struct { func NewClient(opts ...option.RequestOption) *Client { options := core.NewRequestOptions(opts...) - if options.ApiVersion == nil || *options.ApiVersion == "" { - options.ApiVersion = core.GetDefaultApiVersion() + if options.ApiVersion == "" { + options.ApiVersion = os.Getenv("VELLUM_API_VERSION") } return &Client{ baseURL: options.BaseURL, diff --git a/events/client.go b/events/client.go index 024922b7..81e348e7 100644 --- a/events/client.go +++ b/events/client.go @@ -12,6 +12,7 @@ import ( option "github.com/vellum-ai/vellum-client-go/option" io "io" http "net/http" + os "os" ) type Client struct { @@ -22,8 +23,8 @@ type Client struct { func NewClient(opts ...option.RequestOption) *Client { options := core.NewRequestOptions(opts...) - if options.ApiVersion == nil || *options.ApiVersion == "" { - options.ApiVersion = core.GetDefaultApiVersion() + if options.ApiVersion == "" { + options.ApiVersion = os.Getenv("VELLUM_API_VERSION") } return &Client{ baseURL: options.BaseURL, diff --git a/folderentities/client.go b/folderentities/client.go index 95d65fe4..51592c6a 100644 --- a/folderentities/client.go +++ b/folderentities/client.go @@ -8,6 +8,7 @@ import ( core "github.com/vellum-ai/vellum-client-go/core" option "github.com/vellum-ai/vellum-client-go/option" http "net/http" + os "os" ) type Client struct { @@ -18,8 +19,8 @@ type Client struct { func NewClient(opts ...option.RequestOption) *Client { options := core.NewRequestOptions(opts...) - if options.ApiVersion == nil || *options.ApiVersion == "" { - options.ApiVersion = core.GetDefaultApiVersion() + if options.ApiVersion == "" { + options.ApiVersion = os.Getenv("VELLUM_API_VERSION") } return &Client{ baseURL: options.BaseURL, diff --git a/go.mod b/go.mod index 56eb2435..5b80c85f 100644 --- a/go.mod +++ b/go.mod @@ -1,7 +1,5 @@ module github.com/vellum-ai/vellum-client-go -// Version: v1.14.2 - go 1.18 require ( diff --git a/integration_auth_configs.go b/integration_auth_configs.go index 5c6b2467..a41bf47d 100644 --- a/integration_auth_configs.go +++ b/integration_auth_configs.go @@ -12,8 +12,10 @@ type ListIntegrationAuthConfigsRequest struct { // The response fields to expand for more information. // - 'integration_credentials' expands the list of integration credentials that the authenticated entity has access to for the auth config. // - 'additional_parameters' (retrieve only) fetches additional parameter requirements for the auth config. - Expand []*string `json:"-" url:"expand,omitempty"` - IntegrationName *string `json:"-" url:"integration_name,omitempty"` + Expand []*string `json:"-" url:"expand,omitempty"` + IntegrationName *string `json:"-" url:"integration_name,omitempty"` + // Multiple values may be separated by commas. + IntegrationNames []*string `json:"-" url:"integration_names,omitempty"` IntegrationProvider *string `json:"-" url:"integration_provider,omitempty"` // Number of results to return per page. Limit *int `json:"-" url:"limit,omitempty"` diff --git a/integrationauthconfigs/client.go b/integrationauthconfigs/client.go index 83f43b25..72d7c679 100644 --- a/integrationauthconfigs/client.go +++ b/integrationauthconfigs/client.go @@ -8,6 +8,7 @@ import ( core "github.com/vellum-ai/vellum-client-go/core" option "github.com/vellum-ai/vellum-client-go/option" http "net/http" + os "os" ) type Client struct { @@ -18,8 +19,8 @@ type Client struct { func NewClient(opts ...option.RequestOption) *Client { options := core.NewRequestOptions(opts...) - if options.ApiVersion == nil || *options.ApiVersion == "" { - options.ApiVersion = core.GetDefaultApiVersion() + if options.ApiVersion == "" { + options.ApiVersion = os.Getenv("VELLUM_API_VERSION") } return &Client{ baseURL: options.BaseURL, diff --git a/integrationproviders/client.go b/integrationproviders/client.go index 5b827659..5ba3797b 100644 --- a/integrationproviders/client.go +++ b/integrationproviders/client.go @@ -8,6 +8,7 @@ import ( core "github.com/vellum-ai/vellum-client-go/core" option "github.com/vellum-ai/vellum-client-go/option" http "net/http" + os "os" ) type Client struct { @@ -18,8 +19,8 @@ type Client struct { func NewClient(opts ...option.RequestOption) *Client { options := core.NewRequestOptions(opts...) - if options.ApiVersion == nil || *options.ApiVersion == "" { - options.ApiVersion = core.GetDefaultApiVersion() + if options.ApiVersion == "" { + options.ApiVersion = os.Getenv("VELLUM_API_VERSION") } return &Client{ baseURL: options.BaseURL, diff --git a/integrations/client.go b/integrations/client.go index 65417c58..9197adc0 100644 --- a/integrations/client.go +++ b/integrations/client.go @@ -12,6 +12,7 @@ import ( option "github.com/vellum-ai/vellum-client-go/option" io "io" http "net/http" + os "os" ) type Client struct { @@ -22,8 +23,8 @@ type Client struct { func NewClient(opts ...option.RequestOption) *Client { options := core.NewRequestOptions(opts...) - if options.ApiVersion == nil || *options.ApiVersion == "" { - options.ApiVersion = core.GetDefaultApiVersion() + if options.ApiVersion == "" { + options.ApiVersion = os.Getenv("VELLUM_API_VERSION") } return &Client{ baseURL: options.BaseURL, diff --git a/metricdefinitions/client.go b/metricdefinitions/client.go index 1b77c15d..c4aaf4a9 100644 --- a/metricdefinitions/client.go +++ b/metricdefinitions/client.go @@ -8,6 +8,7 @@ import ( core "github.com/vellum-ai/vellum-client-go/core" option "github.com/vellum-ai/vellum-client-go/option" http "net/http" + os "os" ) type Client struct { @@ -18,8 +19,8 @@ type Client struct { func NewClient(opts ...option.RequestOption) *Client { options := core.NewRequestOptions(opts...) - if options.ApiVersion == nil || *options.ApiVersion == "" { - options.ApiVersion = core.GetDefaultApiVersion() + if options.ApiVersion == "" { + options.ApiVersion = os.Getenv("VELLUM_API_VERSION") } return &Client{ baseURL: options.BaseURL, diff --git a/ml_models.go b/ml_models.go index b677adcc..cc364d88 100644 --- a/ml_models.go +++ b/ml_models.go @@ -9,142 +9,6 @@ import ( time "time" ) -// * `ANTHROPIC` - Anthropic -// * `AWS_BEDROCK` - AWS Bedrock -// * `AZURE_AI_FOUNDRY` - Azure AI Foundry -// * `AZURE_OPENAI` - Azure OpenAI -// * `BASETEN` - BaseTen -// * `CEREBRAS` - Cerebras -// * `COHERE` - Cohere -// * `CUSTOM` - Custom -// * `DEEP_SEEK` - DeepSeek -// * `FIREWORKS_AI` - Fireworks AI -// * `GOOGLE` - Google -// * `GOOGLE_VERTEX_AI` - Google Vertex AI -// * `GROQ` - Groq -// * `HUGGINGFACE` - HuggingFace -// * `IBM_WATSONX` - IBM WatsonX -// * `MISTRAL_AI` - Mistral AI -// * `MOSAICML` - MosaicML -// * `MYSTIC` - Mystic -// * `NVIDIA` - NVIDIA -// * `OPENAI` - OpenAI -// * `OPEN_ROUTER` - Open Router -// * `OPENPIPE` - OpenPipe -// * `PERPLEXITY` - Perplexity -// * `PYQ` - Pyq -// * `REPLICATE` - Replicate -// * `SAMBANOVA` - SambaNova -// * `TOGETHER_AI` - Together AI -// * `X_AI` - xAI -// * `FASTWEB` - Fastweb -// * `SWISSCOM` - Swisscom -type MlModelHostingInterface string - -const ( - MlModelHostingInterfaceAnthropic MlModelHostingInterface = "ANTHROPIC" - MlModelHostingInterfaceAwsBedrock MlModelHostingInterface = "AWS_BEDROCK" - MlModelHostingInterfaceAzureAiFoundry MlModelHostingInterface = "AZURE_AI_FOUNDRY" - MlModelHostingInterfaceAzureOpenai MlModelHostingInterface = "AZURE_OPENAI" - MlModelHostingInterfaceBaseten MlModelHostingInterface = "BASETEN" - MlModelHostingInterfaceCerebras MlModelHostingInterface = "CEREBRAS" - MlModelHostingInterfaceCohere MlModelHostingInterface = "COHERE" - MlModelHostingInterfaceCustom MlModelHostingInterface = "CUSTOM" - MlModelHostingInterfaceDeepSeek MlModelHostingInterface = "DEEP_SEEK" - MlModelHostingInterfaceFireworksAi MlModelHostingInterface = "FIREWORKS_AI" - MlModelHostingInterfaceGoogle MlModelHostingInterface = "GOOGLE" - MlModelHostingInterfaceGoogleVertexAi MlModelHostingInterface = "GOOGLE_VERTEX_AI" - MlModelHostingInterfaceGroq MlModelHostingInterface = "GROQ" - MlModelHostingInterfaceHuggingface MlModelHostingInterface = "HUGGINGFACE" - MlModelHostingInterfaceIbmWatsonx MlModelHostingInterface = "IBM_WATSONX" - MlModelHostingInterfaceMistralAi MlModelHostingInterface = "MISTRAL_AI" - MlModelHostingInterfaceMosaicml MlModelHostingInterface = "MOSAICML" - MlModelHostingInterfaceMystic MlModelHostingInterface = "MYSTIC" - MlModelHostingInterfaceNvidia MlModelHostingInterface = "NVIDIA" - MlModelHostingInterfaceOpenai MlModelHostingInterface = "OPENAI" - MlModelHostingInterfaceOpenRouter MlModelHostingInterface = "OPEN_ROUTER" - MlModelHostingInterfaceOpenpipe MlModelHostingInterface = "OPENPIPE" - MlModelHostingInterfacePerplexity MlModelHostingInterface = "PERPLEXITY" - MlModelHostingInterfacePyq MlModelHostingInterface = "PYQ" - MlModelHostingInterfaceReplicate MlModelHostingInterface = "REPLICATE" - MlModelHostingInterfaceSambanova MlModelHostingInterface = "SAMBANOVA" - MlModelHostingInterfaceTogetherAi MlModelHostingInterface = "TOGETHER_AI" - MlModelHostingInterfaceXAi MlModelHostingInterface = "X_AI" - MlModelHostingInterfaceFastweb MlModelHostingInterface = "FASTWEB" - MlModelHostingInterfaceSwisscom MlModelHostingInterface = "SWISSCOM" -) - -func NewMlModelHostingInterfaceFromString(s string) (MlModelHostingInterface, error) { - switch s { - case "ANTHROPIC": - return MlModelHostingInterfaceAnthropic, nil - case "AWS_BEDROCK": - return MlModelHostingInterfaceAwsBedrock, nil - case "AZURE_AI_FOUNDRY": - return MlModelHostingInterfaceAzureAiFoundry, nil - case "AZURE_OPENAI": - return MlModelHostingInterfaceAzureOpenai, nil - case "BASETEN": - return MlModelHostingInterfaceBaseten, nil - case "CEREBRAS": - return MlModelHostingInterfaceCerebras, nil - case "COHERE": - return MlModelHostingInterfaceCohere, nil - case "CUSTOM": - return MlModelHostingInterfaceCustom, nil - case "DEEP_SEEK": - return MlModelHostingInterfaceDeepSeek, nil - case "FIREWORKS_AI": - return MlModelHostingInterfaceFireworksAi, nil - case "GOOGLE": - return MlModelHostingInterfaceGoogle, nil - case "GOOGLE_VERTEX_AI": - return MlModelHostingInterfaceGoogleVertexAi, nil - case "GROQ": - return MlModelHostingInterfaceGroq, nil - case "HUGGINGFACE": - return MlModelHostingInterfaceHuggingface, nil - case "IBM_WATSONX": - return MlModelHostingInterfaceIbmWatsonx, nil - case "MISTRAL_AI": - return MlModelHostingInterfaceMistralAi, nil - case "MOSAICML": - return MlModelHostingInterfaceMosaicml, nil - case "MYSTIC": - return MlModelHostingInterfaceMystic, nil - case "NVIDIA": - return MlModelHostingInterfaceNvidia, nil - case "OPENAI": - return MlModelHostingInterfaceOpenai, nil - case "OPEN_ROUTER": - return MlModelHostingInterfaceOpenRouter, nil - case "OPENPIPE": - return MlModelHostingInterfaceOpenpipe, nil - case "PERPLEXITY": - return MlModelHostingInterfacePerplexity, nil - case "PYQ": - return MlModelHostingInterfacePyq, nil - case "REPLICATE": - return MlModelHostingInterfaceReplicate, nil - case "SAMBANOVA": - return MlModelHostingInterfaceSambanova, nil - case "TOGETHER_AI": - return MlModelHostingInterfaceTogetherAi, nil - case "X_AI": - return MlModelHostingInterfaceXAi, nil - case "FASTWEB": - return MlModelHostingInterfaceFastweb, nil - case "SWISSCOM": - return MlModelHostingInterfaceSwisscom, nil - } - var t MlModelHostingInterface - return "", fmt.Errorf("%s is not a valid %T", s, t) -} - -func (m MlModelHostingInterface) Ptr() *MlModelHostingInterface { - return &m -} - // An ML Model that your Workspace has access to. type MlModelRead struct { Id string `json:"id" url:"id"` diff --git a/mlmodels/client.go b/mlmodels/client.go index 9ca6c308..e4098c39 100644 --- a/mlmodels/client.go +++ b/mlmodels/client.go @@ -8,6 +8,7 @@ import ( core "github.com/vellum-ai/vellum-client-go/core" option "github.com/vellum-ai/vellum-client-go/option" http "net/http" + os "os" ) type Client struct { @@ -18,8 +19,8 @@ type Client struct { func NewClient(opts ...option.RequestOption) *Client { options := core.NewRequestOptions(opts...) - if options.ApiVersion == nil || *options.ApiVersion == "" { - options.ApiVersion = core.GetDefaultApiVersion() + if options.ApiVersion == "" { + options.ApiVersion = os.Getenv("VELLUM_API_VERSION") } return &Client{ baseURL: options.BaseURL, diff --git a/option/request_option.go b/option/request_option.go index c3764dbb..effcadb5 100644 --- a/option/request_option.go +++ b/option/request_option.go @@ -3,6 +3,7 @@ package option import ( + vellumclientgo "github.com/vellum-ai/vellum-client-go" core "github.com/vellum-ai/vellum-client-go/core" http "net/http" url "net/url" @@ -71,7 +72,7 @@ func WithApiKey(apiKey string) *core.ApiKeyOption { } // WithApiVersion sets the apiVersion request header. -func WithApiVersion(apiVersion *core.ApiVersionEnum) *core.ApiVersionOption { +func WithApiVersion(apiVersion *vellumclientgo.ApiVersionEnum) *core.ApiVersionOption { return &core.ApiVersionOption{ ApiVersion: apiVersion, } diff --git a/organizations/client.go b/organizations/client.go index ba8f72d3..51c5b406 100644 --- a/organizations/client.go +++ b/organizations/client.go @@ -8,6 +8,7 @@ import ( core "github.com/vellum-ai/vellum-client-go/core" option "github.com/vellum-ai/vellum-client-go/option" http "net/http" + os "os" ) type Client struct { @@ -18,8 +19,8 @@ type Client struct { func NewClient(opts ...option.RequestOption) *Client { options := core.NewRequestOptions(opts...) - if options.ApiVersion == nil || *options.ApiVersion == "" { - options.ApiVersion = core.GetDefaultApiVersion() + if options.ApiVersion == "" { + options.ApiVersion = os.Getenv("VELLUM_API_VERSION") } return &Client{ baseURL: options.BaseURL, diff --git a/prompts/client.go b/prompts/client.go index 32006396..bab13a43 100644 --- a/prompts/client.go +++ b/prompts/client.go @@ -13,6 +13,7 @@ import ( option "github.com/vellum-ai/vellum-client-go/option" io "io" http "net/http" + os "os" ) type Client struct { @@ -23,8 +24,8 @@ type Client struct { func NewClient(opts ...option.RequestOption) *Client { options := core.NewRequestOptions(opts...) - if options.ApiVersion == nil || *options.ApiVersion == "" { - options.ApiVersion = core.GetDefaultApiVersion() + if options.ApiVersion == "" { + options.ApiVersion = os.Getenv("VELLUM_API_VERSION") } return &Client{ baseURL: options.BaseURL, diff --git a/sandboxes/client.go b/sandboxes/client.go index b14bbcd3..3c63545c 100644 --- a/sandboxes/client.go +++ b/sandboxes/client.go @@ -8,6 +8,7 @@ import ( core "github.com/vellum-ai/vellum-client-go/core" option "github.com/vellum-ai/vellum-client-go/option" http "net/http" + os "os" ) type Client struct { @@ -18,8 +19,8 @@ type Client struct { func NewClient(opts ...option.RequestOption) *Client { options := core.NewRequestOptions(opts...) - if options.ApiVersion == nil || *options.ApiVersion == "" { - options.ApiVersion = core.GetDefaultApiVersion() + if options.ApiVersion == "" { + options.ApiVersion = os.Getenv("VELLUM_API_VERSION") } return &Client{ baseURL: options.BaseURL, diff --git a/testsuiteruns/client.go b/testsuiteruns/client.go index 0b19098e..29d8b57a 100644 --- a/testsuiteruns/client.go +++ b/testsuiteruns/client.go @@ -8,6 +8,7 @@ import ( core "github.com/vellum-ai/vellum-client-go/core" option "github.com/vellum-ai/vellum-client-go/option" http "net/http" + os "os" ) type Client struct { @@ -18,8 +19,8 @@ type Client struct { func NewClient(opts ...option.RequestOption) *Client { options := core.NewRequestOptions(opts...) - if options.ApiVersion == nil || *options.ApiVersion == "" { - options.ApiVersion = core.GetDefaultApiVersion() + if options.ApiVersion == "" { + options.ApiVersion = os.Getenv("VELLUM_API_VERSION") } return &Client{ baseURL: options.BaseURL, diff --git a/testsuites/client.go b/testsuites/client.go index 8cdcc49c..c58005e1 100644 --- a/testsuites/client.go +++ b/testsuites/client.go @@ -8,6 +8,7 @@ import ( core "github.com/vellum-ai/vellum-client-go/core" option "github.com/vellum-ai/vellum-client-go/option" http "net/http" + os "os" ) type Client struct { @@ -18,8 +19,8 @@ type Client struct { func NewClient(opts ...option.RequestOption) *Client { options := core.NewRequestOptions(opts...) - if options.ApiVersion == nil || *options.ApiVersion == "" { - options.ApiVersion = core.GetDefaultApiVersion() + if options.ApiVersion == "" { + options.ApiVersion = os.Getenv("VELLUM_API_VERSION") } return &Client{ baseURL: options.BaseURL, diff --git a/types.go b/types.go index fcfafa8a..47407c5c 100644 --- a/types.go +++ b/types.go @@ -10954,6 +10954,142 @@ func (m *MetricNodeResult) String() string { return fmt.Sprintf("%#v", m) } +// * `ANTHROPIC` - Anthropic +// * `AWS_BEDROCK` - AWS Bedrock +// * `AZURE_AI_FOUNDRY` - Azure AI Foundry +// * `AZURE_OPENAI` - Azure OpenAI +// * `BASETEN` - BaseTen +// * `CEREBRAS` - Cerebras +// * `COHERE` - Cohere +// * `CUSTOM` - Custom +// * `DEEP_SEEK` - DeepSeek +// * `FIREWORKS_AI` - Fireworks AI +// * `GOOGLE` - Google +// * `GOOGLE_VERTEX_AI` - Google Vertex AI +// * `GROQ` - Groq +// * `HUGGINGFACE` - HuggingFace +// * `IBM_WATSONX` - IBM WatsonX +// * `MISTRAL_AI` - Mistral AI +// * `MOSAICML` - MosaicML +// * `MYSTIC` - Mystic +// * `NVIDIA` - NVIDIA +// * `OPENAI` - OpenAI +// * `OPEN_ROUTER` - Open Router +// * `OPENPIPE` - OpenPipe +// * `PERPLEXITY` - Perplexity +// * `PYQ` - Pyq +// * `REPLICATE` - Replicate +// * `SAMBANOVA` - SambaNova +// * `TOGETHER_AI` - Together AI +// * `X_AI` - xAI +// * `FASTWEB` - Fastweb +// * `SWISSCOM` - Swisscom +type MlModelHostingInterface string + +const ( + MlModelHostingInterfaceAnthropic MlModelHostingInterface = "ANTHROPIC" + MlModelHostingInterfaceAwsBedrock MlModelHostingInterface = "AWS_BEDROCK" + MlModelHostingInterfaceAzureAiFoundry MlModelHostingInterface = "AZURE_AI_FOUNDRY" + MlModelHostingInterfaceAzureOpenai MlModelHostingInterface = "AZURE_OPENAI" + MlModelHostingInterfaceBaseten MlModelHostingInterface = "BASETEN" + MlModelHostingInterfaceCerebras MlModelHostingInterface = "CEREBRAS" + MlModelHostingInterfaceCohere MlModelHostingInterface = "COHERE" + MlModelHostingInterfaceCustom MlModelHostingInterface = "CUSTOM" + MlModelHostingInterfaceDeepSeek MlModelHostingInterface = "DEEP_SEEK" + MlModelHostingInterfaceFireworksAi MlModelHostingInterface = "FIREWORKS_AI" + MlModelHostingInterfaceGoogle MlModelHostingInterface = "GOOGLE" + MlModelHostingInterfaceGoogleVertexAi MlModelHostingInterface = "GOOGLE_VERTEX_AI" + MlModelHostingInterfaceGroq MlModelHostingInterface = "GROQ" + MlModelHostingInterfaceHuggingface MlModelHostingInterface = "HUGGINGFACE" + MlModelHostingInterfaceIbmWatsonx MlModelHostingInterface = "IBM_WATSONX" + MlModelHostingInterfaceMistralAi MlModelHostingInterface = "MISTRAL_AI" + MlModelHostingInterfaceMosaicml MlModelHostingInterface = "MOSAICML" + MlModelHostingInterfaceMystic MlModelHostingInterface = "MYSTIC" + MlModelHostingInterfaceNvidia MlModelHostingInterface = "NVIDIA" + MlModelHostingInterfaceOpenai MlModelHostingInterface = "OPENAI" + MlModelHostingInterfaceOpenRouter MlModelHostingInterface = "OPEN_ROUTER" + MlModelHostingInterfaceOpenpipe MlModelHostingInterface = "OPENPIPE" + MlModelHostingInterfacePerplexity MlModelHostingInterface = "PERPLEXITY" + MlModelHostingInterfacePyq MlModelHostingInterface = "PYQ" + MlModelHostingInterfaceReplicate MlModelHostingInterface = "REPLICATE" + MlModelHostingInterfaceSambanova MlModelHostingInterface = "SAMBANOVA" + MlModelHostingInterfaceTogetherAi MlModelHostingInterface = "TOGETHER_AI" + MlModelHostingInterfaceXAi MlModelHostingInterface = "X_AI" + MlModelHostingInterfaceFastweb MlModelHostingInterface = "FASTWEB" + MlModelHostingInterfaceSwisscom MlModelHostingInterface = "SWISSCOM" +) + +func NewMlModelHostingInterfaceFromString(s string) (MlModelHostingInterface, error) { + switch s { + case "ANTHROPIC": + return MlModelHostingInterfaceAnthropic, nil + case "AWS_BEDROCK": + return MlModelHostingInterfaceAwsBedrock, nil + case "AZURE_AI_FOUNDRY": + return MlModelHostingInterfaceAzureAiFoundry, nil + case "AZURE_OPENAI": + return MlModelHostingInterfaceAzureOpenai, nil + case "BASETEN": + return MlModelHostingInterfaceBaseten, nil + case "CEREBRAS": + return MlModelHostingInterfaceCerebras, nil + case "COHERE": + return MlModelHostingInterfaceCohere, nil + case "CUSTOM": + return MlModelHostingInterfaceCustom, nil + case "DEEP_SEEK": + return MlModelHostingInterfaceDeepSeek, nil + case "FIREWORKS_AI": + return MlModelHostingInterfaceFireworksAi, nil + case "GOOGLE": + return MlModelHostingInterfaceGoogle, nil + case "GOOGLE_VERTEX_AI": + return MlModelHostingInterfaceGoogleVertexAi, nil + case "GROQ": + return MlModelHostingInterfaceGroq, nil + case "HUGGINGFACE": + return MlModelHostingInterfaceHuggingface, nil + case "IBM_WATSONX": + return MlModelHostingInterfaceIbmWatsonx, nil + case "MISTRAL_AI": + return MlModelHostingInterfaceMistralAi, nil + case "MOSAICML": + return MlModelHostingInterfaceMosaicml, nil + case "MYSTIC": + return MlModelHostingInterfaceMystic, nil + case "NVIDIA": + return MlModelHostingInterfaceNvidia, nil + case "OPENAI": + return MlModelHostingInterfaceOpenai, nil + case "OPEN_ROUTER": + return MlModelHostingInterfaceOpenRouter, nil + case "OPENPIPE": + return MlModelHostingInterfaceOpenpipe, nil + case "PERPLEXITY": + return MlModelHostingInterfacePerplexity, nil + case "PYQ": + return MlModelHostingInterfacePyq, nil + case "REPLICATE": + return MlModelHostingInterfaceReplicate, nil + case "SAMBANOVA": + return MlModelHostingInterfaceSambanova, nil + case "TOGETHER_AI": + return MlModelHostingInterfaceTogetherAi, nil + case "X_AI": + return MlModelHostingInterfaceXAi, nil + case "FASTWEB": + return MlModelHostingInterfaceFastweb, nil + case "SWISSCOM": + return MlModelHostingInterfaceSwisscom, nil + } + var t MlModelHostingInterface + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (m MlModelHostingInterface) Ptr() *MlModelHostingInterface { + return &m +} + type MlModelUsage struct { OutputTokenCount *int `json:"output_token_count,omitempty" url:"output_token_count,omitempty"` InputTokenCount *int `json:"input_token_count,omitempty" url:"input_token_count,omitempty"` diff --git a/uploadedfiles/client.go b/uploadedfiles/client.go index b46d05f5..e84cb27c 100644 --- a/uploadedfiles/client.go +++ b/uploadedfiles/client.go @@ -11,6 +11,7 @@ import ( io "io" multipart "mime/multipart" http "net/http" + os "os" ) type Client struct { @@ -21,8 +22,8 @@ type Client struct { func NewClient(opts ...option.RequestOption) *Client { options := core.NewRequestOptions(opts...) - if options.ApiVersion == nil || *options.ApiVersion == "" { - options.ApiVersion = core.GetDefaultApiVersion() + if options.ApiVersion == "" { + options.ApiVersion = os.Getenv("VELLUM_API_VERSION") } return &Client{ baseURL: options.BaseURL, diff --git a/workflow_deployments.go b/workflow_deployments.go index 56d9ac96..0620da60 100644 --- a/workflow_deployments.go +++ b/workflow_deployments.go @@ -363,6 +363,50 @@ func (s *SlimWorkflowExecutionRead) String() string { return fmt.Sprintf("%#v", s) } +type WorkflowDependency struct { + WorkflowIntegrationDependency *WorkflowIntegrationDependency + WorkflowModelProviderDependency *WorkflowModelProviderDependency +} + +func (w *WorkflowDependency) UnmarshalJSON(data []byte) error { + valueWorkflowIntegrationDependency := new(WorkflowIntegrationDependency) + if err := json.Unmarshal(data, &valueWorkflowIntegrationDependency); err == nil { + w.WorkflowIntegrationDependency = valueWorkflowIntegrationDependency + return nil + } + valueWorkflowModelProviderDependency := new(WorkflowModelProviderDependency) + if err := json.Unmarshal(data, &valueWorkflowModelProviderDependency); err == nil { + w.WorkflowModelProviderDependency = valueWorkflowModelProviderDependency + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, w) +} + +func (w WorkflowDependency) MarshalJSON() ([]byte, error) { + if w.WorkflowIntegrationDependency != nil { + return json.Marshal(w.WorkflowIntegrationDependency) + } + if w.WorkflowModelProviderDependency != nil { + return json.Marshal(w.WorkflowModelProviderDependency) + } + return nil, fmt.Errorf("type %T does not include a non-empty union type", w) +} + +type WorkflowDependencyVisitor interface { + VisitWorkflowIntegrationDependency(*WorkflowIntegrationDependency) error + VisitWorkflowModelProviderDependency(*WorkflowModelProviderDependency) error +} + +func (w *WorkflowDependency) Accept(visitor WorkflowDependencyVisitor) error { + if w.WorkflowIntegrationDependency != nil { + return visitor.VisitWorkflowIntegrationDependency(w.WorkflowIntegrationDependency) + } + if w.WorkflowModelProviderDependency != nil { + return visitor.VisitWorkflowModelProviderDependency(w.WorkflowModelProviderDependency) + } + return fmt.Errorf("type %T does not include a non-empty union type", w) +} + type WorkflowDeploymentEventExecutionsResponse struct { Count int `json:"count" url:"count"` Results []*SlimWorkflowExecutionRead `json:"results" url:"results"` @@ -583,10 +627,12 @@ func (w *WorkflowDeploymentReleaseWorkflowDeployment) String() string { return fmt.Sprintf("%#v", w) } +// The workflow version associated with a workflow deployment release. type WorkflowDeploymentReleaseWorkflowVersion struct { - Id string `json:"id" url:"id"` - InputVariables []*VellumVariable `json:"input_variables" url:"input_variables"` - OutputVariables []*VellumVariable `json:"output_variables" url:"output_variables"` + Id string `json:"id" url:"id"` + InputVariables []*VellumVariable `json:"input_variables" url:"input_variables"` + OutputVariables []*VellumVariable `json:"output_variables" url:"output_variables"` + Dependencies []*WorkflowDependency `json:"dependencies,omitempty" url:"dependencies,omitempty"` extraProperties map[string]interface{} _rawJSON json.RawMessage @@ -805,6 +851,144 @@ func (w *WorkflowExecutionViewOnlineEvalMetricResult) String() string { return fmt.Sprintf("%#v", w) } +type WorkflowIntegrationDependency struct { + Name IntegrationName `json:"name" url:"name"` + Provider string `json:"provider" url:"provider"` + Label *string `json:"label,omitempty" url:"label,omitempty"` + type_ string + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (w *WorkflowIntegrationDependency) GetExtraProperties() map[string]interface{} { + return w.extraProperties +} + +func (w *WorkflowIntegrationDependency) Type() string { + return w.type_ +} + +func (w *WorkflowIntegrationDependency) UnmarshalJSON(data []byte) error { + type embed WorkflowIntegrationDependency + var unmarshaler = struct { + embed + Type string `json:"type"` + }{ + embed: embed(*w), + } + if err := json.Unmarshal(data, &unmarshaler); err != nil { + return err + } + *w = WorkflowIntegrationDependency(unmarshaler.embed) + if unmarshaler.Type != "INTEGRATION" { + return fmt.Errorf("unexpected value for literal on type %T; expected %v got %v", w, "INTEGRATION", unmarshaler.Type) + } + w.type_ = unmarshaler.Type + + extraProperties, err := core.ExtractExtraProperties(data, *w, "type") + if err != nil { + return err + } + w.extraProperties = extraProperties + + w._rawJSON = json.RawMessage(data) + return nil +} + +func (w *WorkflowIntegrationDependency) MarshalJSON() ([]byte, error) { + type embed WorkflowIntegrationDependency + var marshaler = struct { + embed + Type string `json:"type"` + }{ + embed: embed(*w), + Type: "INTEGRATION", + } + return json.Marshal(marshaler) +} + +func (w *WorkflowIntegrationDependency) String() string { + if len(w._rawJSON) > 0 { + if value, err := core.StringifyJSON(w._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(w); err == nil { + return value + } + return fmt.Sprintf("%#v", w) +} + +type WorkflowModelProviderDependency struct { + Name MlModelHostingInterface `json:"name" url:"name"` + Label *string `json:"label,omitempty" url:"label,omitempty"` + ModelName string `json:"model_name" url:"model_name"` + type_ string + + extraProperties map[string]interface{} + _rawJSON json.RawMessage +} + +func (w *WorkflowModelProviderDependency) GetExtraProperties() map[string]interface{} { + return w.extraProperties +} + +func (w *WorkflowModelProviderDependency) Type() string { + return w.type_ +} + +func (w *WorkflowModelProviderDependency) UnmarshalJSON(data []byte) error { + type embed WorkflowModelProviderDependency + var unmarshaler = struct { + embed + Type string `json:"type"` + }{ + embed: embed(*w), + } + if err := json.Unmarshal(data, &unmarshaler); err != nil { + return err + } + *w = WorkflowModelProviderDependency(unmarshaler.embed) + if unmarshaler.Type != "MODEL_PROVIDER" { + return fmt.Errorf("unexpected value for literal on type %T; expected %v got %v", w, "MODEL_PROVIDER", unmarshaler.Type) + } + w.type_ = unmarshaler.Type + + extraProperties, err := core.ExtractExtraProperties(data, *w, "type") + if err != nil { + return err + } + w.extraProperties = extraProperties + + w._rawJSON = json.RawMessage(data) + return nil +} + +func (w *WorkflowModelProviderDependency) MarshalJSON() ([]byte, error) { + type embed WorkflowModelProviderDependency + var marshaler = struct { + embed + Type string `json:"type"` + }{ + embed: embed(*w), + Type: "MODEL_PROVIDER", + } + return json.Marshal(marshaler) +} + +func (w *WorkflowModelProviderDependency) String() string { + if len(w._rawJSON) > 0 { + if value, err := core.StringifyJSON(w._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(w); err == nil { + return value + } + return fmt.Sprintf("%#v", w) +} + type WorkflowReleaseTagRead struct { // The name of the Release Tag Name string `json:"name" url:"name"` diff --git a/workflowdeployments/client.go b/workflowdeployments/client.go index 329fb89c..503d7219 100644 --- a/workflowdeployments/client.go +++ b/workflowdeployments/client.go @@ -12,6 +12,7 @@ import ( option "github.com/vellum-ai/vellum-client-go/option" io "io" http "net/http" + os "os" ) type Client struct { @@ -22,8 +23,8 @@ type Client struct { func NewClient(opts ...option.RequestOption) *Client { options := core.NewRequestOptions(opts...) - if options.ApiVersion == nil || *options.ApiVersion == "" { - options.ApiVersion = core.GetDefaultApiVersion() + if options.ApiVersion == "" { + options.ApiVersion = os.Getenv("VELLUM_API_VERSION") } return &Client{ baseURL: options.BaseURL, diff --git a/workflowexecutions/client.go b/workflowexecutions/client.go index 9a8dcaf5..3ada62a8 100644 --- a/workflowexecutions/client.go +++ b/workflowexecutions/client.go @@ -12,6 +12,7 @@ import ( option "github.com/vellum-ai/vellum-client-go/option" io "io" http "net/http" + os "os" ) type Client struct { @@ -22,8 +23,8 @@ type Client struct { func NewClient(opts ...option.RequestOption) *Client { options := core.NewRequestOptions(opts...) - if options.ApiVersion == nil || *options.ApiVersion == "" { - options.ApiVersion = core.GetDefaultApiVersion() + if options.ApiVersion == "" { + options.ApiVersion = os.Getenv("VELLUM_API_VERSION") } return &Client{ baseURL: options.BaseURL, diff --git a/workflows/client.go b/workflows/client.go index bf31956a..3b57213a 100644 --- a/workflows/client.go +++ b/workflows/client.go @@ -14,6 +14,7 @@ import ( io "io" multipart "mime/multipart" http "net/http" + os "os" ) type Client struct { @@ -24,8 +25,8 @@ type Client struct { func NewClient(opts ...option.RequestOption) *Client { options := core.NewRequestOptions(opts...) - if options.ApiVersion == nil || *options.ApiVersion == "" { - options.ApiVersion = core.GetDefaultApiVersion() + if options.ApiVersion == "" { + options.ApiVersion = os.Getenv("VELLUM_API_VERSION") } return &Client{ baseURL: options.BaseURL, diff --git a/workflowsandboxes/client.go b/workflowsandboxes/client.go index c5ab7ddc..7f6835d0 100644 --- a/workflowsandboxes/client.go +++ b/workflowsandboxes/client.go @@ -8,6 +8,7 @@ import ( core "github.com/vellum-ai/vellum-client-go/core" option "github.com/vellum-ai/vellum-client-go/option" http "net/http" + os "os" ) type Client struct { @@ -18,8 +19,8 @@ type Client struct { func NewClient(opts ...option.RequestOption) *Client { options := core.NewRequestOptions(opts...) - if options.ApiVersion == nil || *options.ApiVersion == "" { - options.ApiVersion = core.GetDefaultApiVersion() + if options.ApiVersion == "" { + options.ApiVersion = os.Getenv("VELLUM_API_VERSION") } return &Client{ baseURL: options.BaseURL, diff --git a/workspaces/client.go b/workspaces/client.go index a32b3c0e..40b6b42e 100644 --- a/workspaces/client.go +++ b/workspaces/client.go @@ -8,6 +8,7 @@ import ( core "github.com/vellum-ai/vellum-client-go/core" option "github.com/vellum-ai/vellum-client-go/option" http "net/http" + os "os" ) type Client struct { @@ -18,8 +19,8 @@ type Client struct { func NewClient(opts ...option.RequestOption) *Client { options := core.NewRequestOptions(opts...) - if options.ApiVersion == nil || *options.ApiVersion == "" { - options.ApiVersion = core.GetDefaultApiVersion() + if options.ApiVersion == "" { + options.ApiVersion = os.Getenv("VELLUM_API_VERSION") } return &Client{ baseURL: options.BaseURL, diff --git a/workspacesecrets/client.go b/workspacesecrets/client.go index 7deb9e14..6408db20 100644 --- a/workspacesecrets/client.go +++ b/workspacesecrets/client.go @@ -8,6 +8,7 @@ import ( core "github.com/vellum-ai/vellum-client-go/core" option "github.com/vellum-ai/vellum-client-go/option" http "net/http" + os "os" ) type Client struct { @@ -18,8 +19,8 @@ type Client struct { func NewClient(opts ...option.RequestOption) *Client { options := core.NewRequestOptions(opts...) - if options.ApiVersion == nil || *options.ApiVersion == "" { - options.ApiVersion = core.GetDefaultApiVersion() + if options.ApiVersion == "" { + options.ApiVersion = os.Getenv("VELLUM_API_VERSION") } return &Client{ baseURL: options.BaseURL, From 8ad9f1d3dbf8b8f775868d6d9656283f2f35b5c6 Mon Sep 17 00:00:00 2001 From: "vellum-automation[bot]" Date: Thu, 5 Feb 2026 18:07:56 +0000 Subject: [PATCH 2/2] Update SDK from f6e2425 --- .github/workflows/auto-merge-release.yml | 35 ++ .github/workflows/release.yml | 34 ++ adhoc/client.go | 5 +- client/client.go | 5 +- containerimages/client.go | 5 +- core/request_option.go | 28 +- deployments/client.go | 5 +- documentindexes/client.go | 5 +- ee/automation/.nvmrc | 1 + ee/automation/README.md | 11 + ee/automation/ci-workflow-server.yaml | 46 ++ ee/automation/package-lock.json | 517 +++++++++++++++++++ ee/automation/package.json | 18 + ee/automation/src/auth.ts | 33 ++ ee/automation/src/auto-merge.ts | 149 ++++++ ee/automation/src/create-release.ts | 52 ++ ee/automation/src/upgrade-workflow-server.ts | 30 ++ ee/automation/src/utils.ts | 36 ++ ee/automation/tsconfig.json | 34 ++ environments/client.go | 5 +- events/client.go | 5 +- folderentities/client.go | 5 +- go.mod | 2 + integrationauthconfigs/client.go | 5 +- integrationproviders/client.go | 5 +- integrations/client.go | 5 +- metricdefinitions/client.go | 5 +- mlmodels/client.go | 5 +- option/request_option.go | 3 +- organizations/client.go | 5 +- prompts/client.go | 5 +- sandboxes/client.go | 5 +- testsuiteruns/client.go | 5 +- testsuites/client.go | 5 +- uploadedfiles/client.go | 5 +- workflowdeployments/client.go | 5 +- workflowexecutions/client.go | 5 +- workflows/client.go | 5 +- workflowsandboxes/client.go | 5 +- workspaces/client.go | 5 +- workspacesecrets/client.go | 5 +- 41 files changed, 1074 insertions(+), 80 deletions(-) create mode 100644 .github/workflows/auto-merge-release.yml create mode 100644 .github/workflows/release.yml create mode 100644 ee/automation/.nvmrc create mode 100644 ee/automation/README.md create mode 100644 ee/automation/ci-workflow-server.yaml create mode 100644 ee/automation/package-lock.json create mode 100644 ee/automation/package.json create mode 100644 ee/automation/src/auth.ts create mode 100644 ee/automation/src/auto-merge.ts create mode 100644 ee/automation/src/create-release.ts create mode 100644 ee/automation/src/upgrade-workflow-server.ts create mode 100644 ee/automation/src/utils.ts create mode 100644 ee/automation/tsconfig.json diff --git a/.github/workflows/auto-merge-release.yml b/.github/workflows/auto-merge-release.yml new file mode 100644 index 00000000..a5ed738b --- /dev/null +++ b/.github/workflows/auto-merge-release.yml @@ -0,0 +1,35 @@ +# This GitHub Action is managed by the Vellum SDK Generator Repo and copied into each SDK repository. +name: Auto-merge Release PRs + +on: + pull_request: + types: [labeled, synchronize] + branches: + - main + +jobs: + auto-merge: + runs-on: ubuntu-latest + if: contains(github.event.pull_request.labels.*.name, 'release') + steps: + - name: Checkout repo + uses: actions/checkout@v4 + + - name: Set up Node.js + uses: actions/setup-node@v3 + with: + node-version: "18.18.0" + + - name: Install dependencies + run: npm install + working-directory: ee/automation + + - name: Wait for checks and auto-merge + env: + VELLUM_AUTOMATION_APP_ID: ${{ secrets.VELLUM_AUTOMATION_APP_ID }} + VELLUM_AUTOMATION_PRIVATE_KEY: ${{ secrets.VELLUM_AUTOMATION_PRIVATE_KEY }} + VELLUM_AUTOMATION_INSTALLATION_ID: ${{ secrets.VELLUM_AUTOMATION_INSTALLATION_ID }} + PR_NUMBER: ${{ github.event.pull_request.number }} + HEAD_SHA: ${{ github.event.pull_request.head.sha }} + run: npm run auto-merge + working-directory: ee/automation diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..5de4db20 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,34 @@ +# This GitHub Action is managed by the Vellum SDK Generator Repo and copied into each SDK repository. +name: Release + +on: + pull_request: + types: [closed] + branches: + - main + workflow_dispatch: + +jobs: + create-release: + runs-on: ubuntu-latest + if: (github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'release')) || github.event_name == 'workflow_dispatch' + steps: + - name: Checkout repo + uses: actions/checkout@v4 + + - name: Set up Node.js + uses: actions/setup-node@v3 + with: + node-version: "18.18.0" + + - name: Install dependencies + run: npm install + working-directory: ee/automation + + - name: Create release + env: + VELLUM_AUTOMATION_APP_ID: ${{ secrets.VELLUM_AUTOMATION_APP_ID }} + VELLUM_AUTOMATION_PRIVATE_KEY: ${{ secrets.VELLUM_AUTOMATION_PRIVATE_KEY }} + VELLUM_AUTOMATION_INSTALLATION_ID: ${{ secrets.VELLUM_AUTOMATION_INSTALLATION_ID }} + run: npm run create-release + working-directory: ee/automation diff --git a/adhoc/client.go b/adhoc/client.go index b08a4246..68833fc9 100644 --- a/adhoc/client.go +++ b/adhoc/client.go @@ -12,7 +12,6 @@ import ( option "github.com/vellum-ai/vellum-client-go/option" io "io" http "net/http" - os "os" ) type Client struct { @@ -23,8 +22,8 @@ type Client struct { func NewClient(opts ...option.RequestOption) *Client { options := core.NewRequestOptions(opts...) - if options.ApiVersion == "" { - options.ApiVersion = os.Getenv("VELLUM_API_VERSION") + if options.ApiVersion == nil || *options.ApiVersion == "" { + options.ApiVersion = core.GetDefaultApiVersion() } return &Client{ baseURL: options.BaseURL, diff --git a/client/client.go b/client/client.go index 79ed7d47..27e9416a 100644 --- a/client/client.go +++ b/client/client.go @@ -37,7 +37,6 @@ import ( workspacesecrets "github.com/vellum-ai/vellum-client-go/workspacesecrets" io "io" http "net/http" - os "os" ) type Client struct { @@ -74,8 +73,8 @@ type Client struct { func NewClient(opts ...option.RequestOption) *Client { options := core.NewRequestOptions(opts...) - if options.ApiVersion == "" { - options.ApiVersion = os.Getenv("VELLUM_API_VERSION") + if options.ApiVersion == nil || *options.ApiVersion == "" { + options.ApiVersion = core.GetDefaultApiVersion() } return &Client{ baseURL: options.BaseURL, diff --git a/containerimages/client.go b/containerimages/client.go index 9ed2e199..11164aa8 100644 --- a/containerimages/client.go +++ b/containerimages/client.go @@ -8,7 +8,6 @@ import ( core "github.com/vellum-ai/vellum-client-go/core" option "github.com/vellum-ai/vellum-client-go/option" http "net/http" - os "os" ) type Client struct { @@ -19,8 +18,8 @@ type Client struct { func NewClient(opts ...option.RequestOption) *Client { options := core.NewRequestOptions(opts...) - if options.ApiVersion == "" { - options.ApiVersion = os.Getenv("VELLUM_API_VERSION") + if options.ApiVersion == nil || *options.ApiVersion == "" { + options.ApiVersion = core.GetDefaultApiVersion() } return &Client{ baseURL: options.BaseURL, diff --git a/core/request_option.go b/core/request_option.go index e3ef64e6..beca6524 100644 --- a/core/request_option.go +++ b/core/request_option.go @@ -4,11 +4,20 @@ package core import ( fmt "fmt" - vellumclientgo "github.com/vellum-ai/vellum-client-go" + "os" http "net/http" url "net/url" ) +// * `2024-10-25` - V2024_10_25 +// * `2025-07-30` - V2025_07_30 +type ApiVersionEnum string + +const ( + ApiVersionEnumTwoThousandTwentyFour1025 ApiVersionEnum = "2024-10-25" + ApiVersionEnumTwoThousandTwentyFive0730 ApiVersionEnum = "2025-07-30" +) + // RequestOption adapts the behavior of the client or an individual request. type RequestOption interface { applyRequestOptions(*RequestOptions) @@ -26,7 +35,7 @@ type RequestOptions struct { QueryParameters url.Values MaxAttempts uint ApiKey string - ApiVersion *vellumclientgo.ApiVersionEnum + ApiVersion *ApiVersionEnum } // NewRequestOptions returns a new *RequestOptions value. @@ -131,9 +140,22 @@ func (a *ApiKeyOption) applyRequestOptions(opts *RequestOptions) { // ApiVersionOption implements the RequestOption interface. type ApiVersionOption struct { - ApiVersion *vellumclientgo.ApiVersionEnum + ApiVersion *ApiVersionEnum } func (a *ApiVersionOption) applyRequestOptions(opts *RequestOptions) { opts.ApiVersion = a.ApiVersion } + +func getEnvWithDefault(key, defaultValue string) string { + if value := os.Getenv(key); value != "" { + return value + } + return defaultValue +} + +func GetDefaultApiVersion() *ApiVersionEnum { + envVersion := getEnvWithDefault("VELLUM_API_VERSION", "2025-07-30") + apiVersion := ApiVersionEnum(envVersion) + return &apiVersion +} diff --git a/deployments/client.go b/deployments/client.go index 9094b572..2cb70cd6 100644 --- a/deployments/client.go +++ b/deployments/client.go @@ -12,7 +12,6 @@ import ( option "github.com/vellum-ai/vellum-client-go/option" io "io" http "net/http" - os "os" ) type Client struct { @@ -23,8 +22,8 @@ type Client struct { func NewClient(opts ...option.RequestOption) *Client { options := core.NewRequestOptions(opts...) - if options.ApiVersion == "" { - options.ApiVersion = os.Getenv("VELLUM_API_VERSION") + if options.ApiVersion == nil || *options.ApiVersion == "" { + options.ApiVersion = core.GetDefaultApiVersion() } return &Client{ baseURL: options.BaseURL, diff --git a/documentindexes/client.go b/documentindexes/client.go index f01b8fd3..83558f54 100644 --- a/documentindexes/client.go +++ b/documentindexes/client.go @@ -8,7 +8,6 @@ import ( core "github.com/vellum-ai/vellum-client-go/core" option "github.com/vellum-ai/vellum-client-go/option" http "net/http" - os "os" ) type Client struct { @@ -19,8 +18,8 @@ type Client struct { func NewClient(opts ...option.RequestOption) *Client { options := core.NewRequestOptions(opts...) - if options.ApiVersion == "" { - options.ApiVersion = os.Getenv("VELLUM_API_VERSION") + if options.ApiVersion == nil || *options.ApiVersion == "" { + options.ApiVersion = core.GetDefaultApiVersion() } return &Client{ baseURL: options.BaseURL, diff --git a/ee/automation/.nvmrc b/ee/automation/.nvmrc new file mode 100644 index 00000000..6aab9b43 --- /dev/null +++ b/ee/automation/.nvmrc @@ -0,0 +1 @@ +v18.18.0 diff --git a/ee/automation/README.md b/ee/automation/README.md new file mode 100644 index 00000000..87a9135d --- /dev/null +++ b/ee/automation/README.md @@ -0,0 +1,11 @@ +# Vellum SDK Automation + +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. + +## Scripts + +Here are all the scripts we support. + +### `npm run create-release` + +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. diff --git a/ee/automation/ci-workflow-server.yaml b/ee/automation/ci-workflow-server.yaml new file mode 100644 index 00000000..9d7476af --- /dev/null +++ b/ee/automation/ci-workflow-server.yaml @@ -0,0 +1,46 @@ +name: ci-workflow-server + +on: + push: + branches: + - main + tags: + - "*" + +jobs: + publish: + permissions: + contents: "read" + id-token: "write" + + if: github.event_name == 'push' && contains(github.ref, 'refs/tags/') + runs-on: ubuntu-latest + steps: + - name: Checkout repo + uses: actions/checkout@v4 + + - name: Set up Node.js + uses: actions/setup-node@v3 + with: + node-version: "18.18.0" + + - name: Install dependencies + run: npm install + working-directory: ee/automation + + - id: auth + uses: google-github-actions/auth@v2 + with: + token_format: "access_token" + create_credentials_file: true + workload_identity_provider: "projects/585775334980/locations/global/workloadIdentityPools/github-pool/providers/github-actions-provider" + service_account: "github-gcr-service-account@vocify-prod.iam.gserviceaccount.com" + access_token_lifetime: "1200s" + + - name: Bump Workflow Server + env: + VELLUM_AUTOMATION_APP_ID: ${{ secrets.VELLUM_AUTOMATION_APP_ID }} + VELLUM_AUTOMATION_PRIVATE_KEY: ${{ secrets.VELLUM_AUTOMATION_PRIVATE_KEY }} + VELLUM_AUTOMATION_INSTALLATION_ID: ${{ secrets.VELLUM_AUTOMATION_INSTALLATION_ID }} + run: npm run upgrade-workflow-server + working-directory: ee/automation diff --git a/ee/automation/package-lock.json b/ee/automation/package-lock.json new file mode 100644 index 00000000..e8b96e98 --- /dev/null +++ b/ee/automation/package-lock.json @@ -0,0 +1,517 @@ +{ + "name": "vellum-automation", + "version": "0.0.1", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "vellum-automation", + "version": "0.0.1", + "devDependencies": { + "@octokit/auth-app": "^7.1.4", + "@octokit/rest": "^21.1.0", + "@types/node": "^22.10.7", + "dotenv": "^16.4.7", + "ts-node": "^10.9.2", + "typescript": "^5.7.3" + } + }, + "node_modules/@cspotcode/source-map-support": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz", + "integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==", + "dev": true, + "dependencies": { + "@jridgewell/trace-mapping": "0.3.9" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/@jridgewell/resolve-uri": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", + "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", + "dev": true, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz", + "integrity": "sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==", + "dev": true + }, + "node_modules/@jridgewell/trace-mapping": { + "version": "0.3.9", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz", + "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==", + "dev": true, + "dependencies": { + "@jridgewell/resolve-uri": "^3.0.3", + "@jridgewell/sourcemap-codec": "^1.4.10" + } + }, + "node_modules/@octokit/auth-app": { + "version": "7.1.4", + "resolved": "https://registry.npmjs.org/@octokit/auth-app/-/auth-app-7.1.4.tgz", + "integrity": "sha512-5F+3l/maq9JfWQ4bV28jT2G/K8eu9OJ317yzXPTGe4Kw+lKDhFaS4dQ3Ltmb6xImKxfCQdqDqMXODhc9YLipLw==", + "dev": true, + "dependencies": { + "@octokit/auth-oauth-app": "^8.1.2", + "@octokit/auth-oauth-user": "^5.1.2", + "@octokit/request": "^9.1.4", + "@octokit/request-error": "^6.1.6", + "@octokit/types": "^13.6.2", + "toad-cache": "^3.7.0", + "universal-github-app-jwt": "^2.2.0", + "universal-user-agent": "^7.0.0" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/@octokit/auth-oauth-app": { + "version": "8.1.2", + "resolved": "https://registry.npmjs.org/@octokit/auth-oauth-app/-/auth-oauth-app-8.1.2.tgz", + "integrity": "sha512-3woNZgq5/S6RS+9ZTq+JdymxVr7E0s4EYxF20ugQvgX3pomdPUL5r/XdTY9wALoBM2eHVy4ettr5fKpatyTyHw==", + "dev": true, + "dependencies": { + "@octokit/auth-oauth-device": "^7.1.2", + "@octokit/auth-oauth-user": "^5.1.2", + "@octokit/request": "^9.1.4", + "@octokit/types": "^13.6.2", + "universal-user-agent": "^7.0.0" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/@octokit/auth-oauth-device": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/@octokit/auth-oauth-device/-/auth-oauth-device-7.1.2.tgz", + "integrity": "sha512-gTOIzDeV36OhVfxCl69FmvJix7tJIiU6dlxuzLVAzle7fYfO8UDyddr9B+o4CFQVaMBLMGZ9ak2CWMYcGeZnPw==", + "dev": true, + "dependencies": { + "@octokit/oauth-methods": "^5.1.3", + "@octokit/request": "^9.1.4", + "@octokit/types": "^13.6.2", + "universal-user-agent": "^7.0.0" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/@octokit/auth-oauth-user": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/@octokit/auth-oauth-user/-/auth-oauth-user-5.1.2.tgz", + "integrity": "sha512-PgVDDPJgZYb3qSEXK4moksA23tfn68zwSAsQKZ1uH6IV9IaNEYx35OXXI80STQaLYnmEE86AgU0tC1YkM4WjsA==", + "dev": true, + "dependencies": { + "@octokit/auth-oauth-device": "^7.1.2", + "@octokit/oauth-methods": "^5.1.2", + "@octokit/request": "^9.1.4", + "@octokit/types": "^13.6.2", + "universal-user-agent": "^7.0.0" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/@octokit/auth-token": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/@octokit/auth-token/-/auth-token-5.1.1.tgz", + "integrity": "sha512-rh3G3wDO8J9wSjfI436JUKzHIxq8NaiL0tVeB2aXmG6p/9859aUOAjA9pmSPNGGZxfwmaJ9ozOJImuNVJdpvbA==", + "dev": true, + "engines": { + "node": ">= 18" + } + }, + "node_modules/@octokit/core": { + "version": "6.1.3", + "resolved": "https://registry.npmjs.org/@octokit/core/-/core-6.1.3.tgz", + "integrity": "sha512-z+j7DixNnfpdToYsOutStDgeRzJSMnbj8T1C/oQjB6Aa+kRfNjs/Fn7W6c8bmlt6mfy3FkgeKBRnDjxQow5dow==", + "dev": true, + "dependencies": { + "@octokit/auth-token": "^5.0.0", + "@octokit/graphql": "^8.1.2", + "@octokit/request": "^9.1.4", + "@octokit/request-error": "^6.1.6", + "@octokit/types": "^13.6.2", + "before-after-hook": "^3.0.2", + "universal-user-agent": "^7.0.0" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/@octokit/endpoint": { + "version": "10.1.2", + "resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-10.1.2.tgz", + "integrity": "sha512-XybpFv9Ms4hX5OCHMZqyODYqGTZ3H6K6Vva+M9LR7ib/xr1y1ZnlChYv9H680y77Vd/i/k+thXApeRASBQkzhA==", + "dev": true, + "dependencies": { + "@octokit/types": "^13.6.2", + "universal-user-agent": "^7.0.2" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/@octokit/graphql": { + "version": "8.1.2", + "resolved": "https://registry.npmjs.org/@octokit/graphql/-/graphql-8.1.2.tgz", + "integrity": "sha512-bdlj/CJVjpaz06NBpfHhp4kGJaRZfz7AzC+6EwUImRtrwIw8dIgJ63Xg0OzV9pRn3rIzrt5c2sa++BL0JJ8GLw==", + "dev": true, + "dependencies": { + "@octokit/request": "^9.1.4", + "@octokit/types": "^13.6.2", + "universal-user-agent": "^7.0.0" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/@octokit/oauth-authorization-url": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/@octokit/oauth-authorization-url/-/oauth-authorization-url-7.1.1.tgz", + "integrity": "sha512-ooXV8GBSabSWyhLUowlMIVd9l1s2nsOGQdlP2SQ4LnkEsGXzeCvbSbCPdZThXhEFzleGPwbapT0Sb+YhXRyjCA==", + "dev": true, + "engines": { + "node": ">= 18" + } + }, + "node_modules/@octokit/oauth-methods": { + "version": "5.1.3", + "resolved": "https://registry.npmjs.org/@octokit/oauth-methods/-/oauth-methods-5.1.3.tgz", + "integrity": "sha512-M+bDBi5H8FnH0xhCTg0m9hvcnppdDnxUqbZyOkxlLblKpLAR+eT2nbDPvJDp0eLrvJWA1I8OX0KHf/sBMQARRA==", + "dev": true, + "dependencies": { + "@octokit/oauth-authorization-url": "^7.0.0", + "@octokit/request": "^9.1.4", + "@octokit/request-error": "^6.1.6", + "@octokit/types": "^13.6.2" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/@octokit/openapi-types": { + "version": "23.0.1", + "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-23.0.1.tgz", + "integrity": "sha512-izFjMJ1sir0jn0ldEKhZ7xegCTj/ObmEDlEfpFrx4k/JyZSMRHbO3/rBwgE7f3m2DHt+RrNGIVw4wSmwnm3t/g==", + "dev": true + }, + "node_modules/@octokit/plugin-paginate-rest": { + "version": "11.4.0", + "resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-11.4.0.tgz", + "integrity": "sha512-ttpGck5AYWkwMkMazNCZMqxKqIq1fJBNxBfsFwwfyYKTf914jKkLF0POMS3YkPBwp5g1c2Y4L79gDz01GhSr1g==", + "dev": true, + "dependencies": { + "@octokit/types": "^13.7.0" + }, + "engines": { + "node": ">= 18" + }, + "peerDependencies": { + "@octokit/core": ">=6" + } + }, + "node_modules/@octokit/plugin-request-log": { + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/@octokit/plugin-request-log/-/plugin-request-log-5.3.1.tgz", + "integrity": "sha512-n/lNeCtq+9ofhC15xzmJCNKP2BWTv8Ih2TTy+jatNCCq/gQP/V7rK3fjIfuz0pDWDALO/o/4QY4hyOF6TQQFUw==", + "dev": true, + "engines": { + "node": ">= 18" + }, + "peerDependencies": { + "@octokit/core": ">=6" + } + }, + "node_modules/@octokit/plugin-rest-endpoint-methods": { + "version": "13.3.0", + "resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-13.3.0.tgz", + "integrity": "sha512-LUm44shlmkp/6VC+qQgHl3W5vzUP99ZM54zH6BuqkJK4DqfFLhegANd+fM4YRLapTvPm4049iG7F3haANKMYvQ==", + "dev": true, + "dependencies": { + "@octokit/types": "^13.7.0" + }, + "engines": { + "node": ">= 18" + }, + "peerDependencies": { + "@octokit/core": ">=6" + } + }, + "node_modules/@octokit/request": { + "version": "9.1.4", + "resolved": "https://registry.npmjs.org/@octokit/request/-/request-9.1.4.tgz", + "integrity": "sha512-tMbOwGm6wDII6vygP3wUVqFTw3Aoo0FnVQyhihh8vVq12uO3P+vQZeo2CKMpWtPSogpACD0yyZAlVlQnjW71DA==", + "dev": true, + "dependencies": { + "@octokit/endpoint": "^10.0.0", + "@octokit/request-error": "^6.0.1", + "@octokit/types": "^13.6.2", + "fast-content-type-parse": "^2.0.0", + "universal-user-agent": "^7.0.2" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/@octokit/request-error": { + "version": "6.1.6", + "resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-6.1.6.tgz", + "integrity": "sha512-pqnVKYo/at0NuOjinrgcQYpEbv4snvP3bKMRqHaD9kIsk9u1LCpb2smHZi8/qJfgeNqLo5hNW4Z7FezNdEo0xg==", + "dev": true, + "dependencies": { + "@octokit/types": "^13.6.2" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/@octokit/rest": { + "version": "21.1.0", + "resolved": "https://registry.npmjs.org/@octokit/rest/-/rest-21.1.0.tgz", + "integrity": "sha512-93iLxcKDJboUpmnUyeJ6cRIi7z7cqTZT1K7kRK4LobGxwTwpsa+2tQQbRQNGy7IFDEAmrtkf4F4wBj3D5rVlJQ==", + "dev": true, + "dependencies": { + "@octokit/core": "^6.1.3", + "@octokit/plugin-paginate-rest": "^11.4.0", + "@octokit/plugin-request-log": "^5.3.1", + "@octokit/plugin-rest-endpoint-methods": "^13.3.0" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/@octokit/types": { + "version": "13.7.0", + "resolved": "https://registry.npmjs.org/@octokit/types/-/types-13.7.0.tgz", + "integrity": "sha512-BXfRP+3P3IN6fd4uF3SniaHKOO4UXWBfkdR3vA8mIvaoO/wLjGN5qivUtW0QRitBHHMcfC41SLhNVYIZZE+wkA==", + "dev": true, + "dependencies": { + "@octokit/openapi-types": "^23.0.1" + } + }, + "node_modules/@tsconfig/node10": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.11.tgz", + "integrity": "sha512-DcRjDCujK/kCk/cUe8Xz8ZSpm8mS3mNNpta+jGCA6USEDfktlNvm1+IuZ9eTcDbNk41BHwpHHeW+N1lKCz4zOw==", + "dev": true + }, + "node_modules/@tsconfig/node12": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz", + "integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==", + "dev": true + }, + "node_modules/@tsconfig/node14": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz", + "integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==", + "dev": true + }, + "node_modules/@tsconfig/node16": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.4.tgz", + "integrity": "sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==", + "dev": true + }, + "node_modules/@types/node": { + "version": "22.10.7", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.10.7.tgz", + "integrity": "sha512-V09KvXxFiutGp6B7XkpaDXlNadZxrzajcY50EuoLIpQ6WWYCSvf19lVIazzfIzQvhUN2HjX12spLojTnhuKlGg==", + "dev": true, + "dependencies": { + "undici-types": "~6.20.0" + } + }, + "node_modules/acorn": { + "version": "8.14.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.14.0.tgz", + "integrity": "sha512-cl669nCJTZBsL97OF4kUQm5g5hC2uihk0NxY3WENAC0TYdILVkAyHymAntgxGkl7K+t0cXIrH5siy5S4XkFycA==", + "dev": true, + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/acorn-walk": { + "version": "8.3.4", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.3.4.tgz", + "integrity": "sha512-ueEepnujpqee2o5aIYnvHU6C0A42MNdsIDeqy5BydrkuC5R1ZuUFnm27EeFJGoEHJQgn3uleRvmTXaJgfXbt4g==", + "dev": true, + "dependencies": { + "acorn": "^8.11.0" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/arg": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", + "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", + "dev": true + }, + "node_modules/before-after-hook": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/before-after-hook/-/before-after-hook-3.0.2.tgz", + "integrity": "sha512-Nik3Sc0ncrMK4UUdXQmAnRtzmNQTAAXmXIopizwZ1W1t8QmfJj+zL4OA2I7XPTPW5z5TDqv4hRo/JzouDJnX3A==", + "dev": true + }, + "node_modules/create-require": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", + "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", + "dev": true + }, + "node_modules/diff": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", + "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", + "dev": true, + "engines": { + "node": ">=0.3.1" + } + }, + "node_modules/dotenv": { + "version": "16.4.7", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.4.7.tgz", + "integrity": "sha512-47qPchRCykZC03FhkYAhrvwU4xDBFIj1QPqaarj6mdM/hgUzfPHcpkHJOn3mJAufFeeAxAzeGsr5X0M4k6fLZQ==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://dotenvx.com" + } + }, + "node_modules/fast-content-type-parse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/fast-content-type-parse/-/fast-content-type-parse-2.0.1.tgz", + "integrity": "sha512-nGqtvLrj5w0naR6tDPfB4cUmYCqouzyQiz6C5y/LtcDllJdrcc6WaWW6iXyIIOErTa/XRybj28aasdn4LkVk6Q==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/fastify" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/fastify" + } + ] + }, + "node_modules/make-error": { + "version": "1.3.6", + "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", + "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", + "dev": true + }, + "node_modules/toad-cache": { + "version": "3.7.0", + "resolved": "https://registry.npmjs.org/toad-cache/-/toad-cache-3.7.0.tgz", + "integrity": "sha512-/m8M+2BJUpoJdgAHoG+baCwBT+tf2VraSfkBgl0Y00qIWt41DJ8R5B8nsEw0I58YwF5IZH6z24/2TobDKnqSWw==", + "dev": true, + "engines": { + "node": ">=12" + } + }, + "node_modules/ts-node": { + "version": "10.9.2", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.2.tgz", + "integrity": "sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==", + "dev": true, + "dependencies": { + "@cspotcode/source-map-support": "^0.8.0", + "@tsconfig/node10": "^1.0.7", + "@tsconfig/node12": "^1.0.7", + "@tsconfig/node14": "^1.0.0", + "@tsconfig/node16": "^1.0.2", + "acorn": "^8.4.1", + "acorn-walk": "^8.1.1", + "arg": "^4.1.0", + "create-require": "^1.1.0", + "diff": "^4.0.1", + "make-error": "^1.1.1", + "v8-compile-cache-lib": "^3.0.1", + "yn": "3.1.1" + }, + "bin": { + "ts-node": "dist/bin.js", + "ts-node-cwd": "dist/bin-cwd.js", + "ts-node-esm": "dist/bin-esm.js", + "ts-node-script": "dist/bin-script.js", + "ts-node-transpile-only": "dist/bin-transpile.js", + "ts-script": "dist/bin-script-deprecated.js" + }, + "peerDependencies": { + "@swc/core": ">=1.2.50", + "@swc/wasm": ">=1.2.50", + "@types/node": "*", + "typescript": ">=2.7" + }, + "peerDependenciesMeta": { + "@swc/core": { + "optional": true + }, + "@swc/wasm": { + "optional": true + } + } + }, + "node_modules/typescript": { + "version": "5.7.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.7.3.tgz", + "integrity": "sha512-84MVSjMEHP+FQRPy3pX9sTVV/INIex71s9TL2Gm5FG/WG1SqXeKyZ0k7/blY/4FdOzI12CBy1vGc4og/eus0fw==", + "dev": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/undici-types": { + "version": "6.20.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.20.0.tgz", + "integrity": "sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg==", + "dev": true + }, + "node_modules/universal-github-app-jwt": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/universal-github-app-jwt/-/universal-github-app-jwt-2.2.0.tgz", + "integrity": "sha512-G5o6f95b5BggDGuUfKDApKaCgNYy2x7OdHY0zSMF081O0EJobw+1130VONhrA7ezGSV2FNOGyM+KQpQZAr9bIQ==", + "dev": true + }, + "node_modules/universal-user-agent": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-7.0.2.tgz", + "integrity": "sha512-0JCqzSKnStlRRQfCdowvqy3cy0Dvtlb8xecj/H8JFZuCze4rwjPZQOgvFvn0Ws/usCHQFGpyr+pB9adaGwXn4Q==", + "dev": true + }, + "node_modules/v8-compile-cache-lib": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz", + "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==", + "dev": true + }, + "node_modules/yn": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", + "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", + "dev": true, + "engines": { + "node": ">=6" + } + } + } +} diff --git a/ee/automation/package.json b/ee/automation/package.json new file mode 100644 index 00000000..ab9cce98 --- /dev/null +++ b/ee/automation/package.json @@ -0,0 +1,18 @@ +{ + "name": "vellum-automation", + "version": "0.0.1", + "type": "module", + "scripts": { + "create-release": "ts-node-esm ./src/create-release.ts", + "upgrade-workflow-server": "ts-node-esm ./src/upgrade-workflow-server.ts", + "auto-merge": "ts-node-esm ./src/auto-merge.ts" + }, + "devDependencies": { + "@octokit/auth-app": "^7.1.4", + "@octokit/rest": "^21.1.0", + "@types/node": "^22.10.7", + "dotenv": "^16.4.7", + "ts-node": "^10.9.2", + "typescript": "^5.7.3" + } +} diff --git a/ee/automation/src/auth.ts b/ee/automation/src/auth.ts new file mode 100644 index 00000000..8b8a43c0 --- /dev/null +++ b/ee/automation/src/auth.ts @@ -0,0 +1,33 @@ +import { createAppAuth } from "@octokit/auth-app"; + +export const getGithubToken = async () => { + const appId = process.env.VELLUM_AUTOMATION_APP_ID; + const privateKey = process.env.VELLUM_AUTOMATION_PRIVATE_KEY; + const installationId = process.env.VELLUM_AUTOMATION_INSTALLATION_ID; + + if (!appId || !privateKey || !installationId) { + throw new Error( + "VELLUM_AUTOMATION_APP_ID, VELLUM_AUTOMATION_PRIVATE_KEY, and VELLUM_AUTOMATION_INSTALLATION_ID must be set" + ); + } + + if ( + !privateKey.startsWith("-----BEGIN RSA PRIVATE KEY-----") || + !privateKey.endsWith("-----END RSA PRIVATE KEY-----") + ) { + throw new Error( + `VELLUM_AUTOMATION_PRIVATE_KEY is an invalid. Please use the valid private key from \ +1password and store in your .env file. Also be sure to \`unset\` any VELLUM_AUTOMATION_* \ +env vars from your shell before running the script again.` + ); + } + + const auth = createAppAuth({ + appId, + privateKey, + installationId, + }); + + const { token } = await auth({ type: "installation" }); + return token; +}; diff --git a/ee/automation/src/auto-merge.ts b/ee/automation/src/auto-merge.ts new file mode 100644 index 00000000..08525b4d --- /dev/null +++ b/ee/automation/src/auto-merge.ts @@ -0,0 +1,149 @@ +import { Octokit } from '@octokit/rest'; +import { getGithubToken } from './auth.js'; +import * as dotenv from 'dotenv'; + +dotenv.config(); + +const SDK_REPO = "vellum-client-go"; +const PR_NUMBER = parseInt(process.env.PR_NUMBER || '0'); +const HEAD_SHA = process.env.HEAD_SHA; + +const POLL_INTERVAL = 30000; // 30 seconds +const MAX_WAIT_TIME = 30 * 60 * 1000; // 30 minutes + +interface CheckRun { + status: string; + conclusion: string | null; + name: string; +} + +const isAutoMergeCheck = (checkName: string): boolean => { + return checkName.toLowerCase().includes('auto-merge'); +}; + +const main = async () => { + if (!SDK_REPO || !PR_NUMBER || !HEAD_SHA) { + throw new Error('Missing required environment variables: FERN_SDK_REPO, PR_NUMBER, HEAD_SHA'); + } + + console.log(`Starting auto-merge process for PR #${PR_NUMBER} in ${SDK_REPO}`); + console.log(`Head SHA: ${HEAD_SHA}`); + + const auth = await getGithubToken(); + const octokit = new Octokit({ auth }); + + const owner = "vellum-ai"; + const repo = SDK_REPO; + + const { data: pr } = await octokit.rest.pulls.get({ + owner, + repo, + pull_number: PR_NUMBER, + }); + + if (!pr.labels.some(label => label.name === 'release')) { + console.log('PR does not have release label, skipping auto-merge'); + return; + } + + if (pr.state !== 'open') { + console.log(`PR is ${pr.state}, skipping auto-merge`); + return; + } + + if (pr.user?.login !== 'fern-api' && pr.user?.login !== 'fern-api[bot]') { + console.log(`PR was not opened by fern-api user (opened by: ${pr.user?.login}), skipping auto-merge`); + return; + } + + console.log(`PR #${PR_NUMBER} is open, has release label, and was opened by authorized user (${pr.user?.login}), waiting for checks...`); + + const startTime = Date.now(); + + while (Date.now() - startTime < MAX_WAIT_TIME) { + try { + const { data: checkRuns } = await octokit.rest.checks.listForRef({ + owner, + repo, + ref: HEAD_SHA, + }); + + console.log(`Found ${checkRuns.total_count} check runs`); + + const checks: CheckRun[] = checkRuns.check_runs.map(run => ({ + status: run.status, + conclusion: run.conclusion, + name: run.name, + })); + + const autoMergeChecks = checks.filter(check => isAutoMergeCheck(check.name)); + if (autoMergeChecks.length > 0) { + console.log(`Excluding ${autoMergeChecks.length} auto-merge checks:`, + autoMergeChecks.map(c => c.name).join(', ')); + } + + if (checkRuns.total_count === 0) { + console.log('No check runs found, waiting...'); + await sleep(POLL_INTERVAL); + continue; + } + + const pendingChecks = checks.filter(check => + check.status !== 'completed' && !isAutoMergeCheck(check.name) + ); + if (pendingChecks.length > 0) { + console.log(`Waiting for ${pendingChecks.length} checks to complete:`, + pendingChecks.map(c => c.name).join(', ')); + await sleep(POLL_INTERVAL); + continue; + } + + const failedChecks = checks.filter(check => + check.conclusion !== 'success' && + check.conclusion !== 'neutral' && + check.conclusion !== 'skipped' && + !isAutoMergeCheck(check.name) + ); + + if (failedChecks.length > 0) { + console.log('Some checks failed, cannot auto-merge:'); + failedChecks.forEach(check => { + console.log(` - ${check.name}: ${check.conclusion}`); + }); + return; + } + + console.log('All checks passed! Attempting to merge PR...'); + + try { + await octokit.rest.pulls.merge({ + owner, + repo, + pull_number: PR_NUMBER, + merge_method: 'squash', + commit_title: `${pr.title} (#${PR_NUMBER})`, + }); + + console.log(`Successfully auto-merged PR #${PR_NUMBER}`); + return; + } catch (mergeError: any) { + if (mergeError.status === 405) { + console.log('PR cannot be merged (may have conflicts or branch protection rules)'); + } else { + console.error('Error merging PR:', mergeError.message); + } + return; + } + + } catch (error: any) { + console.error('Error checking status:', error.message); + await sleep(POLL_INTERVAL); + } + } + + console.log('Timeout reached, stopping auto-merge process'); +}; + +const sleep = (ms: number) => new Promise(resolve => setTimeout(resolve, ms)); + +main().catch(console.error); diff --git a/ee/automation/src/create-release.ts b/ee/automation/src/create-release.ts new file mode 100644 index 00000000..ef34e57f --- /dev/null +++ b/ee/automation/src/create-release.ts @@ -0,0 +1,52 @@ +import { Octokit } from '@octokit/rest'; +import { getGithubToken } from './auth.js'; +import dotenv from 'dotenv'; +import { getVersion } from './utils.js'; + +dotenv.config(); + +const SDK_REPO = "vellum-client-go"; + +const main = async () => { + const version = getVersion(); + + // Create the release + const auth = await getGithubToken(); + const octokit = new Octokit({ + auth, + }); + + const sdkReleases = await octokit.rest.repos.listReleases({ + owner: "vellum-ai", + repo: SDK_REPO, + }); + if (sdkReleases.data.find((release) => release.name === version)) { + throw new Error(`Release '${version}' already exists in '${SDK_REPO}'`); + } + + const generatorReleases = await octokit.rest.repos.listReleases({ + owner: "vellum-ai", + repo: "vellum-client-generator", + }); + const targetedRelease = generatorReleases.data.find( + (release) => release.name === version + ); + if (!targetedRelease?.body) { + throw new Error( + `Release '${version}' does not exist in 'vellum-client-generator'` + ); + } + + await octokit.rest.repos.createRelease({ + owner: "vellum-ai", + repo: SDK_REPO, + tag_name: version, + make_latest: "true", + name: version, + body: targetedRelease.body, + }); + + console.log(`Successfully created release '${version}'`); +}; + +main(); diff --git a/ee/automation/src/upgrade-workflow-server.ts b/ee/automation/src/upgrade-workflow-server.ts new file mode 100644 index 00000000..45a49d0f --- /dev/null +++ b/ee/automation/src/upgrade-workflow-server.ts @@ -0,0 +1,30 @@ +import { Octokit } from "@octokit/rest"; +import { getGithubToken } from './auth.js'; +import { getVersion } from './utils.js'; + +/* + * This triggers the workflow server version release and lives here for convenience + * so it can take advantage of the existing github app auth token. + */ +const main = async () => { + const version = getVersion(); + console.log("Upgrading workflow server to version", version); + const octokit = new Octokit({ auth: await getGithubToken() }); + await octokit.actions.createWorkflowDispatch({ + owner: "vellum-ai", + repo: "vembda-service", + workflow_id: "version-python-workflow-server.yaml", + ref: "main", + inputs: { + version, + }, + }); + + console.log( + "Successfully triggered workflow server github workflow, version:", + version + ); + process.exit(0); +}; + +main(); diff --git a/ee/automation/src/utils.ts b/ee/automation/src/utils.ts new file mode 100644 index 00000000..18e41a04 --- /dev/null +++ b/ee/automation/src/utils.ts @@ -0,0 +1,36 @@ +import { fileURLToPath } from 'url'; +import path from 'path'; +import fs from 'fs'; + +export function getVersion() { + // Read and parse manifest file from environment variable + const __filename = fileURLToPath(import.meta.url); + const __dirname = path.dirname(__filename); + + const manifestFile = "go.mod"; + if (!manifestFile) { + throw new Error('FERN_MANIFEST_FILE environment variable is required'); + } + + const manifestPath = path.join(__dirname, '..', '..', '..', manifestFile); + const manifestContent = fs.readFileSync(manifestPath, 'utf8'); + + // Extract version using regex from environment variable + const versionRegexPattern = "// Version:\\s+v([0-9]+\\.[0-9]+\\.[0-9]+)"; + if (!versionRegexPattern) { + throw new Error('FERN_VERSION_REGEX environment variable is required'); + } + + const versionRegex = new RegExp(versionRegexPattern); + const version = manifestContent.match(versionRegex)?.[1]; + + if (!version) { + throw new Error(`Could not find version in ${manifestFile} using pattern ${versionRegexPattern}`); + } + + // Sanitize version by removing 'v' prefix if present + const sanitizedVersion = version.replace(/^v\.?/, ''); + + console.log('Found Version:', sanitizedVersion); + return sanitizedVersion; +} diff --git a/ee/automation/tsconfig.json b/ee/automation/tsconfig.json new file mode 100644 index 00000000..ed37b674 --- /dev/null +++ b/ee/automation/tsconfig.json @@ -0,0 +1,34 @@ +{ + "compilerOptions": { + "composite": true, + "outDir": "lib", + "module": "esnext", + "target": "esnext", + "lib": ["dom", "dom.iterable", "esnext"], + "jsx": "react-jsx", + "moduleResolution": "node", + "resolveJsonModule": true, + "noImplicitAny": true, + "noImplicitThis": true, + "skipLibCheck": true, + "noFallthroughCasesInSwitch": true, + "forceConsistentCasingInFileNames": true, + "esModuleInterop": true, + "allowSyntheticDefaultImports": true, + "strict": true, + "isolatedModules": true, + "baseUrl": "./src", + "paths": { + "src/*": ["*"] + }, + "declaration": true, + "noUncheckedIndexedAccess": true, + "noImplicitReturns": true, + "types": ["node"] + }, + "include": ["./src/**/*"], + "ts-node": { + "esm": true, + "experimentalSpecifierResolution": "node" + } +} diff --git a/environments/client.go b/environments/client.go index f4558c33..83e3e482 100644 --- a/environments/client.go +++ b/environments/client.go @@ -8,7 +8,6 @@ import ( core "github.com/vellum-ai/vellum-client-go/core" option "github.com/vellum-ai/vellum-client-go/option" http "net/http" - os "os" ) type Client struct { @@ -19,8 +18,8 @@ type Client struct { func NewClient(opts ...option.RequestOption) *Client { options := core.NewRequestOptions(opts...) - if options.ApiVersion == "" { - options.ApiVersion = os.Getenv("VELLUM_API_VERSION") + if options.ApiVersion == nil || *options.ApiVersion == "" { + options.ApiVersion = core.GetDefaultApiVersion() } return &Client{ baseURL: options.BaseURL, diff --git a/events/client.go b/events/client.go index 81e348e7..024922b7 100644 --- a/events/client.go +++ b/events/client.go @@ -12,7 +12,6 @@ import ( option "github.com/vellum-ai/vellum-client-go/option" io "io" http "net/http" - os "os" ) type Client struct { @@ -23,8 +22,8 @@ type Client struct { func NewClient(opts ...option.RequestOption) *Client { options := core.NewRequestOptions(opts...) - if options.ApiVersion == "" { - options.ApiVersion = os.Getenv("VELLUM_API_VERSION") + if options.ApiVersion == nil || *options.ApiVersion == "" { + options.ApiVersion = core.GetDefaultApiVersion() } return &Client{ baseURL: options.BaseURL, diff --git a/folderentities/client.go b/folderentities/client.go index 51592c6a..95d65fe4 100644 --- a/folderentities/client.go +++ b/folderentities/client.go @@ -8,7 +8,6 @@ import ( core "github.com/vellum-ai/vellum-client-go/core" option "github.com/vellum-ai/vellum-client-go/option" http "net/http" - os "os" ) type Client struct { @@ -19,8 +18,8 @@ type Client struct { func NewClient(opts ...option.RequestOption) *Client { options := core.NewRequestOptions(opts...) - if options.ApiVersion == "" { - options.ApiVersion = os.Getenv("VELLUM_API_VERSION") + if options.ApiVersion == nil || *options.ApiVersion == "" { + options.ApiVersion = core.GetDefaultApiVersion() } return &Client{ baseURL: options.BaseURL, diff --git a/go.mod b/go.mod index 5b80c85f..0691fbc6 100644 --- a/go.mod +++ b/go.mod @@ -1,5 +1,7 @@ module github.com/vellum-ai/vellum-client-go +// Version: v1.14.3 + go 1.18 require ( diff --git a/integrationauthconfigs/client.go b/integrationauthconfigs/client.go index 72d7c679..83f43b25 100644 --- a/integrationauthconfigs/client.go +++ b/integrationauthconfigs/client.go @@ -8,7 +8,6 @@ import ( core "github.com/vellum-ai/vellum-client-go/core" option "github.com/vellum-ai/vellum-client-go/option" http "net/http" - os "os" ) type Client struct { @@ -19,8 +18,8 @@ type Client struct { func NewClient(opts ...option.RequestOption) *Client { options := core.NewRequestOptions(opts...) - if options.ApiVersion == "" { - options.ApiVersion = os.Getenv("VELLUM_API_VERSION") + if options.ApiVersion == nil || *options.ApiVersion == "" { + options.ApiVersion = core.GetDefaultApiVersion() } return &Client{ baseURL: options.BaseURL, diff --git a/integrationproviders/client.go b/integrationproviders/client.go index 5ba3797b..5b827659 100644 --- a/integrationproviders/client.go +++ b/integrationproviders/client.go @@ -8,7 +8,6 @@ import ( core "github.com/vellum-ai/vellum-client-go/core" option "github.com/vellum-ai/vellum-client-go/option" http "net/http" - os "os" ) type Client struct { @@ -19,8 +18,8 @@ type Client struct { func NewClient(opts ...option.RequestOption) *Client { options := core.NewRequestOptions(opts...) - if options.ApiVersion == "" { - options.ApiVersion = os.Getenv("VELLUM_API_VERSION") + if options.ApiVersion == nil || *options.ApiVersion == "" { + options.ApiVersion = core.GetDefaultApiVersion() } return &Client{ baseURL: options.BaseURL, diff --git a/integrations/client.go b/integrations/client.go index 9197adc0..65417c58 100644 --- a/integrations/client.go +++ b/integrations/client.go @@ -12,7 +12,6 @@ import ( option "github.com/vellum-ai/vellum-client-go/option" io "io" http "net/http" - os "os" ) type Client struct { @@ -23,8 +22,8 @@ type Client struct { func NewClient(opts ...option.RequestOption) *Client { options := core.NewRequestOptions(opts...) - if options.ApiVersion == "" { - options.ApiVersion = os.Getenv("VELLUM_API_VERSION") + if options.ApiVersion == nil || *options.ApiVersion == "" { + options.ApiVersion = core.GetDefaultApiVersion() } return &Client{ baseURL: options.BaseURL, diff --git a/metricdefinitions/client.go b/metricdefinitions/client.go index c4aaf4a9..1b77c15d 100644 --- a/metricdefinitions/client.go +++ b/metricdefinitions/client.go @@ -8,7 +8,6 @@ import ( core "github.com/vellum-ai/vellum-client-go/core" option "github.com/vellum-ai/vellum-client-go/option" http "net/http" - os "os" ) type Client struct { @@ -19,8 +18,8 @@ type Client struct { func NewClient(opts ...option.RequestOption) *Client { options := core.NewRequestOptions(opts...) - if options.ApiVersion == "" { - options.ApiVersion = os.Getenv("VELLUM_API_VERSION") + if options.ApiVersion == nil || *options.ApiVersion == "" { + options.ApiVersion = core.GetDefaultApiVersion() } return &Client{ baseURL: options.BaseURL, diff --git a/mlmodels/client.go b/mlmodels/client.go index e4098c39..9ca6c308 100644 --- a/mlmodels/client.go +++ b/mlmodels/client.go @@ -8,7 +8,6 @@ import ( core "github.com/vellum-ai/vellum-client-go/core" option "github.com/vellum-ai/vellum-client-go/option" http "net/http" - os "os" ) type Client struct { @@ -19,8 +18,8 @@ type Client struct { func NewClient(opts ...option.RequestOption) *Client { options := core.NewRequestOptions(opts...) - if options.ApiVersion == "" { - options.ApiVersion = os.Getenv("VELLUM_API_VERSION") + if options.ApiVersion == nil || *options.ApiVersion == "" { + options.ApiVersion = core.GetDefaultApiVersion() } return &Client{ baseURL: options.BaseURL, diff --git a/option/request_option.go b/option/request_option.go index effcadb5..c3764dbb 100644 --- a/option/request_option.go +++ b/option/request_option.go @@ -3,7 +3,6 @@ package option import ( - vellumclientgo "github.com/vellum-ai/vellum-client-go" core "github.com/vellum-ai/vellum-client-go/core" http "net/http" url "net/url" @@ -72,7 +71,7 @@ func WithApiKey(apiKey string) *core.ApiKeyOption { } // WithApiVersion sets the apiVersion request header. -func WithApiVersion(apiVersion *vellumclientgo.ApiVersionEnum) *core.ApiVersionOption { +func WithApiVersion(apiVersion *core.ApiVersionEnum) *core.ApiVersionOption { return &core.ApiVersionOption{ ApiVersion: apiVersion, } diff --git a/organizations/client.go b/organizations/client.go index 51c5b406..ba8f72d3 100644 --- a/organizations/client.go +++ b/organizations/client.go @@ -8,7 +8,6 @@ import ( core "github.com/vellum-ai/vellum-client-go/core" option "github.com/vellum-ai/vellum-client-go/option" http "net/http" - os "os" ) type Client struct { @@ -19,8 +18,8 @@ type Client struct { func NewClient(opts ...option.RequestOption) *Client { options := core.NewRequestOptions(opts...) - if options.ApiVersion == "" { - options.ApiVersion = os.Getenv("VELLUM_API_VERSION") + if options.ApiVersion == nil || *options.ApiVersion == "" { + options.ApiVersion = core.GetDefaultApiVersion() } return &Client{ baseURL: options.BaseURL, diff --git a/prompts/client.go b/prompts/client.go index bab13a43..32006396 100644 --- a/prompts/client.go +++ b/prompts/client.go @@ -13,7 +13,6 @@ import ( option "github.com/vellum-ai/vellum-client-go/option" io "io" http "net/http" - os "os" ) type Client struct { @@ -24,8 +23,8 @@ type Client struct { func NewClient(opts ...option.RequestOption) *Client { options := core.NewRequestOptions(opts...) - if options.ApiVersion == "" { - options.ApiVersion = os.Getenv("VELLUM_API_VERSION") + if options.ApiVersion == nil || *options.ApiVersion == "" { + options.ApiVersion = core.GetDefaultApiVersion() } return &Client{ baseURL: options.BaseURL, diff --git a/sandboxes/client.go b/sandboxes/client.go index 3c63545c..b14bbcd3 100644 --- a/sandboxes/client.go +++ b/sandboxes/client.go @@ -8,7 +8,6 @@ import ( core "github.com/vellum-ai/vellum-client-go/core" option "github.com/vellum-ai/vellum-client-go/option" http "net/http" - os "os" ) type Client struct { @@ -19,8 +18,8 @@ type Client struct { func NewClient(opts ...option.RequestOption) *Client { options := core.NewRequestOptions(opts...) - if options.ApiVersion == "" { - options.ApiVersion = os.Getenv("VELLUM_API_VERSION") + if options.ApiVersion == nil || *options.ApiVersion == "" { + options.ApiVersion = core.GetDefaultApiVersion() } return &Client{ baseURL: options.BaseURL, diff --git a/testsuiteruns/client.go b/testsuiteruns/client.go index 29d8b57a..0b19098e 100644 --- a/testsuiteruns/client.go +++ b/testsuiteruns/client.go @@ -8,7 +8,6 @@ import ( core "github.com/vellum-ai/vellum-client-go/core" option "github.com/vellum-ai/vellum-client-go/option" http "net/http" - os "os" ) type Client struct { @@ -19,8 +18,8 @@ type Client struct { func NewClient(opts ...option.RequestOption) *Client { options := core.NewRequestOptions(opts...) - if options.ApiVersion == "" { - options.ApiVersion = os.Getenv("VELLUM_API_VERSION") + if options.ApiVersion == nil || *options.ApiVersion == "" { + options.ApiVersion = core.GetDefaultApiVersion() } return &Client{ baseURL: options.BaseURL, diff --git a/testsuites/client.go b/testsuites/client.go index c58005e1..8cdcc49c 100644 --- a/testsuites/client.go +++ b/testsuites/client.go @@ -8,7 +8,6 @@ import ( core "github.com/vellum-ai/vellum-client-go/core" option "github.com/vellum-ai/vellum-client-go/option" http "net/http" - os "os" ) type Client struct { @@ -19,8 +18,8 @@ type Client struct { func NewClient(opts ...option.RequestOption) *Client { options := core.NewRequestOptions(opts...) - if options.ApiVersion == "" { - options.ApiVersion = os.Getenv("VELLUM_API_VERSION") + if options.ApiVersion == nil || *options.ApiVersion == "" { + options.ApiVersion = core.GetDefaultApiVersion() } return &Client{ baseURL: options.BaseURL, diff --git a/uploadedfiles/client.go b/uploadedfiles/client.go index e84cb27c..b46d05f5 100644 --- a/uploadedfiles/client.go +++ b/uploadedfiles/client.go @@ -11,7 +11,6 @@ import ( io "io" multipart "mime/multipart" http "net/http" - os "os" ) type Client struct { @@ -22,8 +21,8 @@ type Client struct { func NewClient(opts ...option.RequestOption) *Client { options := core.NewRequestOptions(opts...) - if options.ApiVersion == "" { - options.ApiVersion = os.Getenv("VELLUM_API_VERSION") + if options.ApiVersion == nil || *options.ApiVersion == "" { + options.ApiVersion = core.GetDefaultApiVersion() } return &Client{ baseURL: options.BaseURL, diff --git a/workflowdeployments/client.go b/workflowdeployments/client.go index 503d7219..329fb89c 100644 --- a/workflowdeployments/client.go +++ b/workflowdeployments/client.go @@ -12,7 +12,6 @@ import ( option "github.com/vellum-ai/vellum-client-go/option" io "io" http "net/http" - os "os" ) type Client struct { @@ -23,8 +22,8 @@ type Client struct { func NewClient(opts ...option.RequestOption) *Client { options := core.NewRequestOptions(opts...) - if options.ApiVersion == "" { - options.ApiVersion = os.Getenv("VELLUM_API_VERSION") + if options.ApiVersion == nil || *options.ApiVersion == "" { + options.ApiVersion = core.GetDefaultApiVersion() } return &Client{ baseURL: options.BaseURL, diff --git a/workflowexecutions/client.go b/workflowexecutions/client.go index 3ada62a8..9a8dcaf5 100644 --- a/workflowexecutions/client.go +++ b/workflowexecutions/client.go @@ -12,7 +12,6 @@ import ( option "github.com/vellum-ai/vellum-client-go/option" io "io" http "net/http" - os "os" ) type Client struct { @@ -23,8 +22,8 @@ type Client struct { func NewClient(opts ...option.RequestOption) *Client { options := core.NewRequestOptions(opts...) - if options.ApiVersion == "" { - options.ApiVersion = os.Getenv("VELLUM_API_VERSION") + if options.ApiVersion == nil || *options.ApiVersion == "" { + options.ApiVersion = core.GetDefaultApiVersion() } return &Client{ baseURL: options.BaseURL, diff --git a/workflows/client.go b/workflows/client.go index 3b57213a..bf31956a 100644 --- a/workflows/client.go +++ b/workflows/client.go @@ -14,7 +14,6 @@ import ( io "io" multipart "mime/multipart" http "net/http" - os "os" ) type Client struct { @@ -25,8 +24,8 @@ type Client struct { func NewClient(opts ...option.RequestOption) *Client { options := core.NewRequestOptions(opts...) - if options.ApiVersion == "" { - options.ApiVersion = os.Getenv("VELLUM_API_VERSION") + if options.ApiVersion == nil || *options.ApiVersion == "" { + options.ApiVersion = core.GetDefaultApiVersion() } return &Client{ baseURL: options.BaseURL, diff --git a/workflowsandboxes/client.go b/workflowsandboxes/client.go index 7f6835d0..c5ab7ddc 100644 --- a/workflowsandboxes/client.go +++ b/workflowsandboxes/client.go @@ -8,7 +8,6 @@ import ( core "github.com/vellum-ai/vellum-client-go/core" option "github.com/vellum-ai/vellum-client-go/option" http "net/http" - os "os" ) type Client struct { @@ -19,8 +18,8 @@ type Client struct { func NewClient(opts ...option.RequestOption) *Client { options := core.NewRequestOptions(opts...) - if options.ApiVersion == "" { - options.ApiVersion = os.Getenv("VELLUM_API_VERSION") + if options.ApiVersion == nil || *options.ApiVersion == "" { + options.ApiVersion = core.GetDefaultApiVersion() } return &Client{ baseURL: options.BaseURL, diff --git a/workspaces/client.go b/workspaces/client.go index 40b6b42e..a32b3c0e 100644 --- a/workspaces/client.go +++ b/workspaces/client.go @@ -8,7 +8,6 @@ import ( core "github.com/vellum-ai/vellum-client-go/core" option "github.com/vellum-ai/vellum-client-go/option" http "net/http" - os "os" ) type Client struct { @@ -19,8 +18,8 @@ type Client struct { func NewClient(opts ...option.RequestOption) *Client { options := core.NewRequestOptions(opts...) - if options.ApiVersion == "" { - options.ApiVersion = os.Getenv("VELLUM_API_VERSION") + if options.ApiVersion == nil || *options.ApiVersion == "" { + options.ApiVersion = core.GetDefaultApiVersion() } return &Client{ baseURL: options.BaseURL, diff --git a/workspacesecrets/client.go b/workspacesecrets/client.go index 6408db20..7deb9e14 100644 --- a/workspacesecrets/client.go +++ b/workspacesecrets/client.go @@ -8,7 +8,6 @@ import ( core "github.com/vellum-ai/vellum-client-go/core" option "github.com/vellum-ai/vellum-client-go/option" http "net/http" - os "os" ) type Client struct { @@ -19,8 +18,8 @@ type Client struct { func NewClient(opts ...option.RequestOption) *Client { options := core.NewRequestOptions(opts...) - if options.ApiVersion == "" { - options.ApiVersion = os.Getenv("VELLUM_API_VERSION") + if options.ApiVersion == nil || *options.ApiVersion == "" { + options.ApiVersion = core.GetDefaultApiVersion() } return &Client{ baseURL: options.BaseURL,