File size: 899 Bytes
a7a069a
 
 
 
 
b1cfbdf
a7a069a
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
from smolagents import Tool


class FlashDataTool(Tool):
    name = 'youtube_trainability'
    description = 'Inspect the Creative Commons license classification in YouTube video metadata. Return the license-label signal for a video ID. This checks license metadata, not creator training settings. It does not grant training, download or reuse permission. Uses paid FlashData API credits. Never automatically retry an uncertain submission; check Jobs first.'
    inputs = {'video_id': {'description': '11-character YouTube video ID or a YouTube video URL.',
                  'type': 'string'}}
    output_type = 'object'

    def forward(self, video_id: str) -> dict:
        from langchain_flashdata import FlashDataYouTubeTrainability
        values = {'video_id': video_id}
        return FlashDataYouTubeTrainability().invoke({key: value for key, value in values.items() if value is not None})