Clarifai / clarifai-javascript

Official Clarifai JavaScript client for browsers and node.js
https://docs.clarifai.com
Other
351 stars 81 forks source link

Remove Concepts From A Model #13

Closed koszny closed 7 years ago

koszny commented 7 years ago

how is the removal example from here: https://developer.clarifai.com/guide/models#models supposed to work? shouldn't:

update(obj) { let url = ${this._config.apiEndpoint}${MODELS_PATH}; let modelData = [obj]; let data = {models: modelData.map(formatModel)}; if (data.concepts) { data['action'] = obj.action || 'merge'; }

in Model.js be changed to:

update(obj) { obj.id = this.id; let url = ${this._config.apiEndpoint}${MODELS_PATH}; let modelData = [obj]; let data = {models: modelData.map(formatModel)}; if (data.models) { data['action'] = obj.action || 'merge'; } ?

eddiezane commented 7 years ago

Sorry for the delay on this.

I tested successfully with the following:

const Clarifai = require('clarifai')

const app = new Clarifai.App({
  apiKey: 'YOUR_API_KEY'
})

app.models.initModel('car-beer')
  .then(model => {
    return model.deleteConcepts({ id: 'beer' })
  })
  .then(res => console.log(res))
  .catch(err => console.error(err))

Please let me know if you still have issues.