Example

const prompt = PromptTemplate.fromTemplate(`What is the answer to {question}?`);

// Example of using LLMChain to process a series of questions
const chain = new LLMChain({
llm: new ChatOpenAI({ temperature: 0.9 }),
prompt,
});

// Process questions using the chain
const processQuestions = async (questions) => {
for (const question of questions) {
const result = await chain.call({ question });
console.log(result);
}
};

// Example questions
const questions = [
"What is your name?",
"What is your quest?",
"What is your favorite color?",
];

// Run the example
processQuestions(questions).catch(console.error);

Hierarchy

  • TraceGroup

Constructors

Methods

Constructors

Methods

Generated using TypeDoc