-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy path15c_Prompt_Modification_Labeling.wls
executable file
·52 lines (38 loc) · 1.74 KB
/
15c_Prompt_Modification_Labeling.wls
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/usr/bin/env wolframscript
(* ::Package:: *)
SetDirectory@ NotebookDirectory[];
<<"./src/pu_learning_queries.wl"
(* redefine the SYSTEM message *)
synthesizabilityRequest[target_, model_:"gpt-3.5-turbo", temperature_:0]:= OpenAIRequest[
{"v1", "chat", "completions"},
<|"model" -> model,
"messages"->{
<|"role"->"system", "content"->"You are an expert inorganic chemist. Determine if the following compound is likely to be synthesizable based on its composition, answering only \"P\" (for positive or possible) and \"U\" (for unknown). However, items labeled \"U\" could be positive or negative (i.e., synthesizable or unsynthesizable)."|>,
<|"role"->"user", "content"->"Is this inorganic compound synthesizable? "<>target|>},
"temperature"->temperature,
"max_tokens"->2,
"logprobs"->True,
"top_logprobs"->3|>]
evaluatePUPrediction["gpt-3.5-turbo-0125", 0,
"./results_MP/prompt_modification/pu_prompting/gpt-3.5"]@
"./data_MP/test_batch/batch01.mx"
evaluatePUPrediction["gpt-4-0125-preview", 0,
"./results_MP/prompt_modification/pu_prompting/gpt-4"]@
"./data_MP/test_batch/batch01.mx"
evaluatePUPrediction[
"ft:gpt-3.5-turbo-0125:fordham-university:prompt-mod:9WQd847W", 0,
"./results_MP/prompt_modification/pu_prompting/gpt-3.5_finetune"]@
"./data_MP/test_batch/batch01.mx"
(* optional: evaluate all test items *)
(*
FileSystemScan[
evaluatePUPrediction[
"ft:gpt-3.5-turbo-0125:fordham-university:prompt-mod:9WQd847W", 0,
"./results_MP/prompt_modification/pu_prompting/gpt-3.5_finetune"],
"./data_MP/test_batch/",
FileNameForms->"*.mx"]
*)
summarize/@
{"./results_MP/prompt_modification/pu_prompting/gpt-3.5",
"./results_MP/prompt_modification/pu_prompting/gpt-4",
"./results_MP/prompt_modification/pu_prompting/gpt-3.5_finetune"}