Update process_data.py
Browse files- 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 |
-
|
| 328 |
-
|
| 329 |
-
|
| 330 |
-
|
| 331 |
-
|
| 332 |
-
|
| 333 |
-
|
| 334 |
-
|
| 335 |
-
|
| 336 |
-
|
| 337 |
-
|
| 338 |
-
|
| 339 |
-
|
| 340 |
-
|
| 341 |
-
|
| 342 |
-
|
| 343 |
-
|
| 344 |
-
|
| 345 |
-
|
| 346 |
-
|
|
|
|
| 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 |
|