How to set the system tone and use a template in LangChainJS?

174 views Asked by At

I am playing around with the LangChain JavaScript library and wanted to make sure I am doing this correctly.

My goals is to set the tone of the AI (who they are) and then pass in some context and let it ask a question about that context.

So this is what I do:

promptTemplate = new PromptTemplate({
  template: templates.initial,
  inputVariables: ["context"],
});
inputWithContext = await promptTemplate.format({
  context: text,
});
const res = await model.call(inputWithContext);

Where templates.initial is:

CONTEXT: {context}

WHO YOU ARE: You are someone who gives back bad feedback.

QUERY: Given the context and who you are, give the user some feedback and end with a question.

First question:

Is that the correct way of doing this? I noticed there are some SystemMessage objects but not sure if I need those? If not how would you structure this?

0

There are 0 answers