Skip to main content

AI SDK for SAP Completions Overview

info

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:

  • 2022-12-01
  • 2023-03-15-preview
  • 2023-05-15
  • 2023-06-01-preview
  • 2023-07-01-preview
  • 2023-08-01-preview

Demo Program

Program NamePackageDescription
ZP_PENGG_AZOAI_DEMO_COMPLETIONZPENGG_AZOAI_SDK_DEMOSMicrosoft Platform Engineering: Azure Open AI SDK Demo - Completions

REFERENCE : Azure OpenAI Service models

tip

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

OperationDescription
CreateWith 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

caution

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

ParameterDirectionData TypeDescription
deploymentidEXPORTINGstringDeployment ID on which this completion must be run
promptsEXPORTINGCompletions InputPrompts. 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
statuscodeIMPORTINGIntegerResponse Code.
statusreasonIMPORTINGStringStatus Description/Reason
responseIMPORTINGCompletions OutputABAP Ready completion result.
errorIMPORTINGErrorABAP Ready error structure, if operation resulted in an error

Responses/Status Code

NameTypeStructure PopulatedDescription
200 OKCompletions OutputresponseSuccess
Other Status CodesErrorerrorAn error occurred.