-
Notifications
You must be signed in to change notification settings - Fork 0
/
gpt4.py
65 lines (58 loc) · 2.64 KB
/
gpt4.py
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
53
54
55
56
57
58
59
60
61
62
63
64
65
import os
from dotenv import load_dotenv
from src.symptom_study_strategies import build_strategies
from src.models import AzureGptModel
from src.processor import NoteProcessor
load_dotenv(".env.gpt4")
###############################################################################
#
# Build model and note processor
#
url = os.getenv("AZURE_OPENAI_ENDPOINT")
api_key = os.getenv("AZURE_OPENAI_API_KEY")
api_version = os.getenv("AZURE_OPENAI_API_VERSION")
model_type = os.getenv("AZURE_OPENAI_DEPLOYMENT")
model = AzureGptModel(
url=url, api_key=api_key, api_version=api_version, model_type=model_type
)
note_processor = NoteProcessor(model, "./note_config/gpt_api.json", sleepRate=5)
###############################################################################
#
# Building experiment with strategies
#
all_strategies = build_strategies()
tuning_exp = {
"prompt-gpt4Turbo-Identity": all_strategies["identity"],
"prompt-gpt4Turbo-Rules": all_strategies["rules"],
"prompt-gpt4Turbo-Include": all_strategies["include"],
"prompt-gpt4Turbo-Exclude": all_strategies["exclude"],
"prompt-gpt4Turbo-Verbose": all_strategies["verbose"],
# DoublePass
"prompt-gpt4Turbo-IdentityDoublePass": all_strategies["identityDoublePass"],
"prompt-gpt4Turbo-RulesDoublePass": all_strategies["rulesDoublePass"],
"prompt-gpt4Turbo-IncludeDoublePass": all_strategies["includeDoublePass"],
"prompt-gpt4Turbo-ExcludeDoublePass": all_strategies["excludeDoublePass"],
"prompt-gpt4Turbo-VerboseDoublePass": all_strategies["verboseDoublePass"],
# JSON
"prompt-gpt4Turbo-IdentityJSON": all_strategies["identityJSON"],
"prompt-gpt4Turbo-RulesJSON": all_strategies["rulesJSON"],
"prompt-gpt4Turbo-IncludeJSON": all_strategies["includeJSON"],
"prompt-gpt4Turbo-ExcludeJSON": all_strategies["excludeJSON"],
"prompt-gpt4Turbo-VerboseJSON": all_strategies["verboseJSON"],
# JSON Double Pass
"prompt-gpt4Turbo-IdentityJSONDoublePass": all_strategies["identityJSONDoublePass"],
"prompt-gpt4Turbo-RulesJSONDoublePass": all_strategies["rulesJSONDoublePass"],
"prompt-gpt4Turbo-IncludeJSONDoublePass": all_strategies["includeJSONDoublePass"],
"prompt-gpt4Turbo-ExcludeJSONDoublePass": all_strategies["excludeJSONDoublePass"],
"prompt-gpt4Turbo-VerboseJSONDoublePass": all_strategies["verboseJSONDoublePass"],
}
analysis_exp = {
"symptomstudy-gpt4Turbo-IncludeJSON": all_strategies["IncludeJSON"],
}
if __name__ == "__main__":
# note_processor.run_prompt_tuning(
# experiment=tuning_exp, experiment_name="gpt4-tuning"
# )
note_processor.run_analysis(
experiment=analysis_exp, experiment_name="gpt4-analysis"
)