File size: 759 Bytes
c755297
 
 
 
35a89f8
c755297
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import os
import openai
import json, csv

def results_agent(query, key):
    
    system_prompt = """
    You are an academic advisor helping students find classes for the next semester. 
    Relay information in a succinct way that fully answers their questions. Use the scores (lower is better) from the context to help guide them in finding the best class based on their query (a higher score is not always better). It is okay to ask for follow up questions to further assist them:
    """

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

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