#openai prompt engineering how i can give chatbot identity of a company or representative

1 messages · Page 1 of 1 (latest)

cunning basin
#

How can I make make openai prompt engineering how i can give chatbot identity of a company or representative. I want that my gpt should represent like its representing my company. How I can achieve that? Explain me in node.js code

tough wolfBOT
#

Hi @cunning basin. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

#

You can give your chatbot the identity of a company or representative by setting up the system message in the conversation. The system message is used to set the behavior of the assistant. For example, you can instruct the assistant to behave like a representative of your company.

Here is an example of how you can do this in Node.js, based on the code provided in the extracts:

const {Configuration, OpenAIApi } = require('openai');

const configuration = new Configuration({
  apiKey: process.env.OPENAI_API_KEY,
});
const openai = new OpenAIApi(configuration);

async function chatGPT(prompt,question,model_gpt) {
  try 
    { 
          const response = await openai.createChatCompletion({
          model: model_gpt,
          messages: [
            {
              role: 'system',
              content: 'You are a helpful assistant that represents Company XYZ.'
            },
            {
              role: 'user',
              content: question
            }
          ]
        });
        const completion = response.data.choices[0].message.content;
        return completion;
    } 
}

In this example, the system message is 'You are a helpful assistant that represents Company XYZ.' This instructs the assistant to behave as if it is a representative of Company XYZ. You can replace 'Company XYZ' with the name of your company.

Remember to replace model_gpt with the model you are using (for example, 'gpt-3.5-turbo'), and question with the user's input.

Please note that the behavior of the AI can be influenced but not fully controlled. It's important to test and iterate on your instructions to get the desired output.

For more information on prompt engineering, you can refer to the OpenAI's prompt engineering guide (https://platform.openai.com/docs/guides/prompt-engineering) mentioned in the extracts.