n_instructions = 100 INSTRUCTION_PROMPT_TEMPLATE = """ The objective is to create a dataset of user instructions in natural language that should be returned by Git commands. Given a topic in Git, generate {n_instructions} possible concise instructions that could be given to an AI assitant about that topic. Write some of these instructions as if given by someone with limited knowledge of Git terminologies and knowledge, like a beginner programmer. Your response should be in a list format. The topic is: {sub_topic} The list must be without numbers. The questions/instructions should be separated by a newline character. There must be no other text than the list. """ subtopic_list = responses.choices[0].message.content.split(",") def generate_instructions(client, sub_topic, n_instructions): print(f"Generating Instructions for {sub_topic}.") prompt = INSTRUCTION_PROMPT_TEMPLATE.format(sub_topic=sub_topic, n_instructions=n_instructions) response = client.chat.completions.create( model=MODEL, messages=[ {"role": "user", "content": prompt} ], temperature=0.2, top_p=0.7, ) return response.choices[0].message.content def instructions_generator(client, subtopic_list, n_instructions): instruction_list = [generate_instructions(client, subtopic, n_instructions) for subtopic in subtopic_list] return instruction_list instruction_list = instructions_generator(client, subtopic_list, n_instructions) instruction_list_formatted = [] for instruction_set in instruction_list: instruction_list_formatted.extend([instruction.strip() for instruction in instruction_set.split("n") if instruction]) print(instruction_list_formatted)