rosemariafontana commited on
Commit
2be9141
·
verified ·
1 Parent(s): ad321bc

Update process_data.py

Browse files
Files changed (1) hide show
  1. process_data.py +21 -20
process_data.py CHANGED
@@ -324,26 +324,27 @@ def pre_processing(input_data, parameters):
324
  if parameters["chaining"]:
325
  print("Chaining")
326
  for text_label, text_body in input_data["input_text_pieces"].items():
327
- for parameter_name, parameter_value in parameters.items():
328
- if 'data_input' in parameter_name and parameter_value and not isinstance(parameter_value, bool) and text_body:
329
- print("Text Label")
330
- print(text_label)
331
- print("Prompt followed by data entered")
332
- print(parameter_value)
333
- print(text_body)
334
- response = client.chat.completions.create(
335
- model=parameters["model_version"],
336
- messages=[
337
- {"role": "system", "content": parameter_value},
338
- {"role": "user", "content": text_body}
339
- ]
340
- )
341
-
342
- response_text = response.choices[0].message.content
343
- print("Response text")
344
- print(response_text)
345
-
346
- input_data["input_text_pieces"]["pre_processed_pieces"][text_label] = response_text
 
347
 
348
  return input_data
349
 
 
324
  if parameters["chaining"]:
325
  print("Chaining")
326
  for text_label, text_body in input_data["input_text_pieces"].items():
327
+ if 'data_input' in text_label:
328
+ for parameter_name, parameter_value in parameters.items():
329
+ if 'pre_prompt' in parameter_name and parameter_value and not isinstance(parameter_value, bool) and text_body:
330
+ print("Text Label")
331
+ print(text_label)
332
+ print("Prompt followed by data entered")
333
+ print(parameter_value)
334
+ print(text_body)
335
+ response = client.chat.completions.create(
336
+ model=parameters["model_version"],
337
+ messages=[
338
+ {"role": "system", "content": parameter_value},
339
+ {"role": "user", "content": text_body}
340
+ ]
341
+ )
342
+
343
+ response_text = response.choices[0].message.content
344
+ print("Response text")
345
+ print(response_text)
346
+
347
+ input_data["input_text_pieces"]["pre_processed_pieces"][text_label] = response_text
348
 
349
  return input_data
350