Spaces:
Sleeping
Sleeping
Update veryfinal.py
Browse files- veryfinal.py +14 -18
veryfinal.py
CHANGED
|
@@ -26,30 +26,26 @@ ENHANCED_SYSTEM_PROMPT = (
|
|
| 26 |
"You are a helpful assistant tasked with answering questions using a set of tools. "
|
| 27 |
"You must provide accurate, comprehensive answers based on available information. "
|
| 28 |
"When answering questions, follow these guidelines:\n"
|
| 29 |
-
'You are a helpful assistant tasked with answering questions using a set of tools.
|
| 30 |
-
'Now, I will ask you a question. Report your thoughts, and finish your answer with the following template:
|
| 31 |
-
|
| 32 |
-
YOUR FINAL ANSWER should be a number OR as few words as possible OR a comma separated list of numbers and/or strings. If you are asked for a number, don't use comma to write your number neither use units such as $ or percent sign unless specified otherwise. If you are asked for a string, don't use articles, neither abbreviations (e.g. for cities), and write the digits in plain text unless specified otherwise. If you are asked for a comma separated list, apply the above rules depending of whether the element to be put in the list is a number or a string.
|
| 33 |
-
Your answer should only start with "FINAL ANSWER: ", then follows with the answer. '
|
| 34 |
)
|
| 35 |
|
| 36 |
# ---- Tool Definitions with Enhanced Docstrings ----
|
| 37 |
@tool
|
| 38 |
-
def multiply(a: int, b: int) -> int:
|
| 39 |
-
"""
|
| 40 |
-
Multiplies two integers and returns the product.
|
| 41 |
|
| 42 |
Args:
|
| 43 |
-
a
|
| 44 |
-
b
|
| 45 |
-
|
| 46 |
-
Returns:
|
| 47 |
-
int: Product of a and b
|
| 48 |
"""
|
| 49 |
return a * b
|
| 50 |
|
| 51 |
@tool
|
| 52 |
-
def add(a: int, b: int) -> int:
|
| 53 |
"""
|
| 54 |
Adds two integers and returns the sum.
|
| 55 |
|
|
@@ -63,7 +59,7 @@ def add(a: int, b: int) -> int:
|
|
| 63 |
return a + b
|
| 64 |
|
| 65 |
@tool
|
| 66 |
-
def subtract(a: int, b: int) -> int:
|
| 67 |
"""
|
| 68 |
Subtracts the second integer from the first and returns the difference.
|
| 69 |
|
|
@@ -77,7 +73,7 @@ def subtract(a: int, b: int) -> int:
|
|
| 77 |
return a - b
|
| 78 |
|
| 79 |
@tool
|
| 80 |
-
def divide(a: int, b: int) -> float:
|
| 81 |
"""
|
| 82 |
Divides the first integer by the second and returns the quotient.
|
| 83 |
|
|
@@ -91,12 +87,12 @@ def divide(a: int, b: int) -> float:
|
|
| 91 |
Raises:
|
| 92 |
ValueError: If b is zero
|
| 93 |
"""
|
| 94 |
-
if b == 0:
|
| 95 |
raise ValueError("Cannot divide by zero.")
|
| 96 |
return a / b
|
| 97 |
|
| 98 |
@tool
|
| 99 |
-
def modulus(a: int, b: int) -> int:
|
| 100 |
"""
|
| 101 |
Returns the remainder when dividing the first integer by the second.
|
| 102 |
|
|
|
|
| 26 |
"You are a helpful assistant tasked with answering questions using a set of tools. "
|
| 27 |
"You must provide accurate, comprehensive answers based on available information. "
|
| 28 |
"When answering questions, follow these guidelines:\n"
|
| 29 |
+
'1)You are a helpful assistant tasked with answering questions using a set of tools.
|
| 30 |
+
'2)Now, I will ask you a question. Report your thoughts, and finish your answer with the following template:'
|
| 31 |
+
'FINAL ANSWER: [YOUR FINAL ANSWER].'
|
| 32 |
+
'3)YOUR FINAL ANSWER should be a number OR as few words as possible OR a comma separated list of numbers and/or strings. If you are asked for a number, don't use comma to write your number neither use units such as $ or percent sign unless specified otherwise. If you are asked for a string, don't use articles, neither abbreviations (e.g. for cities), and write the digits in plain text unless specified otherwise. If you are asked for a comma separated list, apply the above rules depending of whether the element to be put in the list is a number or a string.'
|
| 33 |
+
'4)Your answer should only start with "FINAL ANSWER: ", then follows with the answer. '
|
| 34 |
)
|
| 35 |
|
| 36 |
# ---- Tool Definitions with Enhanced Docstrings ----
|
| 37 |
@tool
|
| 38 |
+
def multiply(a: int | float, b: int | float) -> int | float:
|
| 39 |
+
"""Multiply two numbers.
|
|
|
|
| 40 |
|
| 41 |
Args:
|
| 42 |
+
a: first int | float
|
| 43 |
+
b: second int | float
|
|
|
|
|
|
|
|
|
|
| 44 |
"""
|
| 45 |
return a * b
|
| 46 |
|
| 47 |
@tool
|
| 48 |
+
def add(a: int | float, b: int | float) -> int | float:
|
| 49 |
"""
|
| 50 |
Adds two integers and returns the sum.
|
| 51 |
|
|
|
|
| 59 |
return a + b
|
| 60 |
|
| 61 |
@tool
|
| 62 |
+
def subtract(a: int | float, b: int | float) -> int | float:
|
| 63 |
"""
|
| 64 |
Subtracts the second integer from the first and returns the difference.
|
| 65 |
|
|
|
|
| 73 |
return a - b
|
| 74 |
|
| 75 |
@tool
|
| 76 |
+
def divide(a: int | float, b: int | float) -> int | float:
|
| 77 |
"""
|
| 78 |
Divides the first integer by the second and returns the quotient.
|
| 79 |
|
|
|
|
| 87 |
Raises:
|
| 88 |
ValueError: If b is zero
|
| 89 |
"""
|
| 90 |
+
if b == 0 or b==0.0:
|
| 91 |
raise ValueError("Cannot divide by zero.")
|
| 92 |
return a / b
|
| 93 |
|
| 94 |
@tool
|
| 95 |
+
def modulus(a: int | float, b: int | float) -> int | float:
|
| 96 |
"""
|
| 97 |
Returns the remainder when dividing the first integer by the second.
|
| 98 |
|