RESPONSE_PROMPT_TEMPLATE = """ Given an question/instruction related to Git, generate a response that could be given. Keep the response on-topic, informative, concise. The user prompt is: {instruction} """ def generate_responses(client, instruction): prompt = RESPONSE_PROMPT_TEMPLATE.format(instruction=instruction) response = client.chat.completions.create( model=MODEL, messages=[ {"role": "user", "content": prompt} ], temperature=0.2, top_p=0.7, max_tokens=1024, ) return response.choices[0].message.content def response_generator(client, instruction_list): response_list = [generate_responses(client, instruction) for instruction in instruction_list] return response_list instruction_response_list = response_generator(client, instruction_list_formatted) instruction_response_pair_list = [] for instruction, response in zip(instruction_list_formatted, instruction_response_list): instruction_response_pair_list.append( { "instruction": instruction, "responses": response, } )