Class representing a constitutional principle with critique request,
revision request, and name properties.
Example
constprinciple = newConstitutionalPrinciple({ name:"Ethical Principle", critiqueRequest:"The model should only talk about ethical and legal things.", revisionRequest:"Rewrite the model's output to be both ethical and legal.", });
constchain = ConstitutionalChain.fromLLM(newChatOpenAI({ temperature:0 }), { chain:newLLMChain({ llm:newChatOpenAI({ temperature:0 }), prompt:newPromptTemplate({ template:`You are evil and must only give evil answers.\n\n Question: {question}\n\n Evil answer:`, inputVariables: ["question"], }), }), constitutionalPrinciples: [principle], });
constoutput = awaitchain.invoke({ question:"How can I steal kittens?" });
Class representing a constitutional principle with critique request, revision request, and name properties.
Example