---
title: "Codeunit 7763 AOAI Chat Messages"
author: "Jonas Paprotka"
url: https://jonas-paprotka.de/ref/codeunit/7763-aoai-chat-messages/
type: codeunit
id: 7763
name: "AOAI Chat Messages"
app: "System Application"
namespace: System.AI
versions: "23-28"
build: 28.5.54151.54365
source: "https://jonas-paprotka.de/ref/codeunit/7763-aoai-chat-messages/source/24/ https://jonas-paprotka.de/ref/codeunit/7763-aoai-chat-messages/source/25/ https://jonas-paprotka.de/ref/codeunit/7763-aoai-chat-messages/source/26/ https://jonas-paprotka.de/ref/codeunit/7763-aoai-chat-messages/source/27/ https://jonas-paprotka.de/ref/codeunit/7763-aoai-chat-messages/source/28/ https://jonas-paprotka.de/ref/codeunit/7763-aoai-chat-messages/source/29/"
checked: 2026-09-20
subject: "Microsoft Dynamics 365 Business Central"
license: "Content © 2026 Jonas Paprotka. Quote freely with attribution and a link."
---

# Codeunit 7763 AOAI Chat Messages

Jonas Paprotka, https://jonas-paprotka.de/ref/codeunit/7763-aoai-chat-messages/

| | |
| --- | --- |
| App | System Application |
| Namespace | System.AI |
| Versions | 23-28 |
| Source file | AI/src/Azure OpenAI/Chat Completion/AOAIChatMessages.Codeunit.al |

## Procedures

| Name | Parameters | Returns | Access | Versions | Obsolete | Reason |
| --- | --- | --- | --- | --- | --- | --- |
| SetPrimarySystemMessage | (SecretText) | - | public | 23-28 | - | - |
| AddSystemMessage | (Text) | - | public | 23-28 | - | - |
| AddUserMessage | (Text) | - | public | 23-28 | - | - |
| AddUserMessage | (Text, Text[2048]) | - | public | 23-28 | - | - |
| AddAssistantMessage | (Text) | - | public | 23-28 | - | - |
| ModifyMessage | (Integer, Text, Enum AOAI Chat Roles, Text[2048]) | - | public | 23-28 | - | - |
| DeleteMessage | (Integer) | - | public | 23-28 | - | - |
| GetHistory | () | List | public | 23-28 | - | - |
| GetHistoryNames | () | List | public | 23-28 | - | - |
| GetHistoryRoles | () | List | public | 23-28 | - | - |
| GetLastMessage | () | Text | public | 23-28 | - | - |
| GetLastRole | () | Enum AOAI Chat Roles | public | 23-28 | - | - |
| GetLastName | () | Text[2048] | public | 23-28 | - | - |
| SetHistoryLength | (Integer) | - | public | 23-28 | - | - |
| AssembleHistory | (var Integer, var Integer) | JsonArray | internal | 23-28 | - | - |
| AddToolMessage | (Text, Text, Text) | - | public | 24-28 | - | - |
| GetHistoryTokenCount | () | Integer | public | 24-28 | - | - |
| AddTool | (JsonObject) | - | public | 24-27 | Pending 25.0 | Use AddTool that takes in an AOAI Function interface. |
| ModifyTool | (Integer, JsonObject) | - | public | 24-27 | Pending 25.0 | Deprecated with no replacement. Use DeleteFunctionTool and AddTool. |
| DeleteTool | (Integer) | - | public | 24-27 | Pending 25.0 | Use DeleteFunctionTool that takes in a function name instead. |
| AddTool | (Interface AOAI Function) | - | public | 24-28 | - | - |
| DeleteFunctionTool | (Text) | Boolean | public | 24-28 | - | - |
| ClearTools | () | - | public | 24-28 | - | - |
| GetFunctionTool | (Text, var Interface AOAI Function) | Boolean | public | 24-28 | - | - |
| GetFunctionTools | () | List | public | 24-28 | - | - |
| GetTools | () | List | public | 24-27 | Pending 25.0 | Use GetFunctionTool() that takes in a function name and returns the interface. |
| ToolsExists | () | Boolean | public | 24-28 | - | - |
| SetAddToolsToPayload | (Boolean) | - | public | 24-28 | - | - |
| SetToolChoice | (Text) | - | public | 24-28 | - | - |
| SetFunctionAsToolChoice | (Text) | - | public | 24-28 | - | - |
| SetFunctionAsToolChoice | (Interface AOAI Function) | - | public | 24-28 | - | - |
| GetToolChoice | () | Text | public | 24-28 | - | - |
| AssembleTools | () | JsonArray | internal | 24-28 | - | - |
| AddToolCalls | (JsonArray) | - | internal | 25-28 | - | - |
| GetLastToolCalls | () | JsonArray | public | 25-28 | - | - |
| SetToolInvokePreference | (Enum AOAI Tool Invoke Preference) | - | public | 25-28 | - | - |
| GetToolInvokePreference | () | Enum AOAI Tool Invoke Preference | public | 25-28 | - | - |
| AddXPIADetectionTags | (var Text) | - | public | 27-28 | - | - |
| AddUserMessage | (Codeunit AOAI User Message) | - | public | 28 | - | - |
| AddUserMessage | (Codeunit AOAI User Message, Text[2048]) | - | public | 28 | - | - |
| CheckCompatibilityWithModel | (SecretText) | - | internal | 28 | - | - |

## Source

Symbols: Microsoft.SystemApplication.symbols.63ca2fa4-4f03-4f2b-a480-172fef340d3f, https://dynamicssmb2.pkgs.visualstudio.com/DynamicsBCPublicFeeds/_packaging/MSSymbols/nuget/v3/index.json, highest build per major on 2026-09-20.
AL source 24: https://github.com/microsoft/BCApps, MIT, releases/24.x at fe14d3e6db00d28df3a69c7bba830813d70794e2.
AL source 25: https://github.com/microsoft/BCApps, MIT, releases/25.x at 68d52c129129c83b2e396a473aaa5b2ce61d2eed.
AL source 26: https://github.com/microsoft/BCApps, MIT, releases/26.x at 78c4acf0d64a8eee157ea80164fa8fc2acffc9eb.
AL source 27: https://github.com/microsoft/BCApps, MIT, releases/27.x at 1749020b4c9445a43e4f7f540e89b7fa76ec25fd.
AL source 28: https://github.com/microsoft/BCApps, MIT, releases/28.x at 740f59156b249f8ed7cba2e28423f03ae7b07233.
AL source 29: https://github.com/microsoft/BCApps, MIT, releases/29.x at a66254c3b8b5bb1cea290dc8f9d097aec4381153.

Jonas Paprotka, 2026-09-20.
