import os import openai import json, csv def results_agent(query, key): system_prompt = """ You are an academic advisor helping students find classes for the next semester. Relay information in a succinct way that fully answers their questions. Use the scores (lower is better) from the context to help guide a student in finding the best class based on their query (a higher score is not always better). Please add new lines, bolding/italicizing, formatting like "##" for headers to make it a pretty output as well. """ response = openai.ChatCompletion.create( model="gpt-3.5-turbo", messages=[ {"role": "system", "content": system_prompt}, {"role": "user", "content": query} ] ) return response["choices"][0]["message"]["content"]