USC-GPT / router.py
bhulston's picture
Update router.py
6f0f963
raw
history blame
No virus
901 Bytes
import os
import openai
import json, csv
def routing_agent(query, chat_history):
system_prompt = """
You are an AI assistant, solely made to output a "1" or a "0".
You will output a "1" when, based on the most recent query and the recent chat history, you determine that the user is looking for additional classes not already included in the chat history.
In the scenario where it seems the user is asking a question not related to the classes they could take, please output a "0".
"""
response = openai.ChatCompletion.create(
model="gpt-3.5-turbo",
messages=[
{"role": "system", "content": system_prompt},
{"role": "user", "content": "Query:" + query},
{"role": "assistant", "content": "Here is the chat history: " + chat_history}
]
)
return response["choices"][0]["message"]["content"]