|
from typing import Any, Optional |
|
from smolagents.tools import Tool |
|
from gradio_client import Client |
|
|
|
class FetchFileURLTool(Tool): |
|
name = "fetch_file_url" |
|
description = "Get the correct URL at which a task's file is located for download." |
|
inputs = {'lookup_link': {'type': 'any', 'description': 'The link at which to get the URL of the file. It has the pattern https://agents-course-unit4-scoring.hf.space/files/{{ task_id }}'}} |
|
output_type = "any" |
|
|
|
def forward(self, lookup_link: Any) -> Any: |
|
print('*$%: Performing fetching of file URL at '+lookup_link) |
|
requests.get(lookup_link) |
|
|
|
return result['markdown_content'] |
|
|
|
def __init__(self, *args, **kwargs): |
|
self.is_initialized = False |