Setting Up the Create Capability
When you are setting up the integration with the AI service in SAP Build Apps, you need to provide more details than you did when integrating entities from SAP Sales and Service Cloud Version 2. Additionally, you must maintain the relative path and query, and you need to model the message structure for the Create capability.
Relative Path and Query
The path and query get appended to the BTP Destination’s URL to finally form the AI service’s full API endpoint. This endpoint depends on the actual service used. In the demo, the Azure OpenAI service is used, which requires the following path and query, which can be obtained from the corresponding API documentation: /chat/completions?api-version=2023-05-15
The query includes an API version that is subject to change in the future. Always refer to the documentation of your AI service to identify the correct path and query. Additionally, remember that the other part of the endpoint is defined in the BTP Destination, which comes from the SAP AI Launchpad, as mentioned earlier in this lesson.
The sample URL used in this demo is:
https://api.ai.#####.ml.hana.ondemand.com/v2/inference/deployments/d8axxxxxxxxxxx
Field Definition
The field definition outlines the structure of messages exchanged with the AI service. It helps SAP Build Apps suggest appropriate field names, for instance when you design the request message within the Create Record flow function or when you access fields of an API response.
The demo focuses on the essential task of modeling the fields in the request message. By doing this, SAP Build Apps can assist you in creating the request message for the Create Record flow function or when testing the API in the integrations section. However, the demo does not cover the modeling of the response message. As a result, SAP Build Apps will not assist you in writing the formula to access the response fields, and you may encounter warnings.
The following code snippets contain samples for a minimum request and a shortened response message that were also shown during the demonstration.
Sample Request
12345678910
{
"messages": [
{
"role": "user",
"content": "Translate into German: We'll meet on Monday."
}
],
{ … }
}
Sample Response
1234567891011121314
{
"choices": [
{
"finish_reason": "stop",
"index": 0,
"message": {
"content": "Wir treffen uns am Montag.",
"role": "assistant"
}
}
],
{ … }
}