File size: 1,043 Bytes
d8083af 6f0f963 d8083af 36fde6a 1853639 d8083af 36fde6a 3305431 d8083af |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
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 Query from the User role, you determine that the user is looking for additional classes not already included in the chat history.
Chat history is also included to aid you in this, but please make your decision primarily based on the user's query, not the chat history.
A good example of where you should output "1", would be if the Query is: "What programming classes relating to video games could I take?"
"""
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"]
|