rosemariafontana commited on
Commit
4372acb
·
verified ·
1 Parent(s): 8c3ce3a

Update process_data.py

Browse files
Files changed (1) hide show
  1. process_data.py +15 -10
process_data.py CHANGED
@@ -316,20 +316,25 @@ def pre_processing(input_data, parameters):
316
  input_data["input_context"] = (str) the text which should be used as context or "EMPTY" to indicate there is no context
317
  input_data["input_text"] = (str) input text
318
  """
 
319
  if input_data["stepwise_json_creation"] == "stepwisejsoncreation":
 
320
 
321
  if parameters["chaining"]:
 
322
  for text_label, text_body in input_data["input_text_pieces"].items():
323
-
324
- response = client.chat.completions.create(
325
- model=parameters["model_version"],
326
- messages=[
327
- {"role": "system", "content": one_giant_preprompt},
328
- {"role": "user", "content": text_body}
329
- ]
330
- )
331
-
332
- response_text = response.choices[0].message.content
 
 
333
  input_data["input_text_pieces"]["pre_processed_pieces"][text_label] = response_text
334
 
335
  return input_data
 
316
  input_data["input_context"] = (str) the text which should be used as context or "EMPTY" to indicate there is no context
317
  input_data["input_text"] = (str) input text
318
  """
319
+ print("Starting preprocessing")
320
  if input_data["stepwise_json_creation"] == "stepwisejsoncreation":
321
+ print("Stepwise Creation")
322
 
323
  if parameters["chaining"]:
324
+ print("Chaining")
325
  for text_label, text_body in input_data["input_text_pieces"].items():
326
+ for parameter_name, parameter_value in parameters.items():
327
+ if 'pre_prompt' in parameter_name and parameter_value is not None:
328
+ response = client.chat.completions.create(
329
+ model=parameters["model_version"],
330
+ messages=[
331
+ {"role": "system", "content": parameter_value},
332
+ {"role": "user", "content": text_body}
333
+ ]
334
+ )
335
+
336
+ response_text = response.choices[0].message.content
337
+ text_body = response_text
338
  input_data["input_text_pieces"]["pre_processed_pieces"][text_label] = response_text
339
 
340
  return input_data