USC-GPT / results.py
bhulston's picture
Update results.py
9faf703
raw
history blame
1.04 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, based only on rag responses that are provided to you as context.
Relay information in a succinct way, relaying relevant information to classes or simply saying that you weren't able to find similar classes.
Based on the context provided, respond to the user's query in a natural way as if you are a person.
Only recommend ~2 or 3 classes when they are provided in RAG responses, otherwise, respond appropriately that you don't have good recommendations.
"""
response = openai.ChatCompletion.create(
model="gpt-3.5-turbo",
messages=[
{"role": "system", "content": system_prompt},
{"role": "user", "content": "User's query:" + query + "Additional Context (RAG responses and chat history):" + context}
]
)
return response["choices"][0]["message"]["content"]