Codeunit 7763 "AOAI Chat Messages"
System Application · System.AI
Across versions
- BC23present
- BC2418 procedures added
- BC254 procedures added
- BC26unchanged
- BC271 procedures added
- BC284 procedures removed, 3 procedures added
- BC29-30unchanged
Neighbourhood 16 connected objects and pages
System Application · System.AI · BC23-30 · source at ea08af5e · facts from BC29
Properties
| Property | Value |
|---|---|
| Access | Public |
Procedures
SetPrimarySystemMessage(Message: SecretText): Sets the system message which is always at the top of the chat messages history provided to the model.AddSystemMessage(NewMessage: Text): Adds a system message to the chat messages history.AddUserMessage(NewMessage: Text)+ BC28 + BC28: Adds a user message to the chat messages history.AddUserMessage(NewMessage: Text; NewName: Text[2048])+ BC28 + BC28: Adds a user message to the chat messages history.AddUserMessage(AOAIUserMessage: Codeunit "AOAI User Message")+ BC28 + BC28: Adds a user message with structured content parts to the chat messages history.AddUserMessage(AOAIUserMessage: Codeunit "AOAI User Message"; NewName: Text[2048])+ BC28 + BC28: Adds a user message with structured content parts to the chat messages history.AddAssistantMessage(NewMessage: Text): Adds a assistant message to the chat messages history.AddToolCalls(ToolCalls: JsonArray)+ BC25 (internal): Adds a assistant message containing the tool calls returned from the model to the chat messages history.AddToolMessage(ToolCallId: Text; FunctionName: Text; FunctionResult: Text)+ BC24: Adds a tool result to the chat messages history.ModifyMessage(Id: Integer; NewMessage: Text; NewRole: Enum "AOAI Chat Roles"; NewName: Text[2048]): Modifies a message in the chat messages history.DeleteMessage(Id: Integer): Deletes a message from the chat messages history.GetHistory(): List of [Text]: Gets the history of chat messages.GetHistoryNames(): List of [Text[2048]]: Gets the history names of chat messages.GetHistoryRoles(): List of [Enum "AOAI Chat Roles"]: Gets the history roles of chat messages.GetLastMessage(): Text: Gets the last chat message.GetLastRole(): Enum "AOAI Chat Roles": Gets the last chat message role.GetLastName(): Text[2048]: Gets the last chat message name.GetLastToolCalls(): JsonArray+ BC25: Gets a copy of the last chat message tool calls array.SetHistoryLength(NewLength: Integer): Set the length of history that is used by the model.AssembleHistory(var SystemMessageTokenCount: Integer; var MessagesTokenCount: Integer): JsonArray(internal): Prepares the history of messages to be sent to the deployment model.GetHistoryTokenCount(): Integer+ BC24: Gets the number of tokens used by the primary system messages and all other messages.AddTool(Function: Interface "AOAI Function")+ BC24 + BC24 − BC28: Adds a function to the payload.DeleteFunctionTool(Name: Text): Boolean+ BC24: Deletes a Function from the list of Functions.ClearTools()+ BC24: Remove all tools.GetFunctionTool(Name: Text; var Function: Interface "AOAI Function"): Boolean+ BC24: Gets the function associated with the specified name.GetFunctionTools(): List of [Text]+ BC24: Gets the list of names of Function Tools that have been added.ToolsExists(): Boolean+ BC24: Checks if at least one Tools exists in the list.SetAddToolsToPayload(AddToolsToPayload: Boolean)+ BC24: Sets the Tools to be added to the payload.SetToolChoice(ToolChoice: Text)+ BC24: Sets the Tool choice, which allow model to determine how Tools should be called.SetFunctionAsToolChoice(FunctionName: Text)+ BC24 + BC24: Sets the function as the tool choice to be called.SetFunctionAsToolChoice(Function: Interface "AOAI Function")+ BC24 + BC24: Sets the function as the tool choice to be called.GetToolChoice(): Text+ BC24: Gets the Tool choice parameter.SetToolInvokePreference(AOAIToolInvokePreference: Enum "AOAI Tool Invoke Preference")+ BC25: Sets the tool invocation preference, controls how a tool calls response should be handled.GetToolInvokePreference(): Enum "AOAI Tool Invoke Preference"+ BC25: Gets the tool invocation preference, controls how a tool calls response should be handled.AddXPIADetectionTags(var Input: Text)+ BC27: Adds XPIA Detection tags to an Input text.AssembleTools(): JsonArray+ BC24 (internal): Prepares the Tools to be sent to the deployment model.CheckCompatibilityWithModel(Deployment: SecretText)+ BC28 (internal): Checks if the current chat messages history is compatible with the deployment model
Calls
From the extracted call graph of BC29 (graphify-al on the snapshot checkout): calls whose target is known from a declared type or an Object::"Name" argument. Interface dispatch and calls through events are not counted, so the list is not complete.
- Codeunit 7764 “AOAI Chat Messages Impl” (20 calls:
AddAssistantMessage → AddAssistantMessage,AddSystemMessage → AddSystemMessage,AddToolCalls → AddToolCalls, …) - Codeunit 7778 “AOAI Tools Impl” (13 calls:
AddTool → AddTool,AssembleTools → PrepareTools,ClearTools → ClearTools, …)
Called by
- Codeunit 324 “No. Series Copilot Impl.” (10 calls:
GenerateAndReviewToolCompletionWithRetry → DeleteMessage,GenerateAndReviewToolCompletionWithRetry → GetHistory,GenerateNoSeries → AddTool, …) - Codeunit 4402 “SOA Output Message Setup” (10 calls:
AddSignatureToMessageBody → AddTool,AddSignatureToMessageBody → AddUserMessage,AddSignatureToMessageBody → SetPrimarySystemMessage, …) - Codeunit 4399 “SOA Annotation” (6 calls:
CheckIfMessageRelevant → AddAssistantMessage,CheckIfMessageRelevant → AddTool,CheckIfMessageRelevant → AddUserMessage, …) - Codeunit 7772 “Azure OpenAI Impl” (5 calls:
ProcessChatCompletionResponse → AddAssistantMessage,ProcessChatCompletionResponse → AddToolCalls,ProcessChatCompletionResponse → GetToolInvokePreference, …) - Codeunit 2012 “Entity Text Impl.” (4 calls:
GenerateCompletion → AddTool,GenerateCompletion → AddUserMessage,GenerateCompletion → SetPrimarySystemMessage, …) - Codeunit 6331 “Sustainability Chat Completion” (4 calls:
GenerateChatCompletion → AddTool,GenerateChatCompletion → AddUserMessage,GenerateChatCompletion → SetPrimarySystemMessage, …) - Codeunit 7275 “Sales Lines Suggestions Impl.” (4 calls:
AICall → AddTool,AICall → AddUserMessage,AICall → SetPrimarySystemMessage, …) - Codeunit 7330 “Item Subst. Suggestion Impl.” (4 calls:
AICall → AddTool,AICall → AddUserMessage,AICall → SetPrimarySystemMessage, …) - Codeunit 4417 “SOA Item Selector” (3 calls:
TrySelectBestMatchingItems → AddTool,TrySelectBestMatchingItems → AddUserMessage,TrySelectBestMatchingItems → SetPrimarySystemMessage) - Codeunit 4596 “SOA Broader Item Search” (3 calls:
AICall → AddTool,AICall → AddUserMessage,AICall → SetPrimarySystemMessage) - Codeunit 7251 “Bank Acc. Rec. Trans. to Acc.” (3 calls:
GetCompletionResponse → AddSystemMessage,GetCompletionResponse → AddUserMessage,GetCompletionResponse → AddXPIADetectionTags) - Codeunit 4421 “SOA Attachment MLLM” (2 calls:
TryExtractAttachmentContent → AddUserMessage,TryExtractAttachmentContent → SetPrimarySystemMessage) - Codeunit 7770 “AOAI Operation Response” (2 calls:
AppendFunctionResponsesToChatMessages → GetLastRole,AppendFunctionResponsesToChatMessages → GetLastToolCalls) - Codeunit 7758 “AOAI Function Response” (1 call:
AppendResultToChatMessages → AddToolMessage)
Ask your agent
Procedure bodies are not stored here (D10). The call sections above are our own, per object, from the BC29 call graph. For a procedure body or the calls of one procedure, ask bc-code-atlas (external, by Stefan Maron, MIT; default corpus w1-28), which the bc-observatory plugin connects: bcatlas_resolve_node(object_type: "codeunit", object_name: "AOAI Chat Messages"), then bcatlas_get_procedure_body or bcatlas_get_neighbors on the returned id.