Skip to main content

AI SDK Type Definitions

Common Types

Error

Type Definition

zif_peng_azoai_sdk_types=>ty_error

Field NameTypeDescription
codeErrorCodeErrorCode
messagestringThe message of this error.
targetstringThe location where the error happened if available.

Error Code

NameTypeDescription
conflictstringThe requested operation conflicts with the current resource state.
fileImportFailedstringImport of file failed.
forbiddenstringThe operation is forbidden for the current user/api key.
internalFailurestringInternal error. Please retry.
invalidPayloadstringThe request data is invalid for this operation.
itemDoesAlreadyExiststringThe item does already exist.
jsonlValidationFailedstringValidation of jsonl data failed.
notFoundstringThe resource is not found.
quotaExceededstringQuota exceeded.
serviceUnavailablestringThe service is currently not available.
unexpectedEntityStatestringThe operation cannot be executed in the current resource's state.

Models

Model Get

Type Definition

zif_peng_azoai_sdk_types=>ty_model_get

Field NameTypeDescription
capabilitiesCapabilitiesCapabilities.
The capabilities of a model. It defines the modes for scaling and the reserved capacity.
created_atintegerA timestamp when this job or item was created (in unix epochs).
deprecationDeprecationDeprecation.
The deprecation of a model.
idstringThe identity of this item.
lifecycle_statusLifecycle StatusLifecycleStatus.
The lifecycle status of a model.
objectType DiscriminatorDefines the type of an object.
statusStateState.
The state of a job or item.
updated_atintegerA timestamp when this job or item was modified last (in unix epochs).

Model List

Type Definition

zif_peng_azoai_sdk_types=>ty_model_list

Field NameTypeDescription
dataModel[]Internal Table of Model

Deployments

Deployment Create Info

Type Definition

zif_peng_azoai_sdk_types=>ty_deployments_create

Field NameTypeDescription
modelstringThe OpenAI model identifier (model-id) to deploy. Can be a base model or a fine tune.
scale_settingsScale SettingsScaleSettings.
The scale settings of a deployment. It defines the modes for scaling and the reserved capacity.

Deployment

Type Definition

zif_peng_azoai_sdk_types=>ty_deployments

Field NameTypeDescription
created_atintegerA timestamp when this job or item was created (in unix epochs).
errorErrorError Information
idstringThe identity of this item.
modelstringThe OpenAI model identifier (model-id) to deploy. Can be a base model or a fine tune.
objectTypeDiscriminatorType of the object.
ownerstringThe owner of this deployment. For Azure OpenAI only "organization-owner" is supported.
scale_settingsScale SettingsScaleSettings.
The scale settings of a deployment. It defines the modes for scaling and the reserved capacity.
statusStateState.
The state of a job or item.
updated_atintegerA timestamp when this job or item was modified last (in unix epochs).

Deployment List

Type Definition

zif_peng_azoai_sdk_types=>ty_deployments_list

Field NameTypeDescription
dataDeployment[]Internal Table of Deployment
objectType DiscriminatorDefines the type of an object.

Files

File

Type Definition

zif_peng_azoai_sdk_types=>ty_file_get

Field NameTypeDescription
bytesintegerThe size of this file when available (can be null).
created_atintegerA timestamp when this job or item was created (in unix epochs).
errorErrorError
filenamestringThe name of the file.
idstringThe identity of this item.
objectType DiscriminatorDefines the type of an object.
purposePurposePurpose
The intended purpose of the uploaded documents. Use "fine-tune" for fine-tuning. This allows validation of format of the uploaded file.
statisticsFile StatisticsFileStatistics
A file is a document usable for training and validation. It can also be a service generated document with result details.
statusStateState
The state of a job or item.
updated_atintegerA timestamp when this job or item was modified last (in unix epochs).

File Import

Type Definition

zif_peng_azoai_sdk_types=>ty_file_import

Field NameTypeDescription
content_urlstringThe url to download the document from (can be SAS url of a blob or any other external url accessible with a GET request).
filenamestringThe name of the JSON Lines file to be uploaded. If the purpose is set to "fine-tune", each line is a JSON record with "prompt" and "completion" fields representing your training examples.
purposePurposePurpose.
The intended purpose of the uploaded documents. Use "fine-tune" for fine-tuning.

File List

Type Definition

zif_peng_azoai_sdk_types=>ty_file_list

Field NameTypeDescription
dataFile[]The list of items.
objectType DiscriminatorDefines the type of an object.

File Upload

Type Definition

zif_peng_azoai_sdk_typinternal=>ty_int_file_upload

Field NameTypeDescription
promptstringTraining Data Prompt
completionstringTraining Data Completion.

Fine Tunes

Fine Tune Create

Type Definition

zif_peng_azoai_sdk_types=>ty_finetune_create

Field NameTypeDescription
modelstringThe identifier (model-id) of the base model used for this fine-tune.
training_filestringThe file identity (file-id) that is used for training this fine tuned model.
batch_sizeintegerThe batch size to use for training. The batch size is the number of training examples used to train a single forward and backward pass. In general, we've found that larger batch sizes tend to work better for larger datasets. The default value as well as the maximum value for this property are specific to a base model.
classification_betasnumber[]The classification beta values. If this is provided, we calculate F-beta scores at the specified beta values. The F-beta score is a generalization of F-1 score. This is only used for binary classification. With a beta of 1 (i.e.the F-1 score), precision and recall are given the same weight. A larger beta score puts more weight on recall and less on precision. A smaller beta score puts more weight on precision and less on recall.
classification_n_classesintegerThe number of classes in a classification task. This parameter is required for multiclass classification.
classification_positive_classstringThe positive class in binary classification. This parameter is needed to generate precision, recall, and F1 metrics when doing binary classification.
compute_classification_metricsbooleanA value indicating whether to compute classification metrics. If set, we calculate classification-specific metrics such as accuracy and F-1 score using the validation set at the end of every epoch. These metrics can be viewed in the results file. In order to compute classification metrics, you must provide a validation_file.Additionally, you must specify classification_n_classes for multiclass classification or classification_positive_class for binary classification.
learning_rate_multipliernumberThe learning rate multiplier to use for training. The fine-tuning learning rate is the original learning rate used for pre-training multiplied by this value. Larger learning rates tend to perform better with larger batch sizes. We recommend experimenting with values in the range 0.02 to 0.2 to see what produces the best results.
n_epochsintegerThe number of epochs to train the model for. An epoch refers to one full cycle through the training dataset.
prompt_loss_weightnumberThe weight to use for loss on the prompt tokens. This controls how much the model tries to learn to generate the prompt (as compared to the completion which always has a weight of 1.0), and can add a stabilizing effect to training when completions are short. If prompts are extremely long (relative to completions), it may make sense to reduce this weight so as to avoid over-prioritizing learning the prompt.
suffixstringThe suffix used to identify the fine-tuned model. The suffix can contain up to 40 characters (a-z, A-Z, 0-9,- and _) that will be added to your fine-tuned model name.
validation_filestringThe file identity (file-id) that is used to evaluate the fine tuned model during training.

Fine Tune Events

Type Definition

zif_peng_azoai_sdk_types=>ty_finetune_events

Field NameTypeDescription
dataFine Tune Event[]The list of items.
objectType DiscriminatorDefines the type of an object.

Fine Tune List

Type Definition

zif_peng_azoai_sdk_types=>ty_finetune_list

Field NameTypeDescription
dataFine Tune Result[]Internal table of Fine Tunes.
objectType DiscriminatorDefines the type of an object.

Fine Tune Result

Type Definition

zif_peng_azoai_sdk_types=>ty_finetune_result

Field NameTypeDescription
created_atintegerA timestamp when this job or item was created (in unix epochs).
errorErrorError
eventsFine Tune Events[]The events that show the progress of the fine-tune run including queued, running and completed.
fine_tuned_modelstringThe identifier (model-id) of the resulting fine tuned model. This property is only populated for successfully completed fine-tune runs. Use this identifier to create a deployment for inferencing.
hyperparamsHyperParameterHyperParameters
The hyper parameter settings used in a fine tune job.
idstringThe identity of this item.
modelstringThe identifier (model-id) of the base model used for the fine-tune.
objectType DiscriminatorDefines the type of an object.
organisation_idstringThe organisation id of this fine tune job. Unused on Azure OpenAI; compatibility for OpenAI only.
result_filesFile[]The result file identities (file-id) containing training and evaluation metrics in csv format. The file is only available for successfully completed fine-tune runs.
statusStateState.
The state of a job or item.
suffixstringThe suffix used to identify the fine-tuned model.
training_filesFile[]The file identities (file-id) that are used for training the fine tuned model.
updated_atintegerA timestamp when this job or item was modified last (in unix epochs).
user_idstringThe user id of this fine tune job. Unused on Azure OpenAI; compatibility for OpenAI only.
validation_filesFile[]The file identities (file-id) that are used to evaluate the fine tuned model during training.

Embeddings

Embedding Input

Type Definition

zif_peng_azoai_sdk_types=>ty_embeddings_input

Field NameTypeDescription
inputstring[]Input text to get embeddings for, encoded as a string. The number of input tokens varies depending on what model you are using.

Embedding Output

Type Definition

zif_peng_azoai_sdk_types=>ty_embeddings_output

Field NameTypeDescription
objectType DiscriminatorDefines the type of an object. For embedding, this will be "list"
dataEmbeddings[]An array of embeddings, based on the number of inputs.
modelstringThe identifier of the model/deployment used to generate the embeddings.
usageEmbedding UsageUseage Information for this embedding run.

Completions

Completion Input

Type Definition

zif_peng_azoai_sdk_types=>ty_completion_input

Field NameTypeDescription
promptstring[]The prompt(s) to generate completions for, encoded as a string, a list of strings, or a list of token lists. Note that <\|endoftext\|> is the document separator that the model sees during training, so if a prompt isn't specified the model will generate as if from the beginning of a new document.
max_tokensintegerThe maximum number of tokens to generate.
userstringA unique identifier representing your end-user, which can help monitoring and detecting abuse. Do not pass PII identifiers instead use pseudoanonymized values such as GUIDs
nintegerThe number of completions to generate for each prompt.
temperaturenumberWhat sampling temperature to use, between 0 and 2. Higher values means the model will take more risks. Try 0.9 for more creative applications, and 0 (argmax sampling) for ones with a well-defined answer. We generally recommend altering this or top_p but not both.
top_pnumberAn alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. We generally recommend altering this or temperature but not both.
stopstring[]Up to four sequences where the API will stop generating further tokens. The returned text won't contain the stop sequence.
frequency_penaltynumberNumber between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim.
presence_penaltynumberNumber between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics.
best_ofintegerGenerates best_of completions server-side and returns the "best" (the one with the lowest log probability per token). When used with n, best_of controls the number of candidate completions and n specifies how many to return from those - best_of must be greater than n
caution

Careful using the parameters "n" and "best_of". Because this parameter generates many completions, it can quickly consume your token quota. Use carefully and ensure that you have reasonable settings for max_tokens and stop.

Completion Output

Type Definition

zif_peng_azoai_sdk_types=>ty_completion_output

Field NameTypeDescription
idstringThe identity of this item.
objectType DiscriminatorDefines the type of an object.
createdintegerA timestamp when this job or item was created (in unix epochs).
modelstringThe identifier (model-id) of the model used for this completion.
choicesCompletion Choice[]The completions that are generated
usageCompletion UsageUseage Information for this completion run.

Completion Choice

Type Definition

zif_peng_azoai_sdk_typinternal=>ty_completion_resobj_choices

Field NameTypeDescription
textstringThe text of the completion.
indexintegerThe index of the prompt this completion is generated for.
finish_reasonstringReason for the response text to be output.

Usage

Type Definition

zif_peng_azoai_sdk_typinternal=>ty_completion_resobj_usage

Field NameTypeDescription
completion_tokensintegerThe number of tokens generated by the completion/embedding.
prompt_tokensintegerThe number of tokens used as prompt for the completion/embedding.
total_tokensintegerThe total number of tokens (prompt + completion) generated by the completion/embedding.

Chat Completions

Chat Completion Message

Type Definition

zif_peng_azoai_sdk_types=>ty_chatcompletion_message

Field NameTypeDescription
roleRoleThe role of the message.
contentstringThe content of the message.

Chat Completion Input

Type Definition

zif_peng_azoai_sdk_types=>ty_chatcompletion_input

Note

The current Completion input structure has only a subset of fields, compared to all the fields supported by AI Engines. In future, we will expand this capability

Field NameTypeDescription
messagesChat Completion Message[]A list of messages that will be used as context to generate the completion.
max_tokensintegerThe maximum number of tokens to generate.
userstringA unique identifier representing your end-user, which can help monitoring and detecting abuse. Do not pass PII identifiers instead use pseudoanonymized values such as GUIDs
nintegerThe number of completions to generate for each prompt.
temperaturenumberWhat sampling temperature to use, between 0 and 2. Higher values means the model will take more risks. Try 0.9 for more creative applications, and 0 (argmax sampling) for ones with a well-defined answer. We generally recommend altering this or top_p but not both.
top_pnumberAn alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. We generally recommend altering this or temperature but not both.
stopstring[]Up to four sequences where the API will stop generating further tokens. The returned text won't contain the stop sequence.
frequency_penaltynumberNumber between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim.
presence_penaltynumberNumber between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics.

Chat Completion Output

Type Definition

zif_peng_azoai_sdk_types=>ty_chatcompletion_output

Field NameTypeDescription
idstringThe identity of this item.
objectType DiscriminatorDefines the type of an object.
createdintegerA timestamp when this job or item was created (in unix epochs).
modelstringThe identifier (model-id) of the model used for this completion.
choicesChat Completion Choice[]The completions that are generated
usageCompletion UsageUseage Information for this completion run.

Chat Completion Choice

Type Definition

zif_peng_azoai_sdk_typinternal=>tty_chatcompl_resobj_choices

Field NameTypeDescription
indexintegerThe index of the prompt this completion is generated for.
finish_reasonstringReason for the response text to be output.
messageChat Completion MessageThe messages generated by the completion.

Internal Types

The following are internal types of AI SDK, and chances are, you wont be declaring these types in your use cases or ABAP programs. However, you will still come across these as fields in other exposed data types.

Capabilities

Type Definition

zif_peng_azoai_sdk_typinternal=>ty_int_mod_get_capabilities

ValueTypeDescription
completionbooleanWhether the model supports completion.
embeddingsbooleanWhether the model supports embeddings.
fine_tunebooleanWhether the model supports fine-tuning.
inferencebooleanWhether the model supports inference.
scale_typesstring[]The supported scale types.

Deprecation

Type Definition

zif_peng_azoai_sdk_typinternal=>ty_int_mod_get_deprecation

ValueTypeDescription
fine_tuneintegerThe end date of fine tune support of this model. Will be null for fine tune models.
inferenceintegerThe end date of inference support of this model.

Embedding

Type Definition

zif_peng_azoai_sdk_typinternal=>ty_embedding

Field NameTypeDescription
objectType DiscriminatorDefines the type of an object.
indexintegerThe index of the input this embedding is generated for.
embeddingfloat[]The embedding vector.

File Statistics

Type Definition

zif_peng_azoai_sdk_typinternal=>ty_int_file_stats

Field NameTypeDescription
examplesintegerThe number of contained training examples in files of kind "fine-tune" once validation of file content is complete.
tokensintegerThe number of tokens used in prompts and completions for files of kind "fine-tune" once validation of file content is complete.

Finetune Event

Type Definition

zif_peng_azoai_sdk_typinternal=>ty_int_finetune_event

Field NameTypeDescription
created_atintegerA timestamp when this event was created (in unix epochs).
levelLog LevelLogLevel.
The verbosity level of an event.
messagestringThe message describing the event. This can be a change of state, e.g., enqueued, started, failed or completed, or other events like uploaded results.
objectType DiscriminatorDefines the type of an object.

Hyper Parameters

Type Definition

zif_peng_azoai_sdk_typinternal=>ty_int_finetune_hyperparams

Field NameTypeDescription
batch_sizeintegerThe batch size to use for training. The batch size is the number of training examples used to train a single forward and backward pass. In general, we've found that larger batch sizes tend to work better for larger datasets. The default value as well as the maximum value for this property are specific to a base model.
classification_betasnumber[]The classification beta values. If this is provided, we calculate F-beta scores at the specified beta values. The F-beta score is a generalization of F-1 score. This is only used for binary classification. With a beta of 1 (i.e.the F-1 score), precision and recall are given the same weight. A larger beta score puts more weight on recall and less on precision. A smaller beta score puts more weight on precision and less on recall.
classification_n_classesintegerThe number of classes in a classification task. This parameter is required for multiclass classification.
classification_positive_classstringThe positive class in binary classification. This parameter is needed to generate precision, recall, and F1 metrics when doing binary classification.
compute_classification_metricsbooleanA value indicating whether to compute classification metrics. If set, we calculate classification-specific metrics such as accuracy and F-1 score using the validation set at the end of every epoch. These metrics can be viewed in the results file. In order to compute classification metrics, you must provide a validation_file.Additionally, you must specify classification_n_classes for multiclass classification or classification_positive_class for binary classification.
learning_rate_multipliernumberThe learning rate multiplier to use for training. The fine-tuning learning rate is the original learning rate used for pre-training multiplied by this value. Larger learning rates tend to perform better with larger batch sizes. We recommend experimenting with values in the range 0.02 to 0.2 to see what produces the best results.
n_epochsintegerThe number of epochs to train the model for. An epoch refers to one full cycle through the training dataset.
prompt_loss_weightnumberThe weight to use for loss on the prompt tokens. This controls how much the model tries to learn to generate the prompt (as compared to the completion which always has a weight of 1.0), and can add a stabilizing effect to training when completions are short. If prompts are extremely long (relative to completions), it may make sense to reduce this weight so as to avoid over-prioritizing learning the prompt.

Log Level

Type Definition

string

ValueDescription
errorThis message represents a non recoverable issue.
infoThis message represents an informational message.
warningThis event represents a mitigated issue.

Lifecycle Status

Type Definition

string

ValueTypeDescription
generally-availablestringThe model is generally available.
previewstringModel is in preview and covered by the service preview terms.

Purpose

Type Definition

string

ValueDescription
fine-tuneThis file contains training data for a fine tune job.
fine-tune-resultsThis file contains the results of a fine tune job.

Role

Type Definition

string

ValueDescription
systemSystem Role, also known as System message - provides initial instructions to the model.
userUser Message. When invoking the AI Engine with Chat Completion, the last message should have the role "user".
assistantThis role is used to for previous or current responses from AI Engine

Scale Settings

Type Definition

zif_peng_azoai_sdk_typinternal=>ty_scale_settings

Field NameTypeDescription
capacityIntegerThe constant reserved capacity of the inference endpoint for this deployment.
Only used when scale_type is manual
scale_typeString
  • manual
  • standard
Defines how scaling operations will be executed.
If set to manual, capacity must be specified.

State

Type Definition

string

ValueDescription
canceledThe operation has been canceled and is incomplete.
deletedThe entity has been deleted but may still be referenced by other entities predating the deletion.
failedThe operation has completed processing with a failure and cannot be further consumed.
notRunningThe operation was created and is not queued to be processed in the future.
runningThe operation has started to be processed.
succeededThe operation has successfully be processed and is ready for consumption.

Type Discriminator

Type Definition

string

ValueDescription
modelThis object represents a model (can be a base models or fine tune job result).
deploymentThis object represents a deployment.
fileThis object represents a file.
fine-tuneThis object represents a fine tune job.
fine-tune-eventThis object represents an event of a fine tune job.
listThis object represents a list of other objects.
completionThis object represents a completion.
chat.completionThis object represents a chat completion.