Skip to content

Commit

Permalink
Merge branch 'main' into reorder-to-toolbox-layout
Browse files Browse the repository at this point in the history
  • Loading branch information
ccreutzi committed Aug 29, 2024
2 parents 4aacaed + 9ce8f94 commit 2b0e921
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tests/tmessageHistory.m
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,10 @@ function invalidInputsResponsePrompt(testCase, InvalidInputsResponseMessage)
struct("Input", {{0}}, ...
"Error", "MATLAB:validators:mustBePositive"), ...
...
"FromEmpty", ...
struct("Input", {{1}}, ...
"Error", "llms:removeFromEmptyHistory"), ...
...
"NonScalarInput", ...
struct("Input", {{[1 2]}}, ...
"Error", "MATLAB:validation:IncompatibleSize"));
Expand Down
1 change: 1 addition & 0 deletions toolbox/+llms/+utils/errorMessageCatalog.m
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
catalog("llms:mustBeAssistantWithNameAndArguments") = "Field 'function' must be a struct with fields 'name' and 'arguments'.";
catalog("llms:assistantMustHaveTextNameAndArguments") = "Fields 'name' and 'arguments' must be text with one or more characters.";
catalog("llms:mustBeValidIndex") = "Index exceeds the number of array elements. Index must be less than or equal to {1}.";
catalog("llms:removeFromEmptyHistory") = "Unable to remove message from empty message history.";
catalog("llms:stopSequencesMustHaveMax4Elements") = "Number of stop sequences must be less than or equal to 4.";
catalog("llms:endpointMustBeSpecified") = "Unable to find endpoint. Either set environment variable AZURE_OPENAI_ENDPOINT or specify name-value argument ""Endpoint"".";
catalog("llms:deploymentMustBeSpecified") = "Unable to find deployment name. Either set environment variable AZURE_OPENAI_DEPLOYMENT or specify name-value argument ""Deployment"".";
Expand Down
3 changes: 3 additions & 0 deletions toolbox/messageHistory.m
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,9 @@
this (1,1) messageHistory
idx (1,1) {mustBeInteger, mustBePositive}
end
if isempty(this.Messages)
error("llms:removeFromEmptyHistory",llms.utils.errorMessageCatalog.getMessage("llms:removeFromEmptyHistory"));
end
if idx>numel(this.Messages)
error("llms:mustBeValidIndex",llms.utils.errorMessageCatalog.getMessage("llms:mustBeValidIndex", string(numel(this.Messages))));
end
Expand Down

0 comments on commit 2b0e921

Please sign in to comment.