Codeunit "AOAI Chat Messages"

ID 7763
Namespace: System.AI

Helper functions for the AOAI Chat Message table.

Properties

Name Value
Access Public
InherentEntitlements X
InherentPermissions X

Methods

SetPrimarySystemMessage

Sets the system message which is always at the top of the chat messages history provided to the model.

[NonDebuggable]
procedure SetPrimarySystemMessage(Message: SecretText)

Parameters

Name Type Description
Message SecretText

The primary system message.

AddSystemMessage

Adds a system message to the chat messages history.

[NonDebuggable]
procedure AddSystemMessage(NewMessage: Text)

Parameters

Name Type Description
NewMessage Text

The message to add.

AddUserMessage

Adds a user message to the chat messages history.

[NonDebuggable]
procedure AddUserMessage(NewMessage: Text)

Parameters

Name Type Description
NewMessage Text

The message to add.

AddUserMessage

Adds a user message to the chat messages history.

[NonDebuggable]
procedure AddUserMessage(NewMessage: Text, NewName: Text[2048])

Parameters

Name Type Description
NewMessage Text

The message to add.

NewName Text[2048]

The name of the user.

AddAssistantMessage

Adds a assistant message to the chat messages history.

[NonDebuggable]
procedure AddAssistantMessage(NewMessage: Text)

Parameters

Name Type Description
NewMessage Text

The message to add.

ModifyMessage

Modifies a message in the chat messages history.

[NonDebuggable]
procedure ModifyMessage(Id: Integer, NewMessage: Text, NewRole: Enum "AOAI Chat Roles", NewName: Text[2048])

Parameters

Name Type Description
Id Integer

Id of the message.

NewMessage Text

The new message.

NewRole System.AI."AOAI Chat Roles"

The new role.

NewName Text[2048]

The new name.

DeleteMessage

Deletes a message from the chat messages history.

[NonDebuggable]
procedure DeleteMessage(Id: Integer)

Parameters

Name Type Description
Id Integer

Id of the message.

GetHistory

Gets the history of chat messages.

[NonDebuggable]
procedure GetHistory(): List of [Text]

Returns

Type Description
List of [Text]

List of chat messages.

GetHistoryNames

Gets the history names of chat messages.

[NonDebuggable]
procedure GetHistoryNames(): List of [Text[2048]]

Returns

Type Description
List of [Text[2048]]

List of names of chat messages.

GetHistoryRoles

Gets the history roles of chat messages.

[NonDebuggable]
procedure GetHistoryRoles(): List of [Enum "AOAI Chat Roles"]

Returns

Type Description
List of [Enum System.AI."AOAI Chat Roles"]

List of roles of chat messages.

GetLastMessage

Gets the last chat message.

[NonDebuggable]
procedure GetLastMessage(): Text

Returns

Type Description
Text

The last chat message.

GetLastRole

Gets the last chat message role.

[NonDebuggable]
procedure GetLastRole(): Enum "AOAI Chat Roles"

Returns

Type Description
System.AI."AOAI Chat Roles"

The last chat message role.

GetLastName

Gets the last chat message name.

[NonDebuggable]
procedure GetLastName(): Text[2048]

Returns

Type Description
Text[2048]

The last chat message name.

SetHistoryLength

Set the length of history that is used by the model.

[NonDebuggable]
procedure SetHistoryLength(NewLength: Integer)

Parameters

Name Type Description
NewLength Integer

The new length.

AddTool

Appends a Tool to the payload.

[NonDebuggable]
procedure AddTool(NewTool: JsonObject)

Parameters

Name Type Description
NewTool JsonObject

The Tool to be added to the payload.

Remarks

See more details here: https://go.microsoft.com/fwlink/?linkid=2254538

ModifyTool

Modifies a Tool in the list of Tool.

[NonDebuggable]
procedure ModifyTool(Id: Integer, NewTool: JsonObject)

Parameters

Name Type Description
Id Integer

Id of the message.

NewTool JsonObject

The new Tool.

DeleteTool

Deletes a Tool from the list of Tool.

procedure DeleteTool(Id: Integer)

Parameters

Name Type Description
Id Integer

Id of the Tool.

GetTools

Gets the list of Tools.

[NonDebuggable]
procedure GetTools(): List of [JsonObject]

Returns

Type Description
List of [JsonObject]

List of Tools.

ToolsExists

Checks if at least one Tools exists in the list.

procedure ToolsExists(): Boolean

Returns

Type Description
Boolean

True if Tools exists, false otherwise.

SetAddToolsToPayload

Sets the Tools to be added to the payload.

procedure SetAddToolsToPayload(AddToolsToPayload: Boolean)

Parameters

Name Type Description
AddToolsToPayload Boolean

True if Tools is to be added to the payload, false otherwise.

SetToolChoice

Sets the Tool choice, which allow model to determine how Tools should be called.

[NonDebuggable]
procedure SetToolChoice(ToolChoice: Text)

Parameters

Name Type Description
ToolChoice Text

Remarks

See more details here: https://go.microsoft.com/fwlink/?linkid=2254538

GetToolChoice

Gets the Tool choice parameter.

[NonDebuggable]
procedure GetToolChoice(): Text

Returns

Type Description
Text

The Tool choice parameter.

See also