|
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"] |
|
|