Delete utilities.py
Browse files- utilities.py +0 -20
utilities.py
DELETED
|
@@ -1,20 +0,0 @@
|
|
| 1 |
-
def generate_math_context(question):
|
| 2 |
-
# Implement logic to extract numbers or operations from the question
|
| 3 |
-
# For example, if the question is "What is 2 + 3?", you might return:
|
| 4 |
-
return '{"operation": "addition", "numbers": [2, 3]}'
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
def parse_response(response):
|
| 8 |
-
# Split the string at the plus symbol
|
| 9 |
-
response_to_parse = response.content.strip()
|
| 10 |
-
if '+' in response_to_parse:
|
| 11 |
-
split_string = response.content.strip().split('+')
|
| 12 |
-
elif '\n' in response_to_parse:
|
| 13 |
-
split_string = response.content.strip().split('\n')
|
| 14 |
-
else:
|
| 15 |
-
split_string = [response_to_parse, ""]
|
| 16 |
-
|
| 17 |
-
# Create two lists from the split parts
|
| 18 |
-
classification = split_string[0].replace("classification: ", "").strip() # Remove "classification: " and strip
|
| 19 |
-
context = split_string[1].replace("context: ", "").strip() # Remove "context: " and strip
|
| 20 |
-
return classification, context
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|