(instructions, gpt_model="gpt-4-1106-preview")
| 5 | client = OpenAI(api_key=os.environ['OPENAI_KEY']) |
| 6 | |
| 7 | def generate_answers(instructions, gpt_model="gpt-4-1106-preview"): |
| 8 | data = [] |
| 9 | for prompt in instructions: |
| 10 | response = client.chat.completions.create(messages=[{ |
| 11 | "role": "user", |
| 12 | "content": prompt |
| 13 | }], |
| 14 | model=gpt_model) |
| 15 | data.append(response.choices[0].message.content) |
| 16 | return data |
| 17 | |
| 18 | def extract_questions_from_file(file_path): |
| 19 | questions = [] |