File size: 1,567 Bytes
0c84ee8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 openai import OpenAI
from llamaapi import LlamaAPI

# Initialize the llamaapi with your api_token
llama = LlamaAPI("LL-AirERHEk0jLIE1yEPvMXeobNfLsqLWJWcxLRS53obrZ3XyqMTfZc4EAuOs7r3wso")

api_key = "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"
os.environ["OPENAI_API_KEY"] = api_key
client = OpenAI()

prompt = 'hello, who are you ?'
chat_completion = client.chat.completions.create(
    model="gpt-4",
    messages=[
        {"role": "system", "content": "Provide feedback on the inputted writing sample from an ESL learner. "
                                      "Focus on areas such as grammar, vocabulary usage, and overall coherence and organization of the essay. "
                                      "Offer corrective feedback on errors, suggest improvements, and highlight positive aspects to encourage "
                                      "the learner. Please ensure the feedback is constructive, clear, and supportive to help the learner "
                                      "understand and apply the suggestions. Always frame feedback in a positive, constructive manner. "
                                      "Focus on how the student can improve rather than just highlighting mistakes. Provide clear examples "
                                      "when pointing out errors or suggesting improvements. Prompt the learner to reflect on specific parts of "
                                      "their writing"},
        {"role": "user", "content": prompt},
    ]
)
print(chat_completion.choices[0].message.content.strip())