File size: 963 Bytes
c755297
 
 
 
35a89f8
c755297
 
 
9dc0a1b
4105d6b
9dc0a1b
c755297
 
 
9dc0a1b
c755297
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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. 
    Query Results are sometimes provided to you in naming classes. Do not name classes that do not exist in chat history or in query results!! the scores (lower is better) from the context to help guide a student in finding the best class based on their query (a higher score is not always better). 
    Please add new lines, bolding/italicizing, formatting like "##" for headers to make it a pretty output as well.
    """

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