Salesforce Einstein
API Client for Salesforce Einstein.
Installation
Add this line to your application's Gemfile:
gem 'salesforce-einstein'And then execute:
$ bundle
Or install it yourself as:
$ gem install salesforce-einstein
Usage
- Initialize Client
client = Salesforce::Einstein::Client.new(cert: '/path/to/certificate',
password: 'certificate password',
email: 'einstein account email')or
client = Salesforce::Einstein::Client.new(private_key: '/path/to/private_key',
password: 'private_key password',
email: 'einstein account email')- Prediction with Image URL
client.predict_with_url 'url', 'modelId'- Prediction with Image Base64 String
client.predict_with_base64 'base64 string', 'modelId'- Create a Dataset
client.create_dataset 'name', 'labels'- Get a Dataset
client.get_dataset 'dataset_id'- Get All Datasets
client.get_all_datasets- Delete a Dataset
client.delete_dataset 'dataset_id'- Create a Label
client.create_label 'dataset_id', 'name'- Get a Label
client.get_label 'dataset_id', 'label_id'- Create an Example
client.create_example 'dataset_id', params- Get an Example
client.get_example 'dataset_id', 'example_id'- Get All Examples
client.get_all_example 'dataset_id'- Delete an Example
client.delete_example 'dataset_id', 'example_id'- Train a Dataset
client.train_dataset params- Get Training Status
client.get_training_status 'model_id'- Get Model Metrics
client.get_model_metrics 'model_id'- Get All Models
client.get_all_models 'dataset_id'Development
After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.
Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/tzmfreedom/salesforce-einstein.
License
The gem is available as open source under the terms of the MIT License.