From 719adc2b0410b06eec3aa615377631e4288f308a Mon Sep 17 00:00:00 2001 From: Zane Whitfield Date: Thu, 7 Nov 2024 11:05:44 -0800 Subject: [PATCH 1/3] Add disclaimer --- packages/cli/src/commands/addons/create.ts | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/packages/cli/src/commands/addons/create.ts b/packages/cli/src/commands/addons/create.ts index be31a478b5..6aafc8e52a 100644 --- a/packages/cli/src/commands/addons/create.ts +++ b/packages/cli/src/commands/addons/create.ts @@ -75,12 +75,32 @@ export default class Create extends Command { const argv = (restParse.argv as string[]) // oclif duplicates specified args in argv .filter(arg => arg !== servicePlan) + const inferenceRegex = /heroku-inference.*/ + const isInferenceAddon = inferenceRegex.test(servicePlan) if (restParse.nonExistentFlags && restParse.nonExistentFlags.length > 0) { process.stderr.write(` ${color.yellow('›')} For example: ${color.cyan(`heroku addons:create -a ${app} ${restParse.raw[0].input} -- ${restParse.nonExistentFlags.join(' ')}`)}`) process.stderr.write(` ${color.yellow('›')} See https://devcenter.heroku.com/changelog-items/2925 for more info.\n`) } + if (isInferenceAddon) { + ux.warn( + '\n\nThis pilot feature is a Beta Service. You may opt to try such Beta Service in your sole discretion. ' + + 'Any use of the Beta Service is subject to the applicable Beta Services Terms provided at ' + + 'https://www.salesforce.com/company/legal/customer-agreements/. While use of the pilot feature itself is free, ' + + 'to the extent such use consumes a generally available Service, you may be charged for that consumption as set ' + + 'forth in the Documentation. Your continued use of this pilot feature constitutes your acceptance of the foregoing.\n\n' + + 'For clarity and without limitation, the various third-party machine learning and generative artificial intelligence ' + + '(AI) models and applications (each a “Platform”) integrated with the Beta Service are Non-SFDC Applications, ' + + 'as that term is defined in the Beta Services Terms. Note that these third-party Platforms include features that use ' + + 'generative AI technology. Due to the nature of generative AI, the output that a Platform generates may be ' + + 'unpredictable, and may include inaccurate or harmful responses. Before using any generative AI output, Customer is ' + + 'solely responsible for reviewing the output for accuracy, safety, and compliance with applicable laws and third-party ' + + 'acceptable use policies. In addition, Customer’s use of each Platform may be subject to the Platform’s own terms and ' + + 'conditions, compliance with which Customer is solely responsible.\n', + ) + } + const config = parseConfig(argv) let addon try { From 5d1eef9d7391ec61bff461537ee45e3085ce52a2 Mon Sep 17 00:00:00 2001 From: Zane Whitfield Date: Thu, 7 Nov 2024 11:50:00 -0800 Subject: [PATCH 2/3] Add test --- .../unit/commands/addons/create.unit.test.ts | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/packages/cli/test/unit/commands/addons/create.unit.test.ts b/packages/cli/test/unit/commands/addons/create.unit.test.ts index 2f5dbc6b40..eccafecb4f 100644 --- a/packages/cli/test/unit/commands/addons/create.unit.test.ts +++ b/packages/cli/test/unit/commands/addons/create.unit.test.ts @@ -14,6 +14,9 @@ describe('addons:create', function () { const addon = { id: 201, name: 'db3-swiftly-123', addon_service: {name: 'heroku-db3'}, app: {name: 'myapp', id: 101}, config_vars: ['DATABASE_URL'], plan: {price: {cents: 10000, unit: 'month'}}, state: 'provisioned', provision_message: 'provision message', } + const inferenceAddon = { + id: 201, name: 'claude-3-5-sonnet-acute-43973', addon_service: {name: 'heroku-inference-claude'}, app: {name: 'myapp', id: 101}, config_vars: ['INFERENCE_KEY', 'INFERENCE_MODEL_ID', 'INFERENCE_URL'], plan: {price: {cents: 0, unit: 'month'}}, state: 'provisioned', provision_message: 'provision message', + } beforeEach(async function () { api = nock('https://api.heroku.com:443') @@ -373,4 +376,23 @@ describe('addons:create', function () { expect(stdout.output).to.equal('provision message\nCreated db3-swiftly-123\nUse heroku addons:docs heroku-db3 to view documentation\n') }) }) + + context('creating an inference addon', function () { + beforeEach(function () { + api.post('/apps/myapp/addons', { + plan: {name: 'heroku-inference:claude-3-5-sonnet'}, name: 'foobar', attachment: {}, config: {}, + }) + .reply(200, inferenceAddon) + }) + it('displays disclaimer when creating inference addon', async function () { + await runCommand(Cmd, [ + 'heroku-inference:claude-3-5-sonnet', + '--app', + 'myapp', + '--name', + 'foobar', + ]) + expect(stderr.output).to.contain('This pilot feature is a Beta Service.') + }) + }) }) From 2ceda99cfe8f034c30b9936a7b518688a5ecfd5d Mon Sep 17 00:00:00 2001 From: Zane Whitfield Date: Tue, 12 Nov 2024 14:00:20 -0800 Subject: [PATCH 3/3] Update inference regex Co-authored-by: Santiago Bosio --- packages/cli/src/commands/addons/create.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/cli/src/commands/addons/create.ts b/packages/cli/src/commands/addons/create.ts index 6aafc8e52a..0a35322019 100644 --- a/packages/cli/src/commands/addons/create.ts +++ b/packages/cli/src/commands/addons/create.ts @@ -75,7 +75,7 @@ export default class Create extends Command { const argv = (restParse.argv as string[]) // oclif duplicates specified args in argv .filter(arg => arg !== servicePlan) - const inferenceRegex = /heroku-inference.*/ + const inferenceRegex = /^heroku-inference/ const isInferenceAddon = inferenceRegex.test(servicePlan) if (restParse.nonExistentFlags && restParse.nonExistentFlags.length > 0) {