Skip to content

Commit

Permalink
fix(create_tool): clearer options to enable SM models
Browse files Browse the repository at this point in the history
  • Loading branch information
massi-ang authored and bigadsoleiman committed Nov 24, 2023
1 parent e1ff5e1 commit 7931a31
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions cli/magic-create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ const embeddingModels = [
options.bedrockEndpoint = config.bedrock?.endpointUrl;
options.bedrockRoleArn = config.bedrock?.roleArn;
options.sagemakerModels = config.llms?.sagemaker ?? [];
options.enableSagemakerModels = config.llms?.sagemaker
? config.llms?.sagemaker.length > 0
: false;
options.enableRag = config.rag.enabled;
options.ragsToEnable = Object.keys(config.rag.engines ?? {}).filter(
(v: string) => (config.rag.engines as any)[v].enabled
Expand Down Expand Up @@ -153,6 +156,12 @@ async function processCreateOptions(options: any): Promise<void> {
},
initial: options.bedrockRoleArn || "",
},
{
type: "confirm",
name: "enableSagemakerModels",
message: "Do you want to use any Sagemaker Models",
initial: options.enableSagemakerModels || false,
},
{
type: "multiselect",
name: "sagemakerModels",
Expand All @@ -165,6 +174,15 @@ async function processCreateOptions(options: any): Promise<void> {
.map((x) => x.toString())
.includes(m)
) || [],
validate(choices: any) {
return choices.length > 0
? true
: "You need to select at least one model";
},
skip(): boolean {
(this as any).state._choices = (this as any).state.choices;
return !(this as any).state.answers.enableSagemakerModels;
},
},
{
type: "confirm",
Expand Down Expand Up @@ -198,8 +216,6 @@ async function processCreateOptions(options: any): Promise<void> {
options.kendraExternal.length > 0) ||
false,
skip: function (): boolean {
// workaround for https://github.com/enquirer/enquirer/issues/298
(this as any).state._choices = (this as any).state.choices;
return !(this as any).state.answers.enableRag;
},
},
Expand Down

0 comments on commit 7931a31

Please sign in to comment.