Newer Version Available
Resolve a Prompt Template
To resolve a prompt template, create an input object, build input maps, configure additional settings, call the service, and handle the resolution and response.
To create an input object, create an instance of ConnectApi.EinsteinPromptTemplateGenerationsInput.
To store input parameters for the prompt template, build input maps using Map<String, ConnectApi.WrappedValue>. Wrap the input maps in ConnectApi.WrappedValue and add them to a ConnectApi.WrappedValue map with identifying keys. You can also wrap a string input in ConnectApi.WrappedValue and add it to a map.
To configure additional settings, create an instance of ConnectApi.EinsteinLlmAdditionalConfigInput and assign it to the additionalConfig property of the input object.
To generate messages based on the prompt template and input parameters, call the generateMessagesForPromptTemplate method of the ConnectApi.EinsteinLLM class with the prompt template ID and the input object.
To access the prompt resolution, use generationsOutput.prompt and, to access the first generated response, use generationsOutput.generations[0].text.