File size: 1,071 Bytes
5c11669 a6e0409 5c11669 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | from smolagents import Tool
class FlashDataTool(Tool):
name = 'youtube_channel'
description = 'Get a YouTube channel profile and recent videos from its handle. Retrieve channel details and a bounded list of recent uploads. Request 1–100 recent videos. This is not a complete channel archive; statistics and other fields may be unavailable. Uses paid FlashData API credits. Never automatically retry an uncertain submission; check Jobs first.'
inputs = {'handle': {'description': 'YouTube channel handle, for example @jawed.', 'type': 'string'},
'video_limit': {'description': 'Video limit. minimum: 1. maximum: 100. Default: 20.',
'nullable': True,
'type': 'integer'}}
output_type = 'object'
def forward(self, handle: str, video_limit: int = 20) -> dict:
from langchain_flashdata import FlashDataYouTubeChannel
values = {'handle': handle, 'video_limit': video_limit}
return FlashDataYouTubeChannel().invoke({key: value for key, value in values.items() if value is not None})
|