Spaces:
No application file
No application file
Update my_function.py
Browse files- tools/my_function.py +21 -0
tools/my_function.py
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Template for custom function or Pydantic model."""
|
| 2 |
+
|
| 3 |
+
from pydantic import BaseModel
|
| 4 |
+
from pydantic import Field
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
class MyModel(BaseModel):
|
| 8 |
+
"""My model."""
|
| 9 |
+
|
| 10 |
+
attr1: str = Field(..., description="The first attribute.")
|
| 11 |
+
attr2: int = Field(..., description="The second attribute.")
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
def my_function(arg1: str, arg2: int) -> int:
|
| 15 |
+
"""My function. Docstrings and arguments are useful for function calls.
|
| 16 |
+
|
| 17 |
+
Args:
|
| 18 |
+
arg1: The first argument.
|
| 19 |
+
arg2: The second argument.
|
| 20 |
+
"""
|
| 21 |
+
return arg1 + arg2
|