Download OpenAPI specification:Download
The Models REST API connects your application to large language models (LLMs) through the Einstein Trust Layer. To get started, see Access Models API with REST.
The quickest way to get started with the Models REST API is with our Postman collection.
| modelName required | string Configured model name. |
| Authorization required | string Example: Bearer ••••• Authorization information that contains the JWT. For guidance, see Access Models API with REST. |
| x-sfdc-app-context required | string Example: EinsteinGPT This value is reserved for future use. For now, specify |
| x-client-feature-id required | string Example: ai-platform-models-connected-app This value is reserved for future use. For now, specify |
required | Array of objects (ChatMessageRequest) List of messages to send to the model. These messages should be in chronological order. |
object (Localization) Localization information, which can include the default locale, input locale(s), and expected output locale(s). | |
object or null (Tags) Entries used by the Models API for non-generative purposes and entries used by the client for free-form data. |
{- "messages": [
- {
- "role": "user",
- "content": "Can you give me a recipe for cherry pie?"
}
], - "localization": {
- "defaultLocale": "en_US",
- "inputLocales": [
- {
- "locale": "en_US",
- "probability": 0.8
}
], - "expectedLocales": [
- "en_US"
]
}, - "tags": { }
}{- "id": "014DFFD2-04B5-4765-8EA7-507585268CD3",
- "generationDetails": {
- "generations": [
- {
- "id": "string",
- "role": "user",
- "content": "Can you give me a recipe for cherry pie?",
- "timestamp": 1682536893,
- "parameters": {
- "finish_reason": "stop",
- "index": 0,
- "logprobs": null
}, - "contentQuality": {
- "scanToxicity": {
- "isDetected": true,
- "categories": [
- {
- "categoryName": "profanity",
- "score": 0
}
]
}
}
}
], - "parameters": {
- "model": "gpt-3.5-turbo",
- "object": "text_completion",
- "usage": {
- "completion_tokens": 235,
- "prompt_tokens": 91,
- "total_tokens": 326
}
}
}
}| modelName required | string Configured model name. |
| Authorization required | string Example: Bearer ••••• Authorization information that contains the JWT. For guidance, see Access Models API with REST. |
| x-sfdc-app-context required | string Example: EinsteinGPT This value is reserved for future use. For now, specify |
| x-client-feature-id required | string Example: ai-platform-models-connected-app This value is reserved for future use. For now, specify |
| input required | Array of strings Input text used for generating an embedding. Data is encoded as an array of strings. |
object (Localization) Localization information, which can include the default locale, input locale(s), and expected output locale(s). | |
object or null (Tags) Entries used by the Models API for non-generative purposes and entries used by the client for free-form data. |
{- "input": [
- "Every day, once a day, give yourself a present"
]
}Note: Embedding array truncated to 1 item for brevity.
{- "embeddings": [
- {
- "embedding": [
- 0.0015662104
], - "index": 0
}
], - "parameters": {
- "usage": {
- "prompt_tokens": 11,
- "total_tokens": 11
}, - "model": "text-embedding-ada-002-v2",
- "object": "list"
}
}| modelName required | string Example: sfdc_ai__DefaultAzureOpenAIGPT35Turbo Configured model name. |
| Authorization required | string Example: Bearer ••••• Authorization information that contains the JWT. For guidance, see Access Models API with REST. |
| x-sfdc-app-context required | string Example: EinsteinGPT This value is reserved for future use. For now, specify |
| x-client-feature-id required | string Example: ai-platform-models-connected-app This value is reserved for future use. For now, specify |
| prompt required | string The prompt or text to be completed. |
object (Localization) Localization information, which can include the default locale, input locale(s), and expected output locale(s). | |
object or null (Tags) Entries used by the Models API for non-generative purposes and entries used by the client for free-form data. |
{- "prompt": "Invent 3 fun names for donuts",
- "localization": {
- "defaultLocale": "en_US",
- "inputLocales": [
- {
- "locale": "en_US",
- "probability": 0.8
}
], - "expectedLocales": [
- "en_US"
]
}, - "tags": { }
}{- "id": "chatcmpl-8diKGsPooFDwwhbJxmibpUc7437at",
- "generation": {
- "id": "4399c4ea-89d4-44ca-ae8d-cf5926b41bc4",
- "generatedText": "The generated text.",
- "contentQuality": {
- "scanToxicity": {
- "isDetected": true,
- "categories": [
- {
- "categoryName": "profanity",
- "score": 0
}
]
}
}, - "parameters": {
- "finish_reason": "stop",
- "index": 0,
- "logprobs": null
}
}, - "moreGenerations": [
- {
- "id": "4399c4ea-89d4-44ca-ae8d-cf5926b41bc4",
- "generatedText": "The generated text.",
- "contentQuality": {
- "scanToxicity": {
- "isDetected": true,
- "categories": [
- {
- "categoryName": "profanity",
- "score": 0
}
]
}
}, - "parameters": {
- "finish_reason": "stop",
- "index": 0,
- "logprobs": null
}
}
], - "prompt": "Invent 3 fun names for donuts",
- "parameters": {
- "model": "gpt-3.5-turbo-0125",
- "object": "chat.completion",
- "usage": {
- "prompt_tokens": 14,
- "completion_tokens": 15,
- "total_tokens": 29
}
}
}| Authorization required | string Example: Bearer ••••• Authorization information that contains the JWT. For guidance, see Access Models API with REST. |
| x-sfdc-app-context required | string Example: EinsteinGPT This value is reserved for future use. For now, specify |
| x-client-feature-id required | string Example: ai-platform-models-connected-app This value is reserved for future use. For now, specify |
| id | string A unique ID for the feedback object. |
| generationId | string Identifies the target of this feedback data. You can specify the ID of a |
| feedback | string or null Enum: "GOOD" "BAD" The feedback sentiment. Can be |
| feedbackText | string The textual representation of the feedback as provided by the user. |
| source | string The source of the feedback. For example, |
object Dictionary of any app-level feedback and any other free-form parameters. | |
| appGenerationId | string App-specific generation ID to support cases where the client has multiple responses in a single generation. |
| appGeneration | string App-specific generation text to support cases where the client has multiple responses in a single generation. |
{- "id": "d123449d-afed-4abe-9a0e-19c90726d2ea",
- "generationId": "d321449d-afed-4abe-9a0e-19c90726d2ea",
- "feedback": "GOOD",
- "feedbackText": "string",
- "source": "string",
- "appFeedback": { },
- "appGenerationId": "string",
- "appGeneration": "d567849d-afed-4abe-9a0e-19c90726d2ea"
}{- "message": "Feedback received, Thank you!"
}