Format: text/x-python
⬇ Download File (2.0 KB)
   1  from modules.search.news import fetch_news
   2  from modules.search.arxiv import fetch_arxiv
   3  from modules.search.web import fetch_ddg, fetch_torrents
   4  
   5  # Tool descriptors
   6  fetch_news_tool = {
   7      "type": "function",
   8      "function": {
   9          "name": "fetch_news",
  10          "description": "Return news headlines+snippets.",
  11          "parameters": {
  12              "type": "object",
  13              "required": ["query"],
  14              "properties": {
  15                  "query": {"type": "string"},
  16                  "max_results": {"type": "integer", "default": 10}
  17              }
  18          }
  19      }
  20  }
  21  
  22  fetch_arxiv_tool = {
  23      "type": "function",
  24      "function": {
  25          "name": "fetch_arxiv",
  26          "description": "Return arXiv titles+abstracts.",
  27          "parameters": {
  28              "type": "object",
  29              "required": ["query"],
  30              "properties": {
  31                  "query": {"type": "string"},
  32                  "max_results": {"type": "integer", "default": 10}
  33              }
  34          }
  35      }
  36  }
  37  
  38  fetch_ddg_tool = {
  39      "type": "function",
  40      "function": {
  41          "name": "fetch_ddg",
  42          "description": "Return DuckDuckGo result snippets.",
  43          "parameters": {
  44              "type": "object",
  45              "required": ["query"],
  46              "properties": {
  47                  "query": {"type": "string"},
  48                  "max_results": {"type": "integer", "default": 10}
  49              }
  50          }
  51      }
  52  }
  53  
  54  fetch_torrents_tool = {
  55      "type": "function",
  56      "function": {
  57          "name": "fetch_torrents",
  58          "description": "Return torrent search snippets.",
  59          "parameters": {
  60              "type": "object",
  61              "required": ["query"],
  62              "properties": {
  63                  "query": {"type": "string"},
  64                  "max_results": {"type": "integer", "default": 10}
  65              }
  66          }
  67      }
  68  }
  69  
  70  available_functions = {
  71      "fetch_news": fetch_news,
  72      "fetch_arxiv": fetch_arxiv,
  73      "fetch_ddg": fetch_ddg,
  74      "fetch_torrents": fetch_torrents
  75  }