Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(addons): add inference disclaimer #3076

Merged
merged 4 commits into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions packages/cli/src/commands/addons/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
22 changes: 22 additions & 0 deletions packages/cli/test/unit/commands/addons/create.unit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down Expand Up @@ -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.')
})
})
})
Loading