AI SDK for SAP Completions Overview
Completions is used along with GPT3 models/deployments. If you are looking for latest GPT4 model usage through AI SDK, please refer to Chat Completions.
AI Engine and Versions:
- Azure Open AI
- Open AI
- 2022-12-01
- 2023-03-15-preview
- 2023-05-15
- 2023-06-01-preview
- 2023-07-01-preview
- 2023-08-01-preview
- v1
Demo Program
- Azure Open AI
- Open AI
Program Name | Package | Description |
---|---|---|
ZP_PENGG_AZOAI_DEMO_COMPLETION | ZPENGG_AZOAI_SDK_DEMOS | Microsoft Platform Engineering: Azure Open AI SDK Demo - Completions |
REFERENCE : Azure OpenAI Service models
Program Name | Package | Description |
---|---|---|
ZP_MSAISDKDEMO_COMPLETION_OAI | ZPENGG_OAI_DEMOS | MS AI SDK for SAP : Demo program for Open AI Completions |
Review the demo program along with the content of this page to understand the use of AI SDK feature. The demo program was imported to your SAP Application server as part of AI SDK Installation.
Operations
Operation | Description |
---|---|
Create | With the Completions operation, the model will generate one or more predicted completions based on a provided prompt. The service can also return the probabilities of alternative tokens at each position. |
Completions - Create
The model which is deployed has a profound impact on the completions. For example, codex models are pretty good at code completions, but not so good at text completions. The opposite is true for davinci models. The best way to find out which model is best for your use case is to try them out.
With the Completions operation, the model will generate one or more predicted completions based on a provided prompt. The service can also return the probabilities of alternative tokens at each position.
DATA:
completions_input TYPE zif_peng_azoai_sdk_types=>ty_completion_input,
completions_output TYPE zif_peng_azoai_sdk_types=>ty_completion_output.
sdk_instance->completions( )->create(
EXPORTING
deploymentid = deployment_id
prompts = completions_input
IMPORTING
statuscode = status_code
statusreason = status_reason
response = completions_output
error = error
).
Parameters and Exceptions
- Parameters
- Exceptions
Parameter | Direction | Data Type | Description |
---|---|---|---|
deploymentid | EXPORTING | string | Deployment ID on which this completion must be run |
prompts | EXPORTING | Completions Input | Prompts. Each prompt will be processed to generate completion. Usually, there will be 1 prompt being sent - however, SDK supports multiple prompts as well. The number of responses generated for each prompt depends on n parameter of the prompt |
statuscode | IMPORTING | Integer | Response Code. |
statusreason | IMPORTING | String | Status Description/Reason |
response | IMPORTING | Completions Output | ABAP Ready completion result. |
error | IMPORTING | Error | ABAP Ready error structure, if operation resulted in an error |
ZCX_PENG_AZOAI_SDK_EXCEPTION - Raised if an error occured during processing.
The exception is not raised if an error occured during AI Engine processing. In such situations, the ov_error parameter will provide error details. The exception is raised only if SDK encouters a situation where it cannot proceed with the requested operation.
Responses/Status Code
Name | Type | Structure Populated | Description |
---|---|---|---|
200 OK | Completions Output | response | Success |
Other Status Codes | Error | error | An error occurred. |