USC-GPT / results.py
bhulston's picture
Update results.py
4105d6b
raw
history blame
No virus
963 Bytes
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.
Query Results are sometimes provided to you in naming classes. Do not name classes that do not exist in chat history or in query results!! 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"]