Feature #3641
Updated by Ram Kordale 5 months ago
Let the first cell contain all inputs. Inputs are questions_file, Inputs: model, index, board, grade, subject, chapter_num, <board>-<grade>-<subject>.txt, start_question, num_questions, styles (which is an array of strings) "Output": gcs_file2 Also, set CONTEXT_SIZE to 40960. questions_file <board>-<grade>-<subject>.txt is available in <env>-files bucket (same ones that we have been using for the past few tickets) and has the format: Chapter 1 E Chapter 2 E ... where E is of the format: E1 E2 ... where Ei is of format #$Exercise: <exercise#> (example: 1.2.5.1) #$Question: <question> #$Answer: <answer> -for every As always, get assistant, periodic_prompt, instructions, prompt_prefix and prompt_suffix based on model and index. Substitute "stylexyz1abc" with <style> in styles and do the following: --template[key, value] = ["stylexyz1abc", <style>] -reset=true --num_tokens=0 -tokens=0 --for every question -while there are questions in the file --prompt=<question> --if (reset) --response,num_tokens=call_openai_api(version=1.0, prompt, template, ---reset=false ---prompt=concat(periodic_prompt, prompt_prefix, <question>, prompt_suffix) --else ---prompt=concat(prompt_prefix, <question>, prompt_suffix) --response=call_openai_api(assistant, "temperature": 1, "max_tokens": 4096, "top_p": 1, "frequency_penalty": 0, "presence_penalty": 0, prompt) ---if (num_tokens > CONTEXT_SIZE) num_tokens=0 --tokens = tokens + tokens_used_in_call ---styled_question --styled_question = content between "###---###---###" ---store --store styled_question and answer with key <board>-<grade>-<subject>-<chapter>-<exercise>-<style> ---if --if <board>-<grade>-<subject>-<chapter>-<exercise>-standard does not exist ----store ---store <question> and answer with key <board>-<grade>-<subject>-<chapter>-<exercise>-standard. <board>-<grade>-<subject>-<chapter>-<exercise>-standard --if (tokens > 40960) reset = true You can start with a single entry file such as #$Exercise: 1.2.5.1 #$Question: Maya dyes dresses. She had to dye 30 dresses. She has so far finished 20 dresses. What fraction of dresses has she finished? #$Answer: 2/3