Skip to content

Commit

Permalink
[Copilot] Deprecate gpt35 deployment and add gpt4o & gpt4omini deploy…
Browse files Browse the repository at this point in the history
…ments (#1827)

<!-- Thank you for submitting a Pull Request. If you're new to
contributing to BCApps please read our pull request guideline below
* https://github.com/microsoft/BCApps/Contributing.md
-->
#### Summary <!-- Provide a general summary of your changes -->
This PR does 2 things
- Adds the GPT4o and GPT4o-mini deployment.
- Obsolete GPT35Turbo and GPT4 deployments

For managed resources, GPT35 is going away and being replaced by
GPT4o-mini.

Generic GPT4 deployment is going away as well, infavor for a specific
model name GPT4o. The underlying is exactly the same, just function name
difference.

#### Work Item(s) <!-- Add the issue number here after the #. The issue
needs to be open and approved. Submitting PRs with no linked issues or
unapproved issues is highly discouraged. -->
Fixes
[AB#544542](https://dynamicssmb2.visualstudio.com/1fcb79e7-ab07-432a-a3c6-6cf5a88ba4a5/_workitems/edit/544542)
and
[AB#544460](https://dynamicssmb2.visualstudio.com/1fcb79e7-ab07-432a-a3c6-6cf5a88ba4a5/_workitems/edit/544460)
  • Loading branch information
darjoo authored Aug 21, 2024
1 parent b9c1d64 commit a4ad32a
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ codeunit 324 "No. Series Copilot Impl."
if not AzureOpenAI.IsEnabled(Enum::"Copilot Capability"::"No. Series Copilot") then
exit;

AzureOpenAI.SetAuthorization(Enum::"AOAI Model Type"::"Chat Completions", AOAIDeployments.GetGPT35TurboLatest());
AzureOpenAI.SetAuthorization(Enum::"AOAI Model Type"::"Chat Completions", AOAIDeployments.GetGPT4oMiniLatest());
AzureOpenAI.SetCopilotCapability(Enum::"Copilot Capability"::"No. Series Copilot");
AOAIChatCompletionParams.SetMaxTokens(MaxOutputTokens());
AOAIChatCompletionParams.SetTemperature(0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,12 @@ codeunit 7768 "AOAI Deployments"
NavApp.GetCallerModuleInfo(CallerModuleInfo);
exit(AOAIDeploymentsImpl.GetTurbo0613(CallerModuleInfo));
end;
#endif

/// <summary>
/// Returns the name of the latest AOAI deployment model of GPT3.5 Turbo.
/// </summary>
/// <returns>The deployment name.</returns>
[Obsolete('GPT35 Turbo is no longer supported. Use GetGPT4oMiniLatest instead (or GetGPT4oMiniPreview for testing upcoming versions).', '25.0')]
procedure GetGPT35TurboLatest(): Text
var
CallerModuleInfo: ModuleInfo;
Expand All @@ -73,6 +73,7 @@ codeunit 7768 "AOAI Deployments"
/// Returns the name of preview AOAI deployment model of GPT3.5 Turbo.
/// </summary>
/// <returns>The deployment name.</returns>
[Obsolete('GPT35 Turbo is no longer supported. Use GetGPT4oMiniLatest instead (or GetGPT4oMiniPreview for testing upcoming versions).', '25.0')]
procedure GetGPT35TurboPreview(): Text
var
CallerModuleInfo: ModuleInfo;
Expand All @@ -85,6 +86,7 @@ codeunit 7768 "AOAI Deployments"
/// Returns the name of the latest AOAI deployment model of GPT4.
/// </summary>
/// <returns>The deployment name.</returns>
[Obsolete('Generic GPT4 deployment name is no longer supported. Use GetGPT4oLatest instead (or GetGPT4oPreview for testing upcoming versions).', '25.0')]
procedure GetGPT4Latest(): Text
var
CallerModuleInfo: ModuleInfo;
Expand All @@ -97,11 +99,61 @@ codeunit 7768 "AOAI Deployments"
/// Returns the name of preview AOAI deployment model of GPT4.
/// </summary>
/// <returns>The deployment name.</returns>
[Obsolete('Generic GPT4 deployment name is no longer supported. Use GetGPT4oLatest instead (or GetGPT4oPreview for testing upcoming versions).', '25.0')]
procedure GetGPT4Preview(): Text
var
CallerModuleInfo: ModuleInfo;
begin
NavApp.GetCallerModuleInfo(CallerModuleInfo);
exit(AOAIDeploymentsImpl.GetGPT4Preview(CallerModuleInfo));
end;
#endif

/// <summary>
/// Returns the name of the latest AOAI deployment model of GPT4o.
/// </summary>
/// <returns>The deployment name.</returns>
procedure GetGPT4oLatest(): Text
var
CallerModuleInfo: ModuleInfo;
begin
NavApp.GetCallerModuleInfo(CallerModuleInfo);
exit(AOAIDeploymentsImpl.GetGPT4oLatest(CallerModuleInfo));
end;

/// <summary>
/// Returns the name of preview AOAI deployment model of GPT4o.
/// </summary>
/// <returns>The deployment name.</returns>
procedure GetGPT4oPreview(): Text
var
CallerModuleInfo: ModuleInfo;
begin
NavApp.GetCallerModuleInfo(CallerModuleInfo);
exit(AOAIDeploymentsImpl.GetGPT4oPreview(CallerModuleInfo));
end;

/// <summary>
/// Returns the name of the latest AOAI deployment model of GPT4o-Mini.
/// </summary>
/// <returns>The deployment name.</returns>
procedure GetGPT4oMiniLatest(): Text
var
CallerModuleInfo: ModuleInfo;
begin
NavApp.GetCallerModuleInfo(CallerModuleInfo);
exit(AOAIDeploymentsImpl.GetGPT4oMiniLatest(CallerModuleInfo));
end;

/// <summary>
/// Returns the name of preview AOAI deployment model of GPT4o-Mini.
/// </summary>
/// <returns>The deployment name.</returns>
procedure GetGPT4oMiniPreview(): Text
var
CallerModuleInfo: ModuleInfo;
begin
NavApp.GetCallerModuleInfo(CallerModuleInfo);
exit(AOAIDeploymentsImpl.GetGPT4oMiniPreview(CallerModuleInfo));
end;
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,15 @@ codeunit 7769 "AOAI Deployments Impl"

var
UnableToGetDeploymentNameErr: Label 'Unable to get deployment name, if this is a third party capability you must specify your own deployment name. You may need to contact your partner.';
GPT4oLatestLbl: Label 'gpt-4o-latest', Locked = true;
GPT4oPreviewLbl: Label 'gpt-4o-preview', Locked = true;
GPT4oMiniLatestLbl: Label 'gpt-4o-mini-latest', Locked = true;
GPT4oMiniPreviewLbl: Label 'gpt-4o-mini-preview', Locked = true;
#if not CLEAN25
GPT4LatestLbl: Label 'gpt-4-latest', Locked = true;
GPT4PreviewLbl: Label 'gpt-4-preview', Locked = true;
GPT35TurboLatestLbl: Label 'gpt-35-turbo-latest', Locked = true;
GPT35TurboPreviewLbl: Label 'gpt-35-turbo-preview', Locked = true;
#if not CLEAN25
Turbo0301SaasLbl: Label 'turbo-0301', Locked = true;
GPT40613SaasLbl: Label 'gpt4-0613', Locked = true;
Turbo0613SaasLbl: Label 'turbo-0613', Locked = true;
Expand Down Expand Up @@ -57,7 +61,6 @@ codeunit 7769 "AOAI Deployments Impl"

exit(Turbo031316kLbl);
end;
#endif

procedure GetGPT35TurboPreview(CallerModuleInfo: ModuleInfo): Text
begin
Expand All @@ -78,6 +81,27 @@ codeunit 7769 "AOAI Deployments Impl"
begin
exit(GetDeploymentName(GPT4LatestLbl, CallerModuleInfo));
end;
#endif

procedure GetGPT4oPreview(CallerModuleInfo: ModuleInfo): Text
begin
exit(GetDeploymentName(GPT4oPreviewLbl, CallerModuleInfo));
end;

procedure GetGPT4oLatest(CallerModuleInfo: ModuleInfo): Text
begin
exit(GetDeploymentName(GPT4oLatestLbl, CallerModuleInfo));
end;

procedure GetGPT4oMiniPreview(CallerModuleInfo: ModuleInfo): Text
begin
exit(GetDeploymentName(GPT4oMiniPreviewLbl, CallerModuleInfo));
end;

procedure GetGPT4oMiniLatest(CallerModuleInfo: ModuleInfo): Text
begin
exit(GetDeploymentName(GPT4oMiniLatestLbl, CallerModuleInfo));
end;

local procedure GetDeploymentName(DeploymentName: Text; CallerModuleInfo: ModuleInfo): Text
var
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ codeunit 2012 "Entity Text Impl."
AzureOpenAI.SetAuthorization(Enum::"AOAI Model Type"::"Chat Completions", Endpoint, Deployment, ApiKey)
else
if (not IsNullGuid(CallerModuleInfo.Id())) and (CallerModuleInfo.Publisher() = EntityTextModuleInfo.Publisher()) then
AzureOpenAI.SetAuthorization(Enum::"AOAI Model Type"::"Chat Completions", AOAIDeployments.GetGPT4Latest())
AzureOpenAI.SetAuthorization(Enum::"AOAI Model Type"::"Chat Completions", AOAIDeployments.GetGPT4oLatest())
else begin
TelemetryCD.Add('CallerModuleInfo', Format(CallerModuleInfo.Publisher()));
TelemetryCD.Add('EntityTextModuleInfo', Format(EntityTextModuleInfo.Publisher()));
Expand Down

0 comments on commit a4ad32a

Please sign in to comment.