Update process_data.py
Browse files- process_data.py +28 -28
process_data.py
CHANGED
|
@@ -521,36 +521,36 @@ def pre_processing(processed_data):
|
|
| 521 |
input_text = input_data["input_text"]
|
| 522 |
|
| 523 |
for pre_prompt in pre_processing_list:
|
| 524 |
-
|
| 525 |
-
|
| 526 |
-
|
| 527 |
-
|
| 528 |
-
|
| 529 |
-
|
| 530 |
-
|
| 531 |
-
|
| 532 |
-
|
| 533 |
-
|
| 534 |
-
response = client.chat.completions.create(
|
| 535 |
-
model=parameters["model_version"],
|
| 536 |
-
messages=[
|
| 537 |
-
{"role": "system", "content": pre_prompt},
|
| 538 |
-
{"role": "user", "content": input_text}
|
| 539 |
-
]
|
| 540 |
-
)
|
| 541 |
-
|
| 542 |
-
response_text = response.choices[0].message.content
|
| 543 |
-
|
| 544 |
-
print("Response Text: ")
|
| 545 |
-
print(response_text)
|
| 546 |
-
|
| 547 |
-
input_text = response_text
|
| 548 |
|
| 549 |
-
|
| 550 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 551 |
|
| 552 |
-
|
| 553 |
-
|
| 554 |
|
| 555 |
|
| 556 |
def process_specifications(processed_data):
|
|
|
|
| 521 |
input_text = input_data["input_text"]
|
| 522 |
|
| 523 |
for pre_prompt in pre_processing_list:
|
| 524 |
+
try:
|
| 525 |
+
print("Pre-Processing: ")
|
| 526 |
+
if pre_prompt:
|
| 527 |
+
print("Prompt: ")
|
| 528 |
+
print(pre_prompt)
|
| 529 |
+
print("Input Text: ")
|
| 530 |
+
print(input_text)
|
| 531 |
+
print("Model: ")
|
| 532 |
+
print(parameters["model_version"])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 533 |
|
| 534 |
+
response = client.chat.completions.create(
|
| 535 |
+
model=parameters["model_version"],
|
| 536 |
+
messages=[
|
| 537 |
+
{"role": "system", "content": pre_prompt},
|
| 538 |
+
{"role": "user", "content": input_text}
|
| 539 |
+
]
|
| 540 |
+
)
|
| 541 |
+
|
| 542 |
+
response_text = response.choices[0].message.content
|
| 543 |
+
|
| 544 |
+
print("Response Text: ")
|
| 545 |
+
print(response_text)
|
| 546 |
+
|
| 547 |
+
input_text = response_text
|
| 548 |
+
|
| 549 |
+
except Exception as e:
|
| 550 |
+
print(f"Failed to parse response as JSON. Error was: {e}")
|
| 551 |
|
| 552 |
+
input_data["input_text"] = input_text
|
| 553 |
+
return input_data
|
| 554 |
|
| 555 |
|
| 556 |
def process_specifications(processed_data):
|