0.1.1 • Published 1 year ago
@regscale/regml-questionnaire-builder v0.1.1
RegML Questionnaire Builder - @regscale/regml-questionnaire-builder
RegML Questionnaire Builder is an AI-driven utility to create questionnaires based on a given topic, goals, sections, and the intended audience.
Installation
Clone this repository and change directory to be in the repository.
Install Using NPM
npm install @regscale/regml-questionnaire-builderInstall Using Yarn:
yarn add @regscale/regml-questionnaire-builderUsage
Create an instance of RegmlQuestionnaireBuilder and then call its run method with appropriate arguments.
The code snippet below demonstrates how to use RegmlQuestionnaireBuilder:
import {RegMLQuestionnaireBuilder} from '@regscale/regml-questionnaire-builder'
// const regml = ... Initialize an instance of RegML here...
const builder = new RegmlQuestionnaireBuilder(regml);
(async () => {
const result = await builder.run({
topic: "Climate Change",
goals: ["Understand public perception", "Analyze effects on daily life"],
sections: ["Public Opinion", "Daily Life Impact"],
intendedAudience: "General Public"
});
console.log(result.parsed.questions);
})();Input
The run method of RegmlQuestionnaireBuilder accepts an object of type RegMLQuestionnaireBuilderArgs.
Here's a sample input:
{
topic: "Climate Change",
goals: ["Understand public perception", "Analyze effects on daily life"],
sections: ["Public Opinion", "Daily Life Impact"],
intendedAudience: "General Public"
}topic: This is the main theme that the questionnaire should cover.goals: These are additional specific objectives for the questionnaire (optional).sections: These are the segments of the questionnaire to be created (optional).intendedAudience: Specifies the target group for the questionnaire.
Output
RegMLQuestionnaireBuilder yields a result of type RegMLQuestionnaireBuilderResponse. Here's an example output based on the input provided above:
{
parsed: {
questions: [
{
section: "Public Opinion",
question: "Do you believe in Climate Change?",
type: "boolean"
},
{
section: "Public Opinion",
question: "What are the main causes of Climate Change, according to you?",
type: "string"
},
{
section: "Daily Life Impact",
question: "How has Climate Change affected your daily life?",
type: "string"
}
]
},
raw: {
responses: [...]
}
}parsed: This contains the structured data - which consists of an array of objects each representing a question.raw: Includes the raw responses received from OpenAI.