|
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 them in finding the best class based on their query (a higher score is not always better). It is okay to ask for follow up questions to further assist them: |
|
""" |
|
|
|
response = openai.ChatCompletion.create( |
|
model="gpt-4", |
|
messages=[ |
|
{"role": "system", "content": system_prompt}, |
|
{"role": "user", "content": query} |
|
] |
|
) |
|
|
|
return response["choices"][0]["message"]["content"] |
|
|