Project

General

Profile

Task #3074

Feature #3024: extension 0.92.20 & 0.93: Enable OpenAI answers

Feature #3061: Backend requirements

BE-0.92.20: Allow caching to the OpenAI encrypted secret key.

Added by Ayush Khandelwal over 1 year ago. Updated over 1 year ago.

Status:
Closed
Priority:
High
Target version:
Start date:
06/20/2023
Due date:
06/23/2023
% Done:

100%

Estimated time:
2.00 h
Spent time:

Description

1. Go to the login page, https://edutestqa.appspot.com/admin/login
2. Login through 'Admin' role user.
3. Go to the settings page for OpenAI, https://edutestqa.appspot.com/admin/qnageneration/settings#openAiAnswerConfigForm
4. When we put the secret key, 'something' and then click on 'Set'. It will go & saved into the datastore.

At the time of calling the OpenAI Answer API, it will fetch the secret key from the datastore every time. It will increase the load time. So in order to make it efficient, we have to apply the caching to the openai secret key.

Scheme: 
1. If the secret key is newly added then cache it on the server. 
2. If someone changed the secret key then update the caching for the secret key.
3. If the secret key is present in the caching then load it from the caching instead of doing the datastore call.

Open AI API Endpoints:
URL: http://edutestqa.appspot.com/admin/content/api/v1/answer

Method: "POST" 
Request Body: (application/json) {
"searchTerm": "Once upon a time" 
}

Overview of the API:
If api is enabled & the key is present, then it will give the response from openai. If not then it will return 512 words lorem ipsum.

Also available in: Atom PDF