Feature #3643
Task #3653: Launch with first chapter support - Phase 1 - Practice for Decent Learners (Top 5 Themes, No DetailedQNAs, No Detailed Answers)
Support in call_openai_api for version, template dictionary, attachments and core arguments
100%
Description
Add version, template_dict, attachments and 'core arguments' as arguments.
if version is not 1.0, return unsupported version error.
replace template_dict[key] in final prompt with template_dict[value].
'attachments' is a list of GCS files. Attach these to the message.
'core arguments' are "temperature", "max_tokens", "top_p", "frequency_penalty", and "presence_penalty" which are directly used as arguments to the openai api.
Minimum Test I:
- version is 1.2; return error
Minimum Test II:
- version not given. assume, it is version 1.0
- create a jpg file containing only "Let there be universal peace.". upload it as GCS file.
- create another jpg file containing only "Let there be happiness all around!". upload it as GCS file.
- set prompt to "Tell what is written in the two uploaded files. Then, write fantastic"
- template_dict[key]="fantastic", template_dict[value]="Super"
Response should be "Let there be universal peace. Let there be happiness all around! Super"
Minimum Test III:
- same as Test II
- set periodic prompt to "Say Hello There!"
- replace tokens from 40960 to 100 in code
- make the call_openai_api calls.
The first response should be "Hello There! Let there be universal peace. Let there be happiness all around! Super"
The next 2 or 3 responses should be "Let there be universal peace. Let there be happiness all around! Super"
The next response should be "Hello There! Let there be universal peace. Let there be happiness all around! Super"
The next 2 or 3 responses should be "Let there be universal peace. Let there be happiness all around! Super"
The next response should be "Hello There! Let there be universal peace. Let there be happiness all around! Super"