USC-GPT / results.py
bhulston's picture
Update results.py
7751cbf
raw
history blame
1.02 kB
import os
import openai
import json, csv
def results_agent(query, context):
system_prompt = """
You are an academic advisor helping students (user role) find classes for the next semester.
Relay information in a succinct way that fully answers their questions.
You will be given a user's query, as well as the chat history and finally, the rag responses in context.
Please use your own discretion to determine form the rag responses (which have scores to help you, higher is better) the best way to respond to the user's query
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},
{"role": "assistant", "Additional Context": context}
]
)
return response["choices"][0]["message"]["content"]