Knaben API
This commit is contained in:
+19
-4
@@ -5,7 +5,7 @@ from functools import partial
|
||||
|
||||
from .memory import Memory
|
||||
from .tools.filesystem import set_path_for_folder, list_folder
|
||||
from .tools.api import find_media_imdb_id
|
||||
from .tools.api import find_media_imdb_id, find_torrent
|
||||
|
||||
|
||||
@dataclass
|
||||
@@ -20,17 +20,17 @@ class Tool:
|
||||
def make_tools(memory: Memory) -> Dict[str, Tool]:
|
||||
"""
|
||||
Create all available tools with memory bound to them.
|
||||
|
||||
|
||||
Args:
|
||||
memory: Memory instance to be used by the tools
|
||||
|
||||
|
||||
Returns:
|
||||
Dictionary mapping tool names to Tool instances
|
||||
"""
|
||||
# Create partial functions with memory pre-bound for filesystem tools
|
||||
set_path_func = partial(set_path_for_folder, memory)
|
||||
list_folder_func = partial(list_folder, memory)
|
||||
|
||||
|
||||
tools = [
|
||||
Tool(
|
||||
name="set_path_for_folder",
|
||||
@@ -88,6 +88,21 @@ def make_tools(memory: Memory) -> Dict[str, Tool]:
|
||||
"required": ["media_title"]
|
||||
}
|
||||
),
|
||||
Tool(
|
||||
name="find_torrents",
|
||||
description="Finds torrents for a given media title using Knaben API.",
|
||||
func=find_torrent,
|
||||
parameters={
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"media_title": {
|
||||
"type": "string",
|
||||
"description": "Title of the media to find torrents for"
|
||||
},
|
||||
},
|
||||
"required": ["media_title"]
|
||||
}
|
||||
),
|
||||
]
|
||||
|
||||
return {t.name: t for t in tools}
|
||||
|
||||
Reference in New Issue
Block a user