Update process_data.py
Browse files- process_data.py +11 -3
process_data.py
CHANGED
|
@@ -16,18 +16,26 @@ from schema_classes import FarmActivities, Interactions, Trial, FarmActivitiesLi
|
|
| 16 |
os.environ["OPENAI_API_KEY"] = os.getenv("OPENAI_API_KEY")
|
| 17 |
client = OpenAI()
|
| 18 |
|
|
|
|
|
|
|
|
|
|
| 19 |
# Parameters - The Levers and Flippers to be chosen
|
| 20 |
# Use this for reference for now then work backwards
|
| 21 |
-
|
| 22 |
'model_version': ['gpt-4o-2024-08-06', 'gpt-4o-2024-08-06'],
|
| 23 |
'input_modality': ['free-text-input', 'form-text-input'],
|
| 24 |
-
'json_nested': ['single-level-nested', 'no-nesting'],
|
| 25 |
-
'creation_style': ['single-JSON-creation', 'stepwise-JSON-creation'],
|
| 26 |
'pre_processing': ['yes', 'no'],
|
|
|
|
| 27 |
'pre_processing_specification': ['not_specified', 'summarization', 'otter.ai-summary', 'specific-field-extraction'],
|
| 28 |
'prompting_style': ['no_specific_style', 'example_driven', 'role_specific', 'step_by_step', 'error_detection'],
|
|
|
|
|
|
|
|
|
|
| 29 |
}
|
| 30 |
|
|
|
|
| 31 |
def generate_json(input_data, parameters):
|
| 32 |
"""
|
| 33 |
Function to prompt OpenAI API to generate structured JSON output.
|
|
|
|
| 16 |
os.environ["OPENAI_API_KEY"] = os.getenv("OPENAI_API_KEY")
|
| 17 |
client = OpenAI()
|
| 18 |
|
| 19 |
+
# What the data input survey should look like:
|
| 20 |
+
# Do you want to enter your text in one big block (free-form style) or in individual pieces (form-based style)?
|
| 21 |
+
# The free-form block will be used
|
| 22 |
# Parameters - The Levers and Flippers to be chosen
|
| 23 |
# Use this for reference for now then work backwards
|
| 24 |
+
all_options = {
|
| 25 |
'model_version': ['gpt-4o-2024-08-06', 'gpt-4o-2024-08-06'],
|
| 26 |
'input_modality': ['free-text-input', 'form-text-input'],
|
| 27 |
+
'json_nested': ['single-level-nested', 'no-nesting (flat schema)'],
|
| 28 |
+
'creation_style': ['single-JSON-creation (model creates entire JSON)', 'stepwise-JSON-creation (individual pieces created then manually combined)'],
|
| 29 |
'pre_processing': ['yes', 'no'],
|
| 30 |
+
'pre_processing_multiple': ['yes', 'no'],
|
| 31 |
'pre_processing_specification': ['not_specified', 'summarization', 'otter.ai-summary', 'specific-field-extraction'],
|
| 32 |
'prompting_style': ['no_specific_style', 'example_driven', 'role_specific', 'step_by_step', 'error_detection'],
|
| 33 |
+
'input_text' = ['whole_input_text': "value", 'input_text_pieces': ["piece_1": "value", "piece_2": "value"]]
|
| 34 |
+
'pre_processing_prompt' = ['pre_processing_prompts': ["prompt_1": "value", "prompt_2": "value"]]
|
| 35 |
+
'prompt' = ['prompt_text': "value"]
|
| 36 |
}
|
| 37 |
|
| 38 |
+
|
| 39 |
def generate_json(input_data, parameters):
|
| 40 |
"""
|
| 41 |
Function to prompt OpenAI API to generate structured JSON output.
|