File size: 814 Bytes
9de5882
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
from openai_chat_completion import OpenAIChatCompletions

# read in llm-data-cleaner/prompts/gpt4-system-message.txt file into variable system_message
system_message = open('../prompts/gpt4-system-message.txt', 'r').read()

# create an instance of the OpenAIChatCompletions class and use the openai_chat_completion method to get chat completions
chat_completions = OpenAIChatCompletions(model="gpt-4", system_message=system_message)

# prompt = "co-2MFE5QVF,Chill Medicated - Watermelon - Syrup - 250mg,Chill Medicated,nan,nan,nan"
# completion = chat_completions.openai_chat_completion(prompt, n_shot=1)
# print(completion)



prompts, completions, predictions = chat_completions.predict_jsonl(n_samples=2, n_shot=2)
print("Prompts:", prompts)
print("Completions:", completions)
print("Predictions:", predictions)