Spaces:
Running
Running
fixed output generation prompt
Browse files
app.py
CHANGED
|
@@ -786,11 +786,16 @@ def generate_synthetic_outputs(
|
|
| 786 |
# Format output variable information for the prompt
|
| 787 |
output_vars_text = "\n".join(
|
| 788 |
[
|
| 789 |
-
f"
|
| 790 |
for var in output_vars
|
| 791 |
]
|
| 792 |
)
|
| 793 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 794 |
results = []
|
| 795 |
|
| 796 |
# Create a progress bar
|
|
@@ -820,18 +825,15 @@ PROMPT USED:
|
|
| 820 |
REQUIRED OUTPUT VARIABLES:
|
| 821 |
{output_vars_text}
|
| 822 |
|
| 823 |
-
Generate realistic output data for these variables. Return ONLY a JSON object with the output variables:
|
| 824 |
-
{
|
| 825 |
-
"output_variable_1": value1,
|
| 826 |
-
"output_variable_2": value2,
|
| 827 |
-
...
|
| 828 |
-
}}
|
| 829 |
|
| 830 |
Use appropriate data types for each variable. Return ONLY the JSON object with no additional text or explanation.
|
| 831 |
The response must be valid JSON that can be parsed directly.
|
| 832 |
"""
|
| 833 |
|
| 834 |
output_data = None
|
|
|
|
| 835 |
for attempt in range(max_retries):
|
| 836 |
try:
|
| 837 |
response = client.chat.completions.create(
|
|
@@ -937,7 +939,6 @@ The response must be valid JSON that can be parsed directly.
|
|
| 937 |
|
| 938 |
return results
|
| 939 |
|
| 940 |
-
|
| 941 |
def suggest_variable_values_from_kb(
|
| 942 |
variable_name, variable_type, knowledge_base, client, model="gpt-3.5-turbo"
|
| 943 |
):
|
|
|
|
| 786 |
# Format output variable information for the prompt
|
| 787 |
output_vars_text = "\n".join(
|
| 788 |
[
|
| 789 |
+
f"Key: {var['name']}: {var['description']} (Type: {var['type']}) {'Options: '+str(var['options']) if var.get('options') else ''}"
|
| 790 |
for var in output_vars
|
| 791 |
]
|
| 792 |
)
|
| 793 |
|
| 794 |
+
output_format = "{"
|
| 795 |
+
for var in output_vars:
|
| 796 |
+
output_format += f'"{var["name"]}": output, '
|
| 797 |
+
output_format = output_format.rstrip(", ") + "}"
|
| 798 |
+
|
| 799 |
results = []
|
| 800 |
|
| 801 |
# Create a progress bar
|
|
|
|
| 825 |
REQUIRED OUTPUT VARIABLES:
|
| 826 |
{output_vars_text}
|
| 827 |
|
| 828 |
+
Generate realistic output data for these variables. Return ONLY a JSON object with the below format, using the names of the required output variables as keys:
|
| 829 |
+
{output_format}
|
|
|
|
|
|
|
|
|
|
|
|
|
| 830 |
|
| 831 |
Use appropriate data types for each variable. Return ONLY the JSON object with no additional text or explanation.
|
| 832 |
The response must be valid JSON that can be parsed directly.
|
| 833 |
"""
|
| 834 |
|
| 835 |
output_data = None
|
| 836 |
+
|
| 837 |
for attempt in range(max_retries):
|
| 838 |
try:
|
| 839 |
response = client.chat.completions.create(
|
|
|
|
| 939 |
|
| 940 |
return results
|
| 941 |
|
|
|
|
| 942 |
def suggest_variable_values_from_kb(
|
| 943 |
variable_name, variable_type, knowledge_base, client, model="gpt-3.5-turbo"
|
| 944 |
):
|