Skip to content

Commit

Permalink
Merge pull request #1013 from WolframResearch/bugfix/455809
Browse files Browse the repository at this point in the history
Add error message for invalid prompt generator
  • Loading branch information
rhennigan authored Jan 6, 2025
2 parents 1ccf2f0 + 4006c94 commit 75d371b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Source/Chatbook/PromptGenerators/DefaultPromptGenerators.wl
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ HoldComplete[
System`LLMPromptGenerator
];

(* ::**************************************************************************************************************:: *)
(* ::Section::Closed:: *)
(*Messages*)
Chatbook::InvalidPromptGenerator = "Expected a valid LLMPromptGenerator instead of `1`.";

(* ::**************************************************************************************************************:: *)
(* ::Section::Closed:: *)
(*DefaultPromptGenerators*)
Expand Down Expand Up @@ -157,6 +162,7 @@ toPromptGenerator // beginDefinition;
toPromptGenerator[ ___ ] /; $VersionNumber < 14.1 := Nothing;
toPromptGenerator[ name_String ] := toPromptGenerator @ $defaultPromptGenerators @ name;
toPromptGenerator[ generator: HoldPattern[ _LLMPromptGenerator ] ] := generator;
toPromptGenerator[ other_ ] := throwFailure[ "InvalidPromptGenerator", other ];
toPromptGenerator // endDefinition;

(* ::**************************************************************************************************************:: *)
Expand Down

0 comments on commit 75d371b

Please sign in to comment.