File size: 944 Bytes
38bba96
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import os
from dotenv import find_dotenv, load_dotenv
import openai
import json


def filter_agent(query):

    system_prompt = """
    Take a query and remove any information that does not directly relate to describing a class in a university program. Specifically look for information that attempts to use filtered information and remove those:

    For example, given a query, "I am a Business Administration major looking for a DSCI class on Tuesdays or Thursdays before 5 pm that focuses on data engineering.",
    The expected format of your output should look like the information below in a string:
        A class that focuses on data engineering.
    
    """

    response = openai.ChatCompletion.create(
        model="gpt-3.5-turbo",
        messages=[
            {"role": "system", "content": system_prompt},
            {"role": "user", "content": query}
        ]
    )

    return response["choices"][0]["message"]["content"]