Spaces:
Sleeping
Sleeping
| from smolagents import 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." | |