Spaces:
Sleeping
Sleeping
File size: 491 Bytes
6230b38 538b711 b2746c2 538b711 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
from smolagents import tool
@tool
def cite(input: str) -> str:
"""
Takes input as 'answer ||| url' and formats a markdown citation.
Args:
input (str): Combined answer and URL separated by '|||'.
Returns:
str: Formatted citation string with markdown link.
"""
try:
answer, url = input.split("|||")
return f"{answer.strip()}\n\nSource: [{url.strip()}]({url.strip()})"
except:
return "Could not format citation correctly."
|