File size: 934 Bytes
c755297
 
 
 
7751cbf
c755297
 
9189a13
9dc0a1b
7bc5bb6
9189a13
c755297
 
 
7bc5bb6
c755297
 
480e5ac
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, context):
    
    system_prompt = """
    You are an academic advisor helping students (user role) find classes for the next semester, based only on rag responses that are provided to you as context.
    Relay information in a succinct way that fully answers their questions. 
    Based on the context provided, respond to the user's query in a natural way as if you are a person.
        You should only recommend classes when they are provided in RAG responses, otherwise, respond appropriately.
    """

    response = openai.ChatCompletion.create(
        model="gpt-3.5-turbo",
        messages=[
            {"role": "system", "content": system_prompt},
            {"role": "user", "content": "User's query:" + query + "Additional Context (RAG responses and chat history):" + context} 
        ]
    )

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