snugsfbay / EinsteinPlayground

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Einstein Vision and Language Model Builder (aka the Einstein Playground) (EinsteinPlayground)

Salesforce API v48.0 Lightning Experience Required User License Platform Apex Test Coverage 76

This is the code repository for the world famous Einstein Vision and Language Model Builder package, also known affectionately as "The Einstein Playground".

The Einstein Vision and Language Model Builder is a UI layered on top of Einstein’s integrated REST APIs for Einstein . It enables you to more quickly upload datasets, train deep learning models and test the performance of those models through an easy-to-use GUI.

If you simply want to install and use the Playground in your org, bop over to the AppExchange listing. This will give you the opportunity to install the latest version of the managed package in your org and get started in minutes. Seriously. This is the easiest way to go.

If, however, you are looking for code examples of how to work with the Einstein.ai services, need to install an unmanaged version of the Playground, or are dying to propose some additions/extensions/fixes to the Playground, then you are in the right place.

Table of Contents

Background

The Einstein Vision and Language services provide REST API services to developers who want to add AI services into their custom applications - either on or off Salesforce Core. These are really powerful services, but being developer services, you have to either write custom code or use an HTTP request tool like cURL or Postman to get started.

Enter the Playground. The Playground really provides four capabilities:

  • A User Interface, based on Salesforce Lightning Web Components, that enables a user to upload datasets, train models, test predictions, and evaluat the model performance
  • Apex "wrapper" code that manages all the complexities of working with the Einstein.ai services such as constructing the JWT token, getting access tokens, refreshing tokens, etc. Global Apex class methods are provided to make predictions which greatly reduces the amount of custom code you need to write.
  • Invocable Apex methods available to Process Builder and Flows to easily add predictions on unstructured text or images to your applications with no code.
  • Lightning components that can be added to Lightning Record Pages or App Pages to add AI prediction capability to your UI.

There are actually two variants of the Playground - Managed and Unmanaged - contained on two Git branches - master and unmanaged. The master branch includes all the namespace stuff necessary to create a managed package. The unmanaged branch is the same code, just not set up with a namespace and not meant to be in a managed package.

The DX project on the master branch is already configured to do development work on the managed package, includeing configuration for the einsteinplay namespace. You will need to configure your DevHub to register the einsteinplay namespace.

If you just want access to the unmanaged code, switch to the unmanaged branch. You can push the code into a Scratch Org or convert it and use the mdapi to deploy it to a Dev Org.

Install

Again, if what you need is any of the four things listed above, then go to the AppExchange listing, install the latest version of the managed package, and be on your merry way. If you need access to this source code, then read on.

Salesforce DX - new scratch org

Clone the repo to your local file system.

git clone https://github.com/dschultz-mo/EinsteinPlayground

run the init.sh script, passing an alias name for your new scratch org

./init.sh yourScratchOrgAlias

Salesforce DX - deploy into developer edition or production org

You can use the Salesforce CLI to deploy the source into a regular Salesforce org using the Metatdata API.

Authenticate against the deployment org

sfdx force:auth:web:login -a yourOrgAlias

Create an output directory for the to be converted source

mkdir mdapi

Convert the source from Salesforce DX format to Metatdata API format

sfdx force:source:convert -r force-app -d mdapi

Deploy the source

sfdx force:mdapi:deploy -d mdapi -u yourOrgAlias

Dependencies

There are no external dependencies. All JavaScript libraries required are included as static resources.

Usage

To use the Playground GUI, invocable Apex, global Apex or Lightning components, see the Einstein Vision and Language Model Builder User Guide.

Version updates can be found in the Einstein Vision and Language Model Builder Release Notes.

Related Projects

If you create any projects that depend on the Invocable Apex or Global Apex, let us know and we will call them out here!

Maintainers

Dennis Schultz

Surabhi Ravishankar

Thanks

Thanks to Mike Brosseau, René Winkelmeyer and all the other nameless pioneers who created countless code repos and snippets that lead to this project over the years.

Contributing

The Playground is updated and enhanced on a time-available basis. We would love to hear your ideas for what else could be done. Feel free to submit Issues on this repo.

But better still, we would love to see your contributions! Reach out if you have some ideas. If you are a coder, fork it and send a pull request.

About


Languages

Language:Apex 54.3%Language:JavaScript 28.7%Language:HTML 15.2%Language:CSS 1.7%Language:Shell 0.1%Language:TeX 0.0%