Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -59,22 +59,15 @@ class PromptRefiner:
|
|
59 |
response_content = response.choices[0].message.content.strip()
|
60 |
|
61 |
# Parse the response
|
62 |
-
|
63 |
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
)
|
70 |
|
71 |
-
except Exception as e:
|
72 |
-
return (
|
73 |
-
f"Error: {str(e)}",
|
74 |
-
"",
|
75 |
-
"An unexpected error occurred.",
|
76 |
-
{}
|
77 |
-
)
|
78 |
def _parse_response(self, response_content: str) -> dict:
|
79 |
try:
|
80 |
# Try to find JSON in response
|
|
|
59 |
response_content = response.choices[0].message.content.strip()
|
60 |
|
61 |
# Parse the response
|
62 |
+
result = self._parse_response(response_content)
|
63 |
|
64 |
+
return (
|
65 |
+
result.get('initial_prompt_evaluation', ''),
|
66 |
+
result.get('refined_prompt', ''),
|
67 |
+
result.get('explanation_of_refinements', ''),
|
68 |
+
result
|
69 |
)
|
70 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
71 |
def _parse_response(self, response_content: str) -> dict:
|
72 |
try:
|
73 |
# Try to find JSON in response
|