Popular Model API

Number of APIs: 4

The Models REST API connects your application to Large Language Models (LLMs) through the Einstein Trust Layer. It let's you: - run AI prompts either as standalone or as part of conversations - create embeddings - provide feedback on the generated responses.

📚 Models REST API Reference

⚠️ Disclaimers:

  • this collection is not covered by Salesforce support and SLAs.

  • rate limits apply when using the API.

Setup

The Models API requires access to Einstein Generative AI on your Salesforce Org. If you don't have an Org with this feature, you can get an Einstein AI Playground org from Trailhead to experiment.

  1. [Fork] this collection.

  2. Follow Step 1 (yes, only step 1!) of these instructions to create a Connected App in your Salesforce Org.

  3. Copy the Consumer Key and Consumer Secret values from your Connected App and paste them respectively in the clientId and clientSecret collection variables.

  4. From Setup, go to My Domain, and then copy the value of Current My Domain URL into the authDomain collection variable.

  5. Optional: pick a model from the list of supported models, grab it's API name and save it in the modelName collection variable. If you don't enter a new value, sfdc_ai__DefaultGPT35Turbo (GPT 3.5 Turbo) is used by default.

  6. Save your collection variables.

  7. Open the Authorization tab of the Qodex collection and click Get New Access Token at the bottom of the screen.

  8. Click Use Token.

  9. Select the Generate text request and click Send it to ensure that the collection is properly set up.

Variables Reference

The collection relies on the following required variables:

VariableDescription
authDomainSalesforce Org domain without https://. See My Domain in Salesforce Setup for value.
clientIdConnected App Consumer Key.
clientSecretConnected App Consumer Secret.
modelNameAPI name of one of the supported Gen AI models.
_baseUrlThe Models API base URL. Do not modify this value.
  1. Generate text POST {{_baseUrl}}/models/:modelName/generations

  2. Generate chat POST {{_baseUrl}}/models/:modelName/chat-generations

  3. Generate embeddings POST {{_baseUrl}}/models/:modelName/embeddings

  4. Submit feedback POST {{_baseUrl}}/feedback