Skip to content

Commit

Permalink
group simple questions
Browse files Browse the repository at this point in the history
  • Loading branch information
leehuwuj committed Jan 20, 2025
1 parent a52ba9a commit 81cb6c3
Showing 1 changed file with 49 additions and 24 deletions.
73 changes: 49 additions & 24 deletions questions/simple.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { ModelConfig, TemplateFramework } from "../helpers/types";
import { PureQuestionArgs, QuestionResults } from "./types";
import { askPostInstallAction, questionHandlers } from "./utils";

type AppType =
type UseCase =
| "rag"
| "code_artifact"
| "financial_report_agent"
Expand All @@ -22,7 +22,7 @@ type AppType =
| "blog";

type SimpleAnswers = {
appType: AppType;
useCase: UseCase;
language: TemplateFramework;
useLlamaCloud: boolean;
llamaCloudKey?: string;
Expand All @@ -35,38 +35,63 @@ export const askSimpleQuestions = async (
{
type: "select",
name: "appType",
message: "What app do you want to build?",
message: "What type of app do you want to build?",
choices: [
{ title: "Agentic RAG", value: "rag" },
{ title: "Data Scientist", value: "data_scientist" },
{
title: "Financial Report Generator (using Workflows)",
value: "financial_report_agent",
title: "Agentic Document Workflows",
value: "agentic_document_workflow",
},
{
title: "Form Filler (using Workflows)",
value: "form_filling",
},
{ title: "Code Artifact Agent", value: "code_artifact" },
{ title: "Information Extractor", value: "extractor" },
{
title: "Contract Review (using Workflows)",
value: "contract_review",
},
{ title: "Blog Writer (using Workflows)", value: "blog" },
{ title: "Agents", value: "agents" },
],
},
questionHandlers,
);

let useCaseOptions: prompts.Choice[];

if (appType === "agents") {
useCaseOptions = [
{ title: "Simple RAG chat app", value: "rag" },
{ title: "Data Scientist", value: "data_scientist" },
{ title: "Code Artifact Agent", value: "code_artifact" },
{ title: "Information Extractor", value: "extractor" },
];
} else {
useCaseOptions = [
{
title: "Financial Report Generator",
value: "financial_report_agent",
},
{
title: "Financial 10k SEC Form Filler",
value: "form_filling",
},
{
title: "Contract Review",
value: "contract_review",
},
{ title: "Blog Writer", value: "blog" },
];
}

const { useCase } = await prompts(
{
type: "select",
name: "useCase",
message: "What use case do you want to build?",
choices: useCaseOptions,
},
questionHandlers,
);

let language: TemplateFramework = "fastapi";
let llamaCloudKey = args.llamaCloudKey;
let useLlamaCloud = false;

if (
appType !== "extractor" &&
appType !== "contract_review" &&
appType !== "blog"
useCase !== "extractor" &&
useCase !== "contract_review" &&
useCase !== "blog"
) {
const { language: newLanguage } = await prompts(
{
Expand Down Expand Up @@ -112,7 +137,7 @@ export const askSimpleQuestions = async (
}

const results = await convertAnswers(args, {
appType,
useCase,
language,
useLlamaCloud,
llamaCloudKey,
Expand All @@ -137,7 +162,7 @@ const convertAnswers = async (
},
};
const lookup: Record<
AppType,
UseCase,
Pick<
QuestionResults,
"template" | "tools" | "frontend" | "dataSources" | "useCase"
Expand Down Expand Up @@ -203,7 +228,7 @@ const convertAnswers = async (
dataSources: [AI_REPORTS],
},
};
const results = lookup[answers.appType];
const results = lookup[answers.useCase];
return {
framework: answers.language,
ui: "shadcn",
Expand Down

0 comments on commit 81cb6c3

Please sign in to comment.