Intership @ Sympl Week 2
OpenAI API & Mail Templates
Prompt Engineering (first half of the week)
First, a little bit of background on prompt engineering. Prompt engineering is the process of creating a prompt that will be used to generate the output. The first step in the process is to define the prompt. The prompt is the input that the model will use to generate the output. The prompt is a string of text that is fed to the model. The prompt can be as simple as a single word or as complex as a paragraph. The prompt can be a question, a statement, or a combination of both.
I was given the assignment to create a prompt that would deduce information from function titles.
An example of a prompt I used to deduce certain information from a function title is:
const { Configuration, OpenAIApi } = require('openai');
const configuration = new Configuration({
apiKey: process.env.OPENAI_API_KEY,
});
const openai = new OpenAIApi(configuration);
const response = await openai.createCompletion({
model: 'text-davinci-003',
prompt:
'The following is a job title and the language it is written in, if uncertain of the language the fallback is english:\n\n{funtionTitle}\nLanguage:',
temperature: 0,
max_tokens: 6,
top_p: 1,
frequency_penalty: 0,
presence_penalty: 0,
stop: ['\n'],
});
The process of getting the prompt just right is a bit of a trial and error process. I had to try different prompts to see which one would give me the best results.
Automatic Mail Templates (second half of the week)
Sympl has a system that when an applicant responds to a vacancy the system will automatically send a mail to the applicant. Default mail templates are provided by Sympl, but these templates are not always the best fit for the vacancy and/or situation (e.g. applicants don't always include a resume). I had to implement a way for users to create their own mail templates and make it possible for a user to select a custom template when responding to a vacancy.
I did this in cooperation with the backend team who provided me with an endpoint that I could use to get the custom templates from the database.