toolboxv2 API Reference¶
This section provides an API reference for key components directly available from the toolboxv2
package.
Core Application & Tooling¶
toolboxv2.AppType
¶
Source code in toolboxv2/utils/system/types.py
1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 |
|
debug
property
writable
¶
proxi attr
prefix = prefix
instance-attribute
¶
proxi attr
a_exit()
async
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
1413 1414 |
|
a_fuction_runner(function, function_data, args, kwargs)
async
¶
parameters = function_data.get('params') modular_name = function_data.get('module_name') function_name = function_data.get('func_name') mod_function_name = f"{modular_name}.{function_name}"
proxi attr
Source code in toolboxv2/utils/system/types.py
1464 1465 1466 1467 1468 1469 1470 1471 1472 |
|
a_remove_mod(mod_name, spec='app', delete=True)
async
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
1404 1405 |
|
a_run_any(mod_function_name, backwords_compability_variabel_string_holder=None, get_results=False, tb_run_function_with_state=True, tb_run_with_specification='app', args_=None, kwargs_=None, *args, **kwargs)
async
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
1486 1487 1488 1489 1490 1491 |
|
a_run_function(mod_function_name, tb_run_function_with_state=True, tb_run_with_specification='app', args_=None, kwargs_=None, *args, **kwargs)
async
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
1444 1445 1446 1447 1448 1449 1450 1451 1452 |
|
debug_rains(e)
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
1298 1299 |
|
disconnect(*args, **kwargs)
async
staticmethod
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
1286 1287 1288 |
|
execute_all_functions(m_query='', f_query='', enable_profiling=True)
async
¶
Execute all functions with parallel processing and optional profiling.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
m_query
|
str
|
Module name query filter |
''
|
f_query
|
str
|
Function name query filter |
''
|
enable_profiling
|
bool
|
Enable detailed profiling information |
True
|
Source code in toolboxv2/utils/system/types.py
1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 |
|
exit()
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
1407 1408 |
|
exit_main(*args, **kwargs)
staticmethod
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
1274 1275 1276 |
|
fuction_runner(function, function_data, args, kwargs, t0=0.0)
¶
parameters = function_data.get('params') modular_name = function_data.get('module_name') function_name = function_data.get('func_name') mod_function_name = f"{modular_name}.{function_name}"
proxi attr
Source code in toolboxv2/utils/system/types.py
1454 1455 1456 1457 1458 1459 1460 1461 1462 |
|
get_all_mods(working_dir='mods', path_to='./runtime')
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
1378 1379 |
|
get_autocompletion_dict()
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
1669 1670 |
|
get_function(name, **kwargs)
¶
Kwargs for _get_function metadata:: return the registered function dictionary stateless: (function_data, None), 0 stateful: (function_data, higher_order_function), 0 state::boolean specification::str default app
Source code in toolboxv2/utils/system/types.py
1419 1420 1421 1422 1423 1424 1425 1426 1427 |
|
get_mod(name, spec='app')
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
1493 1494 |
|
get_username(get_input=False, default='loot')
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
1672 1673 |
|
hide_console(*args, **kwargs)
async
staticmethod
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
1278 1279 1280 |
|
inplace_load_instance(mod_name, loc='toolboxv2.mods.', spec='app', save=True)
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
1347 1348 |
|
load_all_mods_in_file(working_dir='mods')
async
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
1375 1376 |
|
load_mod(mod_name, mlm='I', **kwargs)
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
1369 1370 |
|
mod_online(mod_name, installed=False)
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
1356 1357 |
|
print(text, *args, **kwargs)
staticmethod
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
1496 1497 1498 |
|
print_ok()
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
1391 1392 1393 |
|
reload_mod(mod_name, spec='app', is_file=True, loc='toolboxv2.mods.')
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
1395 1396 |
|
remove_mod(mod_name, spec='app', delete=True)
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
1401 1402 |
|
rrun_flows(name, **kwargs)
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
1307 1308 |
|
run_a_from_sync(function, *args)
¶
run a async fuction
Source code in toolboxv2/utils/system/types.py
1429 1430 1431 1432 |
|
run_any(mod_function_name, backwords_compability_variabel_string_holder=None, get_results=False, tb_run_function_with_state=True, tb_run_with_specification='app', args_=None, kwargs_=None, *args, **kwargs)
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
1480 1481 1482 1483 1484 |
|
run_flows(name, **kwargs)
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
1304 1305 |
|
run_function(mod_function_name, tb_run_function_with_state=True, tb_run_with_specification='app', args_=None, kwargs_=None, *args, **kwargs)
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
1434 1435 1436 1437 1438 1439 1440 1441 1442 |
|
run_http(mod_function_name, function_name=None, method='GET', args_=None, kwargs_=None, *args, **kwargs)
async
¶
run a function remote via http / https
Source code in toolboxv2/utils/system/types.py
1474 1475 1476 1477 1478 |
|
save_autocompletion_dict()
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
1666 1667 |
|
save_exit()
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
1366 1367 |
|
save_initialized_module(tools_class, spec)
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
1353 1354 |
|
save_instance(instance, modular_id, spec='app', instance_type='file/application', tools_class=None)
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
1350 1351 |
|
save_load(modname, spec='app')
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
1416 1417 |
|
save_registry_as_enums(directory, filename)
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
1675 1676 |
|
set_flows(r)
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
1301 1302 |
|
set_logger(debug=False)
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
1290 1291 |
|
show_console(*args, **kwargs)
async
staticmethod
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
1282 1283 1284 |
|
sprint(text, *args, **kwargs)
staticmethod
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
1500 1501 1502 |
|
tb(name=None, mod_name='', helper='', version=None, test=True, restrict_in_virtual_mode=False, api=False, initial=False, exit_f=False, test_only=False, memory_cache=False, file_cache=False, row=False, request_as_kwarg=False, state=None, level=0, memory_cache_max_size=100, memory_cache_ttl=300, samples=None, interface=None, pre_compute=None, post_compute=None, api_methods=None)
¶
A decorator for registering and configuring functions within a module.
This decorator is used to wrap functions with additional functionality such as caching, API conversion, and lifecycle management (initialization and exit). It also handles the registration of the function in the module's function registry.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str
|
The name to register the function under. Defaults to the function's own name. |
None
|
mod_name
|
str
|
The name of the module the function belongs to. |
''
|
helper
|
str
|
A helper string providing additional information about the function. |
''
|
version
|
str or None
|
The version of the function or module. |
None
|
test
|
bool
|
Flag to indicate if the function is for testing purposes. |
True
|
restrict_in_virtual_mode
|
bool
|
Flag to restrict the function in virtual mode. |
False
|
api
|
bool
|
Flag to indicate if the function is part of an API. |
False
|
initial
|
bool
|
Flag to indicate if the function should be executed at initialization. |
False
|
exit_f
|
bool
|
Flag to indicate if the function should be executed at exit. |
False
|
test_only
|
bool
|
Flag to indicate if the function should only be used for testing. |
False
|
memory_cache
|
bool
|
Flag to enable memory caching for the function. |
False
|
request_as_kwarg
|
bool
|
Flag to get request if the fuction is calld from api. |
False
|
file_cache
|
bool
|
Flag to enable file caching for the function. |
False
|
row
|
bool
|
rather to auto wrap the result in Result type default False means no row data aka result type |
False
|
state
|
bool or None
|
Flag to indicate if the function maintains state. |
None
|
level
|
int
|
The level of the function, used for prioritization or categorization. |
0
|
memory_cache_max_size
|
int
|
Maximum size of the memory cache. |
100
|
memory_cache_ttl
|
int
|
Time-to-live for the memory cache entries. |
300
|
samples
|
list or dict or None
|
Samples or examples of function usage. |
None
|
interface
|
str
|
The interface type for the function. |
None
|
pre_compute
|
callable
|
A function to be called before the main function. |
None
|
post_compute
|
callable
|
A function to be called after the main function. |
None
|
api_methods
|
list[str]
|
default ["AUTO"] (GET if not params, POST if params) , GET, POST, PUT or DELETE. |
None
|
Returns:
Name | Type | Description |
---|---|---|
function |
The decorated function with additional processing and registration capabilities. |
Source code in toolboxv2/utils/system/types.py
1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 |
|
watch_mod(mod_name, spec='app', loc='toolboxv2.mods.', use_thread=True, path_name=None)
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
1398 1399 |
|
web_context()
¶
returns the build index ( toolbox web component )
Source code in toolboxv2/utils/system/types.py
1410 1411 |
|
toolboxv2.MainTool
¶
Source code in toolboxv2/utils/system/main_tool.py
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 |
|
__init__(*args, **kwargs)
¶
Standard constructor used for arguments pass Do not override. Use ainit instead
Source code in toolboxv2/utils/system/main_tool.py
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
|
__initobj()
async
¶
Crutch used for await after spawning
Source code in toolboxv2/utils/system/main_tool.py
163 164 165 166 167 168 169 |
|
get_version()
¶
"Returns the version
Source code in toolboxv2/utils/system/main_tool.py
156 157 158 |
|
webInstall(user_instance, construct_render)
¶
"Returns a web installer for the given user instance and construct render template
Source code in toolboxv2/utils/system/main_tool.py
153 154 |
|
toolboxv2.get_app(from_=None, name=None, args=AppArgs().default(), app_con=None, sync=False)
¶
Source code in toolboxv2/utils/system/getting_and_closing_app.py
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
|
System Utilities & Configuration¶
toolboxv2.FileHandler
¶
Bases: Code
Source code in toolboxv2/utils/system/file_handler.py
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 |
|
toolboxv2.utils
¶
App
¶
Source code in toolboxv2/utils/toolbox.py
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 |
|
disconnect(*args, **kwargs)
staticmethod
¶
proxi attr
Source code in toolboxv2/utils/toolbox.py
223 224 225 |
|
exit_main(*args, **kwargs)
staticmethod
¶
proxi attr
Source code in toolboxv2/utils/toolbox.py
211 212 213 |
|
get_function(name, **kwargs)
¶
Kwargs for _get_function metadata:: return the registered function dictionary stateless: (function_data, None), 0 stateful: (function_data, higher_order_function), 0 state::boolean specification::str default app
Source code in toolboxv2/utils/toolbox.py
1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 |
|
hide_console(*args, **kwargs)
staticmethod
¶
proxi attr
Source code in toolboxv2/utils/toolbox.py
215 216 217 |
|
run(*args, request=None, running_function_coro=None, **kwargs)
¶
Run a function with support for SSE streaming in both threaded and non-threaded contexts.
Source code in toolboxv2/utils/toolbox.py
744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 |
|
run_bg_task(task)
¶
Run a task in the background that will properly handle nested asyncio operations. This implementation ensures that asyncio.create_task() and asyncio.gather() work correctly within the background task.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
task
|
A callable function that can be synchronous or asynchronous |
required |
Source code in toolboxv2/utils/toolbox.py
600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 |
|
run_bg_task_advanced(task, *args, **kwargs)
¶
Alternative implementation for complex async scenarios where the task creates nested asyncio tasks using create_task() and gather().
This version ensures proper execution of nested tasks by maintaining the thread and its event loop throughout the lifetime of all child tasks.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
task
|
A callable function that can be synchronous or asynchronous |
required | |
*args,
|
**kwargs
|
Arguments to pass to the task |
required |
Source code in toolboxv2/utils/toolbox.py
660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 |
|
show_console(*args, **kwargs)
staticmethod
¶
proxi attr
Source code in toolboxv2/utils/toolbox.py
219 220 221 |
|
tb(name=None, mod_name='', helper='', version=None, test=True, restrict_in_virtual_mode=False, api=False, initial=False, exit_f=False, test_only=False, memory_cache=False, file_cache=False, request_as_kwarg=False, row=False, state=None, level=-1, memory_cache_max_size=100, memory_cache_ttl=300, samples=None, interface=None, pre_compute=None, post_compute=None, api_methods=None)
¶
A decorator for registering and configuring functions within a module.
This decorator is used to wrap functions with additional functionality such as caching, API conversion, and lifecycle management (initialization and exit). It also handles the registration of the function in the module's function registry.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str
|
The name to register the function under. Defaults to the function's own name. |
None
|
mod_name
|
str
|
The name of the module the function belongs to. |
''
|
helper
|
str
|
A helper string providing additional information about the function. |
''
|
version
|
str or None
|
The version of the function or module. |
None
|
test
|
bool
|
Flag to indicate if the function is for testing purposes. |
True
|
restrict_in_virtual_mode
|
bool
|
Flag to restrict the function in virtual mode. |
False
|
api
|
bool
|
Flag to indicate if the function is part of an API. |
False
|
initial
|
bool
|
Flag to indicate if the function should be executed at initialization. |
False
|
exit_f
|
bool
|
Flag to indicate if the function should be executed at exit. |
False
|
test_only
|
bool
|
Flag to indicate if the function should only be used for testing. |
False
|
memory_cache
|
bool
|
Flag to enable memory caching for the function. |
False
|
request_as_kwarg
|
bool
|
Flag to get request if the fuction is calld from api. |
False
|
file_cache
|
bool
|
Flag to enable file caching for the function. |
False
|
row
|
bool
|
rather to auto wrap the result in Result type default False means no row data aka result type |
False
|
state
|
bool or None
|
Flag to indicate if the function maintains state. |
None
|
level
|
int
|
The level of the function, used for prioritization or categorization. |
-1
|
memory_cache_max_size
|
int
|
Maximum size of the memory cache. |
100
|
memory_cache_ttl
|
int
|
Time-to-live for the memory cache entries. |
300
|
samples
|
list or dict or None
|
Samples or examples of function usage. |
None
|
interface
|
str
|
The interface type for the function. |
None
|
pre_compute
|
callable
|
A function to be called before the main function. |
None
|
post_compute
|
callable
|
A function to be called after the main function. |
None
|
api_methods
|
list[str]
|
default ["AUTO"] (GET if not params, POST if params) , GET, POST, PUT or DELETE. |
None
|
Returns:
Name | Type | Description |
---|---|---|
function |
The decorated function with additional processing and registration capabilities. |
Source code in toolboxv2/utils/toolbox.py
1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 |
|
wait_for_bg_tasks(timeout=None)
¶
Wait for all background tasks to complete.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
timeout
|
Maximum time to wait (in seconds) for all tasks to complete. None means wait indefinitely. |
None
|
Returns:
Name | Type | Description |
---|---|---|
bool |
True if all tasks completed, False if timeout occurred |
Source code in toolboxv2/utils/toolbox.py
721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 |
|
Code
¶
Source code in toolboxv2/utils/security/cryp.py
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 |
|
decrypt_asymmetric(encrypted_text_hex, private_key_str)
staticmethod
¶
Entschlüsselt einen Text mit einem gegebenen privaten Schlüssel.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
encrypted_text_hex
|
str
|
Der verschlüsselte Text als Hex-String. |
required |
private_key_str
|
str
|
Der private Schlüssel als String. |
required |
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
Der entschlüsselte Text. |
Source code in toolboxv2/utils/security/cryp.py
287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 |
|
decrypt_symmetric(encrypted_text, key, to_str=True, mute=False)
staticmethod
¶
Entschlüsselt einen Text mit einem gegebenen symmetrischen Schlüssel.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
encrypted_text
|
str
|
Der zu entschlüsselnde Text. |
required |
key
|
str
|
Der symmetrische Schlüssel. |
required |
to_str
|
bool
|
default true returns str if false returns bytes |
True
|
Returns: str: Der entschlüsselte Text.
Source code in toolboxv2/utils/security/cryp.py
126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 |
|
encrypt_asymmetric(text, public_key_str)
staticmethod
¶
Verschlüsselt einen Text mit einem gegebenen öffentlichen Schlüssel.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
text
|
str
|
Der zu verschlüsselnde Text. |
required |
public_key_str
|
str
|
Der öffentliche Schlüssel als String oder im pem format. |
required |
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
Der verschlüsselte Text. |
Source code in toolboxv2/utils/security/cryp.py
256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 |
|
encrypt_symmetric(text, key)
staticmethod
¶
Verschlüsselt einen Text mit einem gegebenen symmetrischen Schlüssel.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
text
|
str
|
Der zu verschlüsselnde Text. |
required |
key
|
str
|
Der symmetrische Schlüssel. |
required |
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
Der verschlüsselte Text. |
Source code in toolboxv2/utils/security/cryp.py
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 |
|
generate_asymmetric_keys()
staticmethod
¶
Generiert ein Paar von öffentlichen und privaten Schlüsseln für die asymmetrische Verschlüsselung.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
seed
|
int
|
Ein optionaler Seed-Wert. Standardmäßig None. |
required |
Returns:
Type | Description |
---|---|
(str, str)
|
Ein Tupel aus öffentlichem und privatem Schlüssel. |
Source code in toolboxv2/utils/security/cryp.py
156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 |
|
generate_seed()
staticmethod
¶
Erzeugt eine zufällige Zahl als Seed.
Returns:
Name | Type | Description |
---|---|---|
int |
int
|
Eine zufällige Zahl. |
Source code in toolboxv2/utils/security/cryp.py
68 69 70 71 72 73 74 75 76 |
|
generate_symmetric_key()
staticmethod
¶
Generiert einen Schlüssel für die symmetrische Verschlüsselung.
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
Der generierte Schlüssel. |
Source code in toolboxv2/utils/security/cryp.py
94 95 96 97 98 99 100 101 102 |
|
load_keys_from_files(directory='keys')
staticmethod
¶
Lädt die Schlüssel aus den Dateien. Der private Schlüssel wird mit dem Device Key entschlüsselt.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
directory
|
str
|
Das Verzeichnis, aus dem die Schlüssel geladen werden sollen |
'keys'
|
Returns:
Type | Description |
---|---|
(str, str)
|
Ein Tupel aus öffentlichem und privatem Schlüssel |
Raises:
Type | Description |
---|---|
FileNotFoundError
|
Wenn die Schlüsseldateien nicht gefunden werden können |
Source code in toolboxv2/utils/security/cryp.py
219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 |
|
one_way_hash(text, salt='', pepper='')
staticmethod
¶
Erzeugt einen Hash eines gegebenen Textes mit Salt, Pepper und optional einem Seed.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
text
|
str
|
Der zu hashende Text. |
required |
salt
|
str
|
Der Salt-Wert. |
''
|
pepper
|
str
|
Der Pepper-Wert. |
''
|
seed
|
int
|
Ein optionaler Seed-Wert. Standardmäßig None. |
required |
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
Der resultierende Hash-Wert. |
Source code in toolboxv2/utils/security/cryp.py
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
|
pem_to_public_key(pem_key)
staticmethod
¶
Konvertiert einen PEM-kodierten öffentlichen Schlüssel in ein PublicKey-Objekt.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
pem_key
|
str
|
Der PEM-kodierte öffentliche Schlüssel. |
required |
Returns:
Name | Type | Description |
---|---|---|
PublicKey |
Das PublicKey-Objekt. |
Source code in toolboxv2/utils/security/cryp.py
386 387 388 389 390 391 392 393 394 395 396 397 398 |
|
public_key_to_pem(public_key)
staticmethod
¶
Konvertiert ein PublicKey-Objekt in einen PEM-kodierten String.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
public_key
|
PublicKey
|
Das PublicKey-Objekt. |
required |
Returns:
Name | Type | Description |
---|---|---|
str |
Der PEM-kodierte öffentliche Schlüssel. |
Source code in toolboxv2/utils/security/cryp.py
400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 |
|
save_keys_to_files(public_key, private_key, directory='keys')
staticmethod
¶
Speichert die generierten Schlüssel in separate Dateien. Der private Schlüssel wird mit dem Device Key verschlüsselt.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
public_key
|
str
|
Der öffentliche Schlüssel im PEM-Format |
required |
private_key
|
str
|
Der private Schlüssel im PEM-Format |
required |
directory
|
str
|
Das Verzeichnis, in dem die Schlüssel gespeichert werden sollen |
'keys'
|
Source code in toolboxv2/utils/security/cryp.py
187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 |
|
MainTool
¶
Source code in toolboxv2/utils/system/main_tool.py
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 |
|
__init__(*args, **kwargs)
¶
Standard constructor used for arguments pass Do not override. Use ainit instead
Source code in toolboxv2/utils/system/main_tool.py
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
|
__initobj()
async
¶
Crutch used for await after spawning
Source code in toolboxv2/utils/system/main_tool.py
163 164 165 166 167 168 169 |
|
get_version()
¶
"Returns the version
Source code in toolboxv2/utils/system/main_tool.py
156 157 158 |
|
webInstall(user_instance, construct_render)
¶
"Returns a web installer for the given user instance and construct render template
Source code in toolboxv2/utils/system/main_tool.py
153 154 |
|
Result
¶
Source code in toolboxv2/utils/system/types.py
621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 |
|
binary(data, content_type='application/octet-stream', download_name=None, info='OK', interface=ToolBoxInterfaces.remote)
classmethod
¶
Create a binary data response Result.
Source code in toolboxv2/utils/system/types.py
879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 |
|
file(data, filename, content_type=None, info='OK', interface=ToolBoxInterfaces.remote)
classmethod
¶
Create a file download response Result.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data
|
File data as bytes or base64 string |
required | |
filename
|
Name of the file for download |
required | |
content_type
|
MIME type of the file (auto-detected if None) |
None
|
|
info
|
Response info text |
'OK'
|
|
interface
|
Target interface |
remote
|
Returns:
Type | Description |
---|---|
Result object configured for file download |
Source code in toolboxv2/utils/system/types.py
902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 |
|
json(data, info='OK', interface=ToolBoxInterfaces.remote, exec_code=0, status_code=None)
classmethod
¶
Create a JSON response Result.
Source code in toolboxv2/utils/system/types.py
847 848 849 850 851 852 853 854 855 856 857 858 859 860 |
|
redirect(url, status_code=302, info='Redirect', interface=ToolBoxInterfaces.remote)
classmethod
¶
Create a redirect response.
Source code in toolboxv2/utils/system/types.py
946 947 948 949 950 951 952 953 954 955 956 957 958 959 |
|
sse(stream_generator, info='OK', interface=ToolBoxInterfaces.remote, cleanup_func=None)
classmethod
¶
Create an Server-Sent Events (SSE) streaming response Result.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
stream_generator
|
Any
|
A source yielding individual data items. This can be an async generator, sync generator, iterable, or a single item. Each item will be formatted as an SSE event. |
required |
info
|
str
|
Optional help text for the Result. |
'OK'
|
interface
|
ToolBoxInterfaces
|
Optional ToolBoxInterface to target. |
remote
|
cleanup_func
|
Union[Callable[[], None], Callable[[], T], Callable[[], AsyncGenerator[T, None]], None]
|
Optional cleanup function to run when the stream ends or is cancelled. |
None
|
#http_headers
|
Optional dictionary of custom HTTP headers for the SSE response. |
required |
Returns:
Type | Description |
---|---|
A Result object configured for SSE streaming. |
Source code in toolboxv2/utils/system/types.py
805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 |
|
stream(stream_generator, content_type='text/event-stream', headers=None, info='OK', interface=ToolBoxInterfaces.remote, cleanup_func=None)
classmethod
¶
Create a streaming response Result. Handles SSE and other stream types.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
stream_generator
|
Any
|
Any stream source (async generator, sync generator, iterable, or single item). |
required |
content_type
|
str
|
Content-Type header (default: text/event-stream for SSE). |
'text/event-stream'
|
headers
|
Union[dict, None]
|
Additional HTTP headers for the response. |
None
|
info
|
str
|
Help text for the result. |
'OK'
|
interface
|
ToolBoxInterfaces
|
Interface to send data to. |
remote
|
cleanup_func
|
Union[Callable[[], None], Callable[[], T], Callable[[], AsyncGenerator[T, None]], None]
|
Optional function for cleanup. |
None
|
Returns:
Type | Description |
---|---|
A Result object configured for streaming. |
Source code in toolboxv2/utils/system/types.py
726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 |
|
text(text_data, content_type='text/plain', exec_code=None, status=200, info='OK', interface=ToolBoxInterfaces.remote, headers=None)
classmethod
¶
Create a text response Result with specific content type.
Source code in toolboxv2/utils/system/types.py
862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 |
|
Singleton
¶
Singleton metaclass for ensuring only one instance of a class.
Source code in toolboxv2/utils/singelton_class.py
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
|
Spinner
¶
Enhanced Spinner with tqdm-like line rendering.
Source code in toolboxv2/utils/extras/Style.py
525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 |
|
__enter__()
¶
Start the spinner.
Source code in toolboxv2/utils/extras/Style.py
591 592 593 594 595 596 |
|
__exit__(exc_type, exc_value, exc_traceback)
¶
Stop the spinner.
Source code in toolboxv2/utils/extras/Style.py
598 599 600 601 602 603 604 605 |
|
__init__(message='Loading...', delay=0.1, symbols=None, count_down=False, time_in_s=0)
¶
Initialize spinner with flexible configuration.
Source code in toolboxv2/utils/extras/Style.py
539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 |
|
TBEF
¶
Automatic generated by ToolBox v = 0.1.21
daemon
¶
DaemonUtil
¶
Source code in toolboxv2/utils/daemon/daemon_util.py
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 |
|
__init__(*args, **kwargs)
¶
Standard constructor used for arguments pass Do not override. Use ainit instead
Source code in toolboxv2/utils/daemon/daemon_util.py
19 20 21 22 23 24 25 26 27 |
|
__initobj()
async
¶
Crutch used for await after spawning
Source code in toolboxv2/utils/daemon/daemon_util.py
29 30 31 32 33 34 35 |
|
start_server(connection_type=None)
async
¶
Start the server using app and the socket manager
Source code in toolboxv2/utils/daemon/daemon_util.py
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
|
daemon_util
¶
DaemonUtil
¶
Source code in toolboxv2/utils/daemon/daemon_util.py
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 |
|
__init__(*args, **kwargs)
¶Standard constructor used for arguments pass Do not override. Use ainit instead
Source code in toolboxv2/utils/daemon/daemon_util.py
19 20 21 22 23 24 25 26 27 |
|
__initobj()
async
¶Crutch used for await after spawning
Source code in toolboxv2/utils/daemon/daemon_util.py
29 30 31 32 33 34 35 |
|
start_server(connection_type=None)
async
¶Start the server using app and the socket manager
Source code in toolboxv2/utils/daemon/daemon_util.py
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
|
extras
¶
BaseWidget
¶
Source code in toolboxv2/utils/extras/base_widget.py
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 |
|
create_iframe_asset(app, iframe_id, asset_id=None)
¶
Erstellt ein Asset für einen registrierten iframe
Parameters:
Name | Type | Description | Default |
---|---|---|---|
app
|
App-Instanz |
required | |
iframe_id
|
str
|
ID des registrierten iframes |
required |
asset_id
|
str
|
Optional, spezifische Asset-ID |
None
|
Source code in toolboxv2/utils/extras/base_widget.py
234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 |
|
load_iframe(app, iframe_id, asset_id=None)
¶
Lädt einen registrierten iframe und gibt das HTML-Element zurück
Parameters:
Name | Type | Description | Default |
---|---|---|---|
app
|
App-Instanz |
required | |
iframe_id
|
str
|
ID des registrierten iframes |
required |
asset_id
|
str
|
Optional, spezifische Asset-ID |
None
|
Source code in toolboxv2/utils/extras/base_widget.py
281 282 283 284 285 286 287 288 289 290 291 |
|
modify_iterator(iterator, replace)
¶
['a', 'b'] -> [{replace[0]: 'a',..., replace[len(replace)-1]: 'a'}, {replace[0]: 'b',..., replace[len(replace)-1]: 'b'}, ]
Source code in toolboxv2/utils/extras/base_widget.py
95 96 97 98 99 100 101 102 103 104 |
|
register_iframe(iframe_id, src, width='100%', height='500px', **kwargs)
¶
Registriert einen iframe mit gegebener ID und Quelle
Parameters:
Name | Type | Description | Default |
---|---|---|---|
iframe_id
|
str
|
Eindeutige ID für den iframe |
required |
src
|
str
|
URL oder Pfad zur Quelle des iframes |
required |
width
|
str
|
Breite des iframes (default: "100%") |
'100%'
|
height
|
str
|
Höhe des iframes (default: "500px") |
'500px'
|
**kwargs
|
Weitere iframe-Attribute |
{}
|
Source code in toolboxv2/utils/extras/base_widget.py
215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 |
|
Style
¶
Spinner
¶
Enhanced Spinner with tqdm-like line rendering.
Source code in toolboxv2/utils/extras/Style.py
525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 |
|
__enter__()
¶Start the spinner.
Source code in toolboxv2/utils/extras/Style.py
591 592 593 594 595 596 |
|
__exit__(exc_type, exc_value, exc_traceback)
¶Stop the spinner.
Source code in toolboxv2/utils/extras/Style.py
598 599 600 601 602 603 604 605 |
|
__init__(message='Loading...', delay=0.1, symbols=None, count_down=False, time_in_s=0)
¶Initialize spinner with flexible configuration.
Source code in toolboxv2/utils/extras/Style.py
539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 |
|
SpinnerManager
¶
Manages multiple spinners to ensure tqdm-like line rendering. Automatically captures SIGINT (Ctrl+C) to stop all spinners.
Source code in toolboxv2/utils/extras/Style.py
434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 |
|
register_spinner(spinner)
¶Register a new spinner.
Source code in toolboxv2/utils/extras/Style.py
470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 |
|
unregister_spinner(spinner)
¶Unregister a completed spinner.
Source code in toolboxv2/utils/extras/Style.py
486 487 488 489 490 |
|
base_widget
¶
BaseWidget
¶
Source code in toolboxv2/utils/extras/base_widget.py
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 |
|
create_iframe_asset(app, iframe_id, asset_id=None)
¶Erstellt ein Asset für einen registrierten iframe
Parameters:
Name | Type | Description | Default |
---|---|---|---|
app
|
App-Instanz |
required | |
iframe_id
|
str
|
ID des registrierten iframes |
required |
asset_id
|
str
|
Optional, spezifische Asset-ID |
None
|
Source code in toolboxv2/utils/extras/base_widget.py
234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 |
|
load_iframe(app, iframe_id, asset_id=None)
¶Lädt einen registrierten iframe und gibt das HTML-Element zurück
Parameters:
Name | Type | Description | Default |
---|---|---|---|
app
|
App-Instanz |
required | |
iframe_id
|
str
|
ID des registrierten iframes |
required |
asset_id
|
str
|
Optional, spezifische Asset-ID |
None
|
Source code in toolboxv2/utils/extras/base_widget.py
281 282 283 284 285 286 287 288 289 290 291 |
|
modify_iterator(iterator, replace)
¶['a', 'b'] -> [{replace[0]: 'a',..., replace[len(replace)-1]: 'a'}, {replace[0]: 'b',..., replace[len(replace)-1]: 'b'}, ]
Source code in toolboxv2/utils/extras/base_widget.py
95 96 97 98 99 100 101 102 103 104 |
|
register_iframe(iframe_id, src, width='100%', height='500px', **kwargs)
¶Registriert einen iframe mit gegebener ID und Quelle
Parameters:
Name | Type | Description | Default |
---|---|---|---|
iframe_id
|
str
|
Eindeutige ID für den iframe |
required |
src
|
str
|
URL oder Pfad zur Quelle des iframes |
required |
width
|
str
|
Breite des iframes (default: "100%") |
'100%'
|
height
|
str
|
Höhe des iframes (default: "500px") |
'500px'
|
**kwargs
|
Weitere iframe-Attribute |
{}
|
Source code in toolboxv2/utils/extras/base_widget.py
215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 |
|
gist_control
¶
GistLoader
¶
Source code in toolboxv2/utils/extras/gist_control.py
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
|
get_spec(module_name)
¶Gibt die Modul-Specifikation zurück.
Source code in toolboxv2/utils/extras/gist_control.py
23 24 25 |
|
load_module(module_name)
¶Lädt das Modul mit dem gegebenen Namen.
Source code in toolboxv2/utils/extras/gist_control.py
13 14 15 16 17 18 19 20 21 |
|
helper_test_functions
¶
generate_edge_value(param_type)
¶
Generiert Edge-Case-Werte basierend auf dem Parametertyp.
Source code in toolboxv2/utils/extras/helper_test_functions.py
35 36 37 38 39 40 41 42 43 44 |
|
generate_normal_value(param_type)
¶
Generiert normale Werte basierend auf dem Parametertyp.
Source code in toolboxv2/utils/extras/helper_test_functions.py
47 48 49 50 51 52 53 54 55 56 |
|
keword_matcher
¶
calculate_keyword_score(text, keywords)
¶
Berechnet den Keyword-Score basierend auf der Häufigkeit der Keywords im Text. Case-insensitive und optimiert für Geschwindigkeit.
:param text: Eingabetext als String :param keywords: Set von Keywords :return: Gesamt-Score als Integer
Source code in toolboxv2/utils/extras/keword_matcher.py
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
|
calculate_weighted_score(text, keyword_weights)
¶
Berechnet gewichteten Score mit unterschiedlichen Gewichten pro Keyword
:param text: Eingabetext :param keyword_weights: Dictionary mit {Keyword: Gewicht} :return: Gewichteter Gesamt-Score
Source code in toolboxv2/utils/extras/keword_matcher.py
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
|
extract_keywords(text, max_len=-1, min_word_length=3, with_weights=False, remove_stopwords=True, stopwords=True)
¶
Extrahiert Keywords mit optionaler Frequenzgewichtung
:param text: Eingabetext :param max_len: Maximale Anzahl Keywords (-1 = alle) :param min_word_length: Minimale Wortlänge :param with_weights: Gibt Wort+Frequenz zurück wenn True :param remove_stopwords: Filtert deutsche Stopwörter :param german_stopwords: Verwendet deutsche Standard-Stopwörter :return: Keywords oder (Keyword, Häufigkeit) Paare
Source code in toolboxv2/utils/extras/keword_matcher.py
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 |
|
reqbuilder
¶
generate_requirements(folder, output_file)
¶
Generates requirements.txt for the specified folder using pipreqs.
Source code in toolboxv2/utils/extras/reqbuilder.py
7 8 9 10 11 12 13 14 15 16 17 18 |
|
run_pipeline(base_dir)
¶
Runs the entire pipeline to generate requirements files.
Source code in toolboxv2/utils/extras/reqbuilder.py
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
|
proxy
¶
ProxyUtil
¶
Source code in toolboxv2/utils/proxy/prox_util.py
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 |
|
__init__(*args, **kwargs)
¶
Standard constructor used for arguments pass Do not override. Use ainit instead
Source code in toolboxv2/utils/proxy/prox_util.py
20 21 22 23 24 25 26 |
|
__initobj()
async
¶
Crutch used for await after spawning
Source code in toolboxv2/utils/proxy/prox_util.py
28 29 30 31 32 33 34 |
|
prox_util
¶
ProxyUtil
¶
Source code in toolboxv2/utils/proxy/prox_util.py
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 |
|
__init__(*args, **kwargs)
¶Standard constructor used for arguments pass Do not override. Use ainit instead
Source code in toolboxv2/utils/proxy/prox_util.py
20 21 22 23 24 25 26 |
|
__initobj()
async
¶Crutch used for await after spawning
Source code in toolboxv2/utils/proxy/prox_util.py
28 29 30 31 32 33 34 |
|
security
¶
Code
¶
Source code in toolboxv2/utils/security/cryp.py
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 |
|
decrypt_asymmetric(encrypted_text_hex, private_key_str)
staticmethod
¶
Entschlüsselt einen Text mit einem gegebenen privaten Schlüssel.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
encrypted_text_hex
|
str
|
Der verschlüsselte Text als Hex-String. |
required |
private_key_str
|
str
|
Der private Schlüssel als String. |
required |
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
Der entschlüsselte Text. |
Source code in toolboxv2/utils/security/cryp.py
287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 |
|
decrypt_symmetric(encrypted_text, key, to_str=True, mute=False)
staticmethod
¶
Entschlüsselt einen Text mit einem gegebenen symmetrischen Schlüssel.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
encrypted_text
|
str
|
Der zu entschlüsselnde Text. |
required |
key
|
str
|
Der symmetrische Schlüssel. |
required |
to_str
|
bool
|
default true returns str if false returns bytes |
True
|
Returns: str: Der entschlüsselte Text.
Source code in toolboxv2/utils/security/cryp.py
126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 |
|
encrypt_asymmetric(text, public_key_str)
staticmethod
¶
Verschlüsselt einen Text mit einem gegebenen öffentlichen Schlüssel.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
text
|
str
|
Der zu verschlüsselnde Text. |
required |
public_key_str
|
str
|
Der öffentliche Schlüssel als String oder im pem format. |
required |
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
Der verschlüsselte Text. |
Source code in toolboxv2/utils/security/cryp.py
256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 |
|
encrypt_symmetric(text, key)
staticmethod
¶
Verschlüsselt einen Text mit einem gegebenen symmetrischen Schlüssel.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
text
|
str
|
Der zu verschlüsselnde Text. |
required |
key
|
str
|
Der symmetrische Schlüssel. |
required |
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
Der verschlüsselte Text. |
Source code in toolboxv2/utils/security/cryp.py
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 |
|
generate_asymmetric_keys()
staticmethod
¶
Generiert ein Paar von öffentlichen und privaten Schlüsseln für die asymmetrische Verschlüsselung.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
seed
|
int
|
Ein optionaler Seed-Wert. Standardmäßig None. |
required |
Returns:
Type | Description |
---|---|
(str, str)
|
Ein Tupel aus öffentlichem und privatem Schlüssel. |
Source code in toolboxv2/utils/security/cryp.py
156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 |
|
generate_seed()
staticmethod
¶
Erzeugt eine zufällige Zahl als Seed.
Returns:
Name | Type | Description |
---|---|---|
int |
int
|
Eine zufällige Zahl. |
Source code in toolboxv2/utils/security/cryp.py
68 69 70 71 72 73 74 75 76 |
|
generate_symmetric_key()
staticmethod
¶
Generiert einen Schlüssel für die symmetrische Verschlüsselung.
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
Der generierte Schlüssel. |
Source code in toolboxv2/utils/security/cryp.py
94 95 96 97 98 99 100 101 102 |
|
load_keys_from_files(directory='keys')
staticmethod
¶
Lädt die Schlüssel aus den Dateien. Der private Schlüssel wird mit dem Device Key entschlüsselt.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
directory
|
str
|
Das Verzeichnis, aus dem die Schlüssel geladen werden sollen |
'keys'
|
Returns:
Type | Description |
---|---|
(str, str)
|
Ein Tupel aus öffentlichem und privatem Schlüssel |
Raises:
Type | Description |
---|---|
FileNotFoundError
|
Wenn die Schlüsseldateien nicht gefunden werden können |
Source code in toolboxv2/utils/security/cryp.py
219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 |
|
one_way_hash(text, salt='', pepper='')
staticmethod
¶
Erzeugt einen Hash eines gegebenen Textes mit Salt, Pepper und optional einem Seed.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
text
|
str
|
Der zu hashende Text. |
required |
salt
|
str
|
Der Salt-Wert. |
''
|
pepper
|
str
|
Der Pepper-Wert. |
''
|
seed
|
int
|
Ein optionaler Seed-Wert. Standardmäßig None. |
required |
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
Der resultierende Hash-Wert. |
Source code in toolboxv2/utils/security/cryp.py
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
|
pem_to_public_key(pem_key)
staticmethod
¶
Konvertiert einen PEM-kodierten öffentlichen Schlüssel in ein PublicKey-Objekt.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
pem_key
|
str
|
Der PEM-kodierte öffentliche Schlüssel. |
required |
Returns:
Name | Type | Description |
---|---|---|
PublicKey |
Das PublicKey-Objekt. |
Source code in toolboxv2/utils/security/cryp.py
386 387 388 389 390 391 392 393 394 395 396 397 398 |
|
public_key_to_pem(public_key)
staticmethod
¶
Konvertiert ein PublicKey-Objekt in einen PEM-kodierten String.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
public_key
|
PublicKey
|
Das PublicKey-Objekt. |
required |
Returns:
Name | Type | Description |
---|---|---|
str |
Der PEM-kodierte öffentliche Schlüssel. |
Source code in toolboxv2/utils/security/cryp.py
400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 |
|
save_keys_to_files(public_key, private_key, directory='keys')
staticmethod
¶
Speichert die generierten Schlüssel in separate Dateien. Der private Schlüssel wird mit dem Device Key verschlüsselt.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
public_key
|
str
|
Der öffentliche Schlüssel im PEM-Format |
required |
private_key
|
str
|
Der private Schlüssel im PEM-Format |
required |
directory
|
str
|
Das Verzeichnis, in dem die Schlüssel gespeichert werden sollen |
'keys'
|
Source code in toolboxv2/utils/security/cryp.py
187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 |
|
cryp
¶
Code
¶
Source code in toolboxv2/utils/security/cryp.py
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 |
|
decrypt_asymmetric(encrypted_text_hex, private_key_str)
staticmethod
¶Entschlüsselt einen Text mit einem gegebenen privaten Schlüssel.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
encrypted_text_hex
|
str
|
Der verschlüsselte Text als Hex-String. |
required |
private_key_str
|
str
|
Der private Schlüssel als String. |
required |
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
Der entschlüsselte Text. |
Source code in toolboxv2/utils/security/cryp.py
287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 |
|
decrypt_symmetric(encrypted_text, key, to_str=True, mute=False)
staticmethod
¶Entschlüsselt einen Text mit einem gegebenen symmetrischen Schlüssel.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
encrypted_text
|
str
|
Der zu entschlüsselnde Text. |
required |
key
|
str
|
Der symmetrische Schlüssel. |
required |
to_str
|
bool
|
default true returns str if false returns bytes |
True
|
Returns: str: Der entschlüsselte Text.
Source code in toolboxv2/utils/security/cryp.py
126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 |
|
encrypt_asymmetric(text, public_key_str)
staticmethod
¶Verschlüsselt einen Text mit einem gegebenen öffentlichen Schlüssel.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
text
|
str
|
Der zu verschlüsselnde Text. |
required |
public_key_str
|
str
|
Der öffentliche Schlüssel als String oder im pem format. |
required |
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
Der verschlüsselte Text. |
Source code in toolboxv2/utils/security/cryp.py
256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 |
|
encrypt_symmetric(text, key)
staticmethod
¶Verschlüsselt einen Text mit einem gegebenen symmetrischen Schlüssel.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
text
|
str
|
Der zu verschlüsselnde Text. |
required |
key
|
str
|
Der symmetrische Schlüssel. |
required |
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
Der verschlüsselte Text. |
Source code in toolboxv2/utils/security/cryp.py
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 |
|
generate_asymmetric_keys()
staticmethod
¶Generiert ein Paar von öffentlichen und privaten Schlüsseln für die asymmetrische Verschlüsselung.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
seed
|
int
|
Ein optionaler Seed-Wert. Standardmäßig None. |
required |
Returns:
Type | Description |
---|---|
(str, str)
|
Ein Tupel aus öffentlichem und privatem Schlüssel. |
Source code in toolboxv2/utils/security/cryp.py
156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 |
|
generate_seed()
staticmethod
¶Erzeugt eine zufällige Zahl als Seed.
Returns:
Name | Type | Description |
---|---|---|
int |
int
|
Eine zufällige Zahl. |
Source code in toolboxv2/utils/security/cryp.py
68 69 70 71 72 73 74 75 76 |
|
generate_symmetric_key()
staticmethod
¶Generiert einen Schlüssel für die symmetrische Verschlüsselung.
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
Der generierte Schlüssel. |
Source code in toolboxv2/utils/security/cryp.py
94 95 96 97 98 99 100 101 102 |
|
load_keys_from_files(directory='keys')
staticmethod
¶Lädt die Schlüssel aus den Dateien. Der private Schlüssel wird mit dem Device Key entschlüsselt.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
directory
|
str
|
Das Verzeichnis, aus dem die Schlüssel geladen werden sollen |
'keys'
|
Returns:
Type | Description |
---|---|
(str, str)
|
Ein Tupel aus öffentlichem und privatem Schlüssel |
Raises:
Type | Description |
---|---|
FileNotFoundError
|
Wenn die Schlüsseldateien nicht gefunden werden können |
Source code in toolboxv2/utils/security/cryp.py
219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 |
|
one_way_hash(text, salt='', pepper='')
staticmethod
¶Erzeugt einen Hash eines gegebenen Textes mit Salt, Pepper und optional einem Seed.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
text
|
str
|
Der zu hashende Text. |
required |
salt
|
str
|
Der Salt-Wert. |
''
|
pepper
|
str
|
Der Pepper-Wert. |
''
|
seed
|
int
|
Ein optionaler Seed-Wert. Standardmäßig None. |
required |
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
Der resultierende Hash-Wert. |
Source code in toolboxv2/utils/security/cryp.py
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
|
pem_to_public_key(pem_key)
staticmethod
¶Konvertiert einen PEM-kodierten öffentlichen Schlüssel in ein PublicKey-Objekt.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
pem_key
|
str
|
Der PEM-kodierte öffentliche Schlüssel. |
required |
Returns:
Name | Type | Description |
---|---|---|
PublicKey |
Das PublicKey-Objekt. |
Source code in toolboxv2/utils/security/cryp.py
386 387 388 389 390 391 392 393 394 395 396 397 398 |
|
public_key_to_pem(public_key)
staticmethod
¶Konvertiert ein PublicKey-Objekt in einen PEM-kodierten String.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
public_key
|
PublicKey
|
Das PublicKey-Objekt. |
required |
Returns:
Name | Type | Description |
---|---|---|
str |
Der PEM-kodierte öffentliche Schlüssel. |
Source code in toolboxv2/utils/security/cryp.py
400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 |
|
save_keys_to_files(public_key, private_key, directory='keys')
staticmethod
¶Speichert die generierten Schlüssel in separate Dateien. Der private Schlüssel wird mit dem Device Key verschlüsselt.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
public_key
|
str
|
Der öffentliche Schlüssel im PEM-Format |
required |
private_key
|
str
|
Der private Schlüssel im PEM-Format |
required |
directory
|
str
|
Das Verzeichnis, in dem die Schlüssel gespeichert werden sollen |
'keys'
|
Source code in toolboxv2/utils/security/cryp.py
187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 |
|
singelton_class
¶
Singleton
¶
Singleton metaclass for ensuring only one instance of a class.
Source code in toolboxv2/utils/singelton_class.py
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
|
system
¶
AppType
¶
Source code in toolboxv2/utils/system/types.py
1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 |
|
debug
property
writable
¶
proxi attr
prefix = prefix
instance-attribute
¶
proxi attr
a_exit()
async
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
1413 1414 |
|
a_fuction_runner(function, function_data, args, kwargs)
async
¶
parameters = function_data.get('params') modular_name = function_data.get('module_name') function_name = function_data.get('func_name') mod_function_name = f"{modular_name}.{function_name}"
proxi attr
Source code in toolboxv2/utils/system/types.py
1464 1465 1466 1467 1468 1469 1470 1471 1472 |
|
a_remove_mod(mod_name, spec='app', delete=True)
async
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
1404 1405 |
|
a_run_any(mod_function_name, backwords_compability_variabel_string_holder=None, get_results=False, tb_run_function_with_state=True, tb_run_with_specification='app', args_=None, kwargs_=None, *args, **kwargs)
async
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
1486 1487 1488 1489 1490 1491 |
|
a_run_function(mod_function_name, tb_run_function_with_state=True, tb_run_with_specification='app', args_=None, kwargs_=None, *args, **kwargs)
async
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
1444 1445 1446 1447 1448 1449 1450 1451 1452 |
|
debug_rains(e)
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
1298 1299 |
|
disconnect(*args, **kwargs)
async
staticmethod
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
1286 1287 1288 |
|
execute_all_functions(m_query='', f_query='', enable_profiling=True)
async
¶
Execute all functions with parallel processing and optional profiling.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
m_query
|
str
|
Module name query filter |
''
|
f_query
|
str
|
Function name query filter |
''
|
enable_profiling
|
bool
|
Enable detailed profiling information |
True
|
Source code in toolboxv2/utils/system/types.py
1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 |
|
exit()
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
1407 1408 |
|
exit_main(*args, **kwargs)
staticmethod
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
1274 1275 1276 |
|
fuction_runner(function, function_data, args, kwargs, t0=0.0)
¶
parameters = function_data.get('params') modular_name = function_data.get('module_name') function_name = function_data.get('func_name') mod_function_name = f"{modular_name}.{function_name}"
proxi attr
Source code in toolboxv2/utils/system/types.py
1454 1455 1456 1457 1458 1459 1460 1461 1462 |
|
get_all_mods(working_dir='mods', path_to='./runtime')
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
1378 1379 |
|
get_autocompletion_dict()
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
1669 1670 |
|
get_function(name, **kwargs)
¶
Kwargs for _get_function metadata:: return the registered function dictionary stateless: (function_data, None), 0 stateful: (function_data, higher_order_function), 0 state::boolean specification::str default app
Source code in toolboxv2/utils/system/types.py
1419 1420 1421 1422 1423 1424 1425 1426 1427 |
|
get_mod(name, spec='app')
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
1493 1494 |
|
get_username(get_input=False, default='loot')
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
1672 1673 |
|
hide_console(*args, **kwargs)
async
staticmethod
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
1278 1279 1280 |
|
inplace_load_instance(mod_name, loc='toolboxv2.mods.', spec='app', save=True)
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
1347 1348 |
|
load_all_mods_in_file(working_dir='mods')
async
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
1375 1376 |
|
load_mod(mod_name, mlm='I', **kwargs)
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
1369 1370 |
|
mod_online(mod_name, installed=False)
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
1356 1357 |
|
print(text, *args, **kwargs)
staticmethod
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
1496 1497 1498 |
|
print_ok()
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
1391 1392 1393 |
|
reload_mod(mod_name, spec='app', is_file=True, loc='toolboxv2.mods.')
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
1395 1396 |
|
remove_mod(mod_name, spec='app', delete=True)
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
1401 1402 |
|
rrun_flows(name, **kwargs)
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
1307 1308 |
|
run_a_from_sync(function, *args)
¶
run a async fuction
Source code in toolboxv2/utils/system/types.py
1429 1430 1431 1432 |
|
run_any(mod_function_name, backwords_compability_variabel_string_holder=None, get_results=False, tb_run_function_with_state=True, tb_run_with_specification='app', args_=None, kwargs_=None, *args, **kwargs)
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
1480 1481 1482 1483 1484 |
|
run_flows(name, **kwargs)
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
1304 1305 |
|
run_function(mod_function_name, tb_run_function_with_state=True, tb_run_with_specification='app', args_=None, kwargs_=None, *args, **kwargs)
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
1434 1435 1436 1437 1438 1439 1440 1441 1442 |
|
run_http(mod_function_name, function_name=None, method='GET', args_=None, kwargs_=None, *args, **kwargs)
async
¶
run a function remote via http / https
Source code in toolboxv2/utils/system/types.py
1474 1475 1476 1477 1478 |
|
save_autocompletion_dict()
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
1666 1667 |
|
save_exit()
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
1366 1367 |
|
save_initialized_module(tools_class, spec)
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
1353 1354 |
|
save_instance(instance, modular_id, spec='app', instance_type='file/application', tools_class=None)
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
1350 1351 |
|
save_load(modname, spec='app')
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
1416 1417 |
|
save_registry_as_enums(directory, filename)
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
1675 1676 |
|
set_flows(r)
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
1301 1302 |
|
set_logger(debug=False)
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
1290 1291 |
|
show_console(*args, **kwargs)
async
staticmethod
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
1282 1283 1284 |
|
sprint(text, *args, **kwargs)
staticmethod
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
1500 1501 1502 |
|
tb(name=None, mod_name='', helper='', version=None, test=True, restrict_in_virtual_mode=False, api=False, initial=False, exit_f=False, test_only=False, memory_cache=False, file_cache=False, row=False, request_as_kwarg=False, state=None, level=0, memory_cache_max_size=100, memory_cache_ttl=300, samples=None, interface=None, pre_compute=None, post_compute=None, api_methods=None)
¶
A decorator for registering and configuring functions within a module.
This decorator is used to wrap functions with additional functionality such as caching, API conversion, and lifecycle management (initialization and exit). It also handles the registration of the function in the module's function registry.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str
|
The name to register the function under. Defaults to the function's own name. |
None
|
mod_name
|
str
|
The name of the module the function belongs to. |
''
|
helper
|
str
|
A helper string providing additional information about the function. |
''
|
version
|
str or None
|
The version of the function or module. |
None
|
test
|
bool
|
Flag to indicate if the function is for testing purposes. |
True
|
restrict_in_virtual_mode
|
bool
|
Flag to restrict the function in virtual mode. |
False
|
api
|
bool
|
Flag to indicate if the function is part of an API. |
False
|
initial
|
bool
|
Flag to indicate if the function should be executed at initialization. |
False
|
exit_f
|
bool
|
Flag to indicate if the function should be executed at exit. |
False
|
test_only
|
bool
|
Flag to indicate if the function should only be used for testing. |
False
|
memory_cache
|
bool
|
Flag to enable memory caching for the function. |
False
|
request_as_kwarg
|
bool
|
Flag to get request if the fuction is calld from api. |
False
|
file_cache
|
bool
|
Flag to enable file caching for the function. |
False
|
row
|
bool
|
rather to auto wrap the result in Result type default False means no row data aka result type |
False
|
state
|
bool or None
|
Flag to indicate if the function maintains state. |
None
|
level
|
int
|
The level of the function, used for prioritization or categorization. |
0
|
memory_cache_max_size
|
int
|
Maximum size of the memory cache. |
100
|
memory_cache_ttl
|
int
|
Time-to-live for the memory cache entries. |
300
|
samples
|
list or dict or None
|
Samples or examples of function usage. |
None
|
interface
|
str
|
The interface type for the function. |
None
|
pre_compute
|
callable
|
A function to be called before the main function. |
None
|
post_compute
|
callable
|
A function to be called after the main function. |
None
|
api_methods
|
list[str]
|
default ["AUTO"] (GET if not params, POST if params) , GET, POST, PUT or DELETE. |
None
|
Returns:
Name | Type | Description |
---|---|---|
function |
The decorated function with additional processing and registration capabilities. |
Source code in toolboxv2/utils/system/types.py
1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 |
|
watch_mod(mod_name, spec='app', loc='toolboxv2.mods.', use_thread=True, path_name=None)
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
1398 1399 |
|
web_context()
¶
returns the build index ( toolbox web component )
Source code in toolboxv2/utils/system/types.py
1410 1411 |
|
MainTool
¶
Source code in toolboxv2/utils/system/main_tool.py
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 |
|
__init__(*args, **kwargs)
¶
Standard constructor used for arguments pass Do not override. Use ainit instead
Source code in toolboxv2/utils/system/main_tool.py
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
|
__initobj()
async
¶
Crutch used for await after spawning
Source code in toolboxv2/utils/system/main_tool.py
163 164 165 166 167 168 169 |
|
get_version()
¶
"Returns the version
Source code in toolboxv2/utils/system/main_tool.py
156 157 158 |
|
webInstall(user_instance, construct_render)
¶
"Returns a web installer for the given user instance and construct render template
Source code in toolboxv2/utils/system/main_tool.py
153 154 |
|
MainToolType
¶
Source code in toolboxv2/utils/system/types.py
1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 |
|
load()
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
1186 1187 |
|
print(message, end='\n', **kwargs)
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
1189 1190 |
|
return_result(error=ToolBoxError.none, exec_code=0, help_text='', data_info=None, data=None, data_to=None)
staticmethod
¶
proxi attr
Source code in toolboxv2/utils/system/types.py
1177 1178 1179 1180 1181 1182 1183 1184 |
|
webInstall(user_instance, construct_render)
¶
"Returns a web installer for the given user instance and construct render template
Source code in toolboxv2/utils/system/types.py
1198 1199 |
|
Result
¶
Source code in toolboxv2/utils/system/types.py
621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 |
|
binary(data, content_type='application/octet-stream', download_name=None, info='OK', interface=ToolBoxInterfaces.remote)
classmethod
¶
Create a binary data response Result.
Source code in toolboxv2/utils/system/types.py
879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 |
|
file(data, filename, content_type=None, info='OK', interface=ToolBoxInterfaces.remote)
classmethod
¶
Create a file download response Result.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data
|
File data as bytes or base64 string |
required | |
filename
|
Name of the file for download |
required | |
content_type
|
MIME type of the file (auto-detected if None) |
None
|
|
info
|
Response info text |
'OK'
|
|
interface
|
Target interface |
remote
|
Returns:
Type | Description |
---|---|
Result object configured for file download |
Source code in toolboxv2/utils/system/types.py
902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 |
|
json(data, info='OK', interface=ToolBoxInterfaces.remote, exec_code=0, status_code=None)
classmethod
¶
Create a JSON response Result.
Source code in toolboxv2/utils/system/types.py
847 848 849 850 851 852 853 854 855 856 857 858 859 860 |
|
redirect(url, status_code=302, info='Redirect', interface=ToolBoxInterfaces.remote)
classmethod
¶
Create a redirect response.
Source code in toolboxv2/utils/system/types.py
946 947 948 949 950 951 952 953 954 955 956 957 958 959 |
|
sse(stream_generator, info='OK', interface=ToolBoxInterfaces.remote, cleanup_func=None)
classmethod
¶
Create an Server-Sent Events (SSE) streaming response Result.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
stream_generator
|
Any
|
A source yielding individual data items. This can be an async generator, sync generator, iterable, or a single item. Each item will be formatted as an SSE event. |
required |
info
|
str
|
Optional help text for the Result. |
'OK'
|
interface
|
ToolBoxInterfaces
|
Optional ToolBoxInterface to target. |
remote
|
cleanup_func
|
Union[Callable[[], None], Callable[[], T], Callable[[], AsyncGenerator[T, None]], None]
|
Optional cleanup function to run when the stream ends or is cancelled. |
None
|
#http_headers
|
Optional dictionary of custom HTTP headers for the SSE response. |
required |
Returns:
Type | Description |
---|---|
A Result object configured for SSE streaming. |
Source code in toolboxv2/utils/system/types.py
805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 |
|
stream(stream_generator, content_type='text/event-stream', headers=None, info='OK', interface=ToolBoxInterfaces.remote, cleanup_func=None)
classmethod
¶
Create a streaming response Result. Handles SSE and other stream types.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
stream_generator
|
Any
|
Any stream source (async generator, sync generator, iterable, or single item). |
required |
content_type
|
str
|
Content-Type header (default: text/event-stream for SSE). |
'text/event-stream'
|
headers
|
Union[dict, None]
|
Additional HTTP headers for the response. |
None
|
info
|
str
|
Help text for the result. |
'OK'
|
interface
|
ToolBoxInterfaces
|
Interface to send data to. |
remote
|
cleanup_func
|
Union[Callable[[], None], Callable[[], T], Callable[[], AsyncGenerator[T, None]], None]
|
Optional function for cleanup. |
None
|
Returns:
Type | Description |
---|---|
A Result object configured for streaming. |
Source code in toolboxv2/utils/system/types.py
726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 |
|
text(text_data, content_type='text/plain', exec_code=None, status=200, info='OK', interface=ToolBoxInterfaces.remote, headers=None)
classmethod
¶
Create a text response Result with specific content type.
Source code in toolboxv2/utils/system/types.py
862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 |
|
all_functions_enums
¶
Automatic generated by ToolBox v = 0.1.21
api
¶
build_cargo_project(debug=False)
¶
Build the Cargo project, optionally in debug mode.
Source code in toolboxv2/utils/system/api.py
220 221 222 223 224 225 226 227 228 229 230 231 232 233 |
|
check_and_run_local_release(do_run=True)
¶
Search for a pre-built release executable in the src-core folder and run it if found.
Source code in toolboxv2/utils/system/api.py
181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 |
|
check_cargo_installed()
¶
Check if Cargo (Rust package manager) is installed on the system.
Source code in toolboxv2/utils/system/api.py
211 212 213 214 215 216 217 |
|
cleanup_build_files()
¶
Cleans up build files.
Source code in toolboxv2/utils/system/api.py
299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 |
|
create_dill_archive(site_packages, output_file='python312.dill')
¶
Package dill and all dependencies into a single .dill archive.
Source code in toolboxv2/utils/system/api.py
347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 |
|
detect_os_and_arch()
¶
Detect the current operating system and architecture.
Source code in toolboxv2/utils/system/api.py
119 120 121 122 123 |
|
download_executable(url, file_name)
¶
Attempt to download the executable from the provided URL.
Source code in toolboxv2/utils/system/api.py
141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 |
|
ensure_socket_and_fd_file_posix(host, port, backlog, fd_file_path)
¶
POSIX: Ensures a listening socket exists and its FD is in the fd_file.
Source code in toolboxv2/utils/system/api.py
518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 |
|
find_highest_zip_version(name_filter, app_version=None, root_dir='mods_sto', version_only=False)
¶
Findet die höchste verfügbare ZIP-Version in einem Verzeichnis basierend auf einem Namensfilter.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
root_dir
|
str
|
Wurzelverzeichnis für die Suche |
'mods_sto'
|
name_filter
|
str
|
Namensfilter für die ZIP-Dateien |
required |
app_version
|
str
|
Aktuelle App-Version für Kompatibilitätsprüfung |
None
|
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
Pfad zur ZIP-Datei mit der höchsten Version oder None wenn keine gefunden |
Source code in toolboxv2/utils/system/api.py
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 |
|
find_highest_zip_version_entry(name, target_app_version=None, filepath='tbState.yaml')
¶
Findet den Eintrag mit der höchsten ZIP-Version für einen gegebenen Namen und eine optionale Ziel-App-Version in einer YAML-Datei.
:param name: Der Name des gesuchten Eintrags. :param target_app_version: Die Zielversion der App als String (optional). :param filepath: Der Pfad zur YAML-Datei. :return: Den Eintrag mit der höchsten ZIP-Version innerhalb der Ziel-App-Version oder None, falls nicht gefunden.
Source code in toolboxv2/utils/system/api.py
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
|
get_uv_site_packages()
¶
Find the site-packages directory for a uv-managed virtual environment.
Source code in toolboxv2/utils/system/api.py
336 337 338 339 340 341 342 343 344 345 |
|
is_uv_installed()
¶
Check if uv is installed.
Source code in toolboxv2/utils/system/api.py
328 329 330 331 332 333 334 |
|
main_api_runner(debug=False, run=True)
¶
Main function to run the API server. When debug=True, enables hot reloading and runs in debug mode.
Non blocking!
Source code in toolboxv2/utils/system/api.py
388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 |
|
query_executable_url(current_os, machine)
¶
Query a remote URL for a matching executable based on OS and architecture. The file name is built dynamically based on parameters.
Source code in toolboxv2/utils/system/api.py
126 127 128 129 130 131 132 133 134 135 136 137 138 |
|
remove_release_executable()
¶
Removes the release executable.
Source code in toolboxv2/utils/system/api.py
273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 |
|
run_executable(file_path)
¶
Run the executable file.
Source code in toolboxv2/utils/system/api.py
170 171 172 173 174 175 176 177 178 |
|
run_in_debug_mode()
¶
Run the Cargo project in debug mode.
Source code in toolboxv2/utils/system/api.py
261 262 263 264 265 266 267 268 269 270 |
|
run_with_hot_reload()
¶
Run the Cargo project with hot reloading.
Source code in toolboxv2/utils/system/api.py
236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 |
|
start_rust_server_posix(executable_path, persistent_fd)
¶
POSIX: Starts Rust server passing the persistent_fd.
Source code in toolboxv2/utils/system/api.py
558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 |
|
start_rust_server_windows(executable_path)
¶
WINDOWS: Starts Rust server normally. It will bind its own socket.
Source code in toolboxv2/utils/system/api.py
578 579 580 581 582 583 584 585 586 587 588 589 590 591 |
|
update_server(new_executable_path, new_version)
¶
High-level update function, calls platform-specific logic.
Source code in toolboxv2/utils/system/api.py
595 596 597 598 599 600 |
|
update_server_posix(new_executable_path, new_version)
¶
POSIX: Zero-downtime update using persistent FD.
Source code in toolboxv2/utils/system/api.py
602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 |
|
update_server_windows(new_executable_path, new_version)
¶
WINDOWS: Graceful restart (stop old, start new).
Source code in toolboxv2/utils/system/api.py
637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 |
|
conda_runner
¶
create_env_registry(env_name)
¶
Create a JSON registry of all packages installed in the specified conda environment.
Args: env_name (str): Name of the conda environment
Returns: bool: True if registry creation was successful, False otherwise
Source code in toolboxv2/utils/system/conda_runner.py
136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 |
|
main_tool
¶
MainTool
¶
Source code in toolboxv2/utils/system/main_tool.py
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 |
|
__init__(*args, **kwargs)
¶Standard constructor used for arguments pass Do not override. Use ainit instead
Source code in toolboxv2/utils/system/main_tool.py
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
|
__initobj()
async
¶Crutch used for await after spawning
Source code in toolboxv2/utils/system/main_tool.py
163 164 165 166 167 168 169 |
|
get_version()
¶"Returns the version
Source code in toolboxv2/utils/system/main_tool.py
156 157 158 |
|
webInstall(user_instance, construct_render)
¶"Returns a web installer for the given user instance and construct render template
Source code in toolboxv2/utils/system/main_tool.py
153 154 |
|
get_version_from_pyproject(pyproject_path='../pyproject.toml')
¶
Reads the version from the pyproject.toml file.
Source code in toolboxv2/utils/system/main_tool.py
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
|
state_system
¶
The Task of the State System is : 1 Kep trak of the current state of the ToolBox and its dependency's 2 tracks the shasum of all mod and runnabael 3 the version of all mod
The state : {"utils":{"file_name": {"version":##,"shasum"}} ,"mods":{"file_name": {"version":##,"shasum":##,"src-url":##}} ,"runnable":{"file_name": {"version":##,"shasum":##,"src-url":##}} ,"api":{"file_name": {"version":##,"shasum"}} ,"app":{"file_name": {"version":##,"shasum":##,"src-url":##}} }
trans form state from on to an other.
types
¶
AppType
¶
Source code in toolboxv2/utils/system/types.py
1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 |
|
debug
property
writable
¶proxi attr
prefix = prefix
instance-attribute
¶proxi attr
a_exit()
async
¶proxi attr
Source code in toolboxv2/utils/system/types.py
1413 1414 |
|
a_fuction_runner(function, function_data, args, kwargs)
async
¶parameters = function_data.get('params') modular_name = function_data.get('module_name') function_name = function_data.get('func_name') mod_function_name = f"{modular_name}.{function_name}"
proxi attr
Source code in toolboxv2/utils/system/types.py
1464 1465 1466 1467 1468 1469 1470 1471 1472 |
|
a_remove_mod(mod_name, spec='app', delete=True)
async
¶proxi attr
Source code in toolboxv2/utils/system/types.py
1404 1405 |
|
a_run_any(mod_function_name, backwords_compability_variabel_string_holder=None, get_results=False, tb_run_function_with_state=True, tb_run_with_specification='app', args_=None, kwargs_=None, *args, **kwargs)
async
¶proxi attr
Source code in toolboxv2/utils/system/types.py
1486 1487 1488 1489 1490 1491 |
|
a_run_function(mod_function_name, tb_run_function_with_state=True, tb_run_with_specification='app', args_=None, kwargs_=None, *args, **kwargs)
async
¶proxi attr
Source code in toolboxv2/utils/system/types.py
1444 1445 1446 1447 1448 1449 1450 1451 1452 |
|
debug_rains(e)
¶proxi attr
Source code in toolboxv2/utils/system/types.py
1298 1299 |
|
disconnect(*args, **kwargs)
async
staticmethod
¶proxi attr
Source code in toolboxv2/utils/system/types.py
1286 1287 1288 |
|
execute_all_functions(m_query='', f_query='', enable_profiling=True)
async
¶Execute all functions with parallel processing and optional profiling.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
m_query
|
str
|
Module name query filter |
''
|
f_query
|
str
|
Function name query filter |
''
|
enable_profiling
|
bool
|
Enable detailed profiling information |
True
|
Source code in toolboxv2/utils/system/types.py
1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 |
|
exit()
¶proxi attr
Source code in toolboxv2/utils/system/types.py
1407 1408 |
|
exit_main(*args, **kwargs)
staticmethod
¶proxi attr
Source code in toolboxv2/utils/system/types.py
1274 1275 1276 |
|
fuction_runner(function, function_data, args, kwargs, t0=0.0)
¶parameters = function_data.get('params') modular_name = function_data.get('module_name') function_name = function_data.get('func_name') mod_function_name = f"{modular_name}.{function_name}"
proxi attr
Source code in toolboxv2/utils/system/types.py
1454 1455 1456 1457 1458 1459 1460 1461 1462 |
|
get_all_mods(working_dir='mods', path_to='./runtime')
¶proxi attr
Source code in toolboxv2/utils/system/types.py
1378 1379 |
|
get_autocompletion_dict()
¶proxi attr
Source code in toolboxv2/utils/system/types.py
1669 1670 |
|
get_function(name, **kwargs)
¶Kwargs for _get_function metadata:: return the registered function dictionary stateless: (function_data, None), 0 stateful: (function_data, higher_order_function), 0 state::boolean specification::str default app
Source code in toolboxv2/utils/system/types.py
1419 1420 1421 1422 1423 1424 1425 1426 1427 |
|
get_mod(name, spec='app')
¶proxi attr
Source code in toolboxv2/utils/system/types.py
1493 1494 |
|
get_username(get_input=False, default='loot')
¶proxi attr
Source code in toolboxv2/utils/system/types.py
1672 1673 |
|
hide_console(*args, **kwargs)
async
staticmethod
¶proxi attr
Source code in toolboxv2/utils/system/types.py
1278 1279 1280 |
|
inplace_load_instance(mod_name, loc='toolboxv2.mods.', spec='app', save=True)
¶proxi attr
Source code in toolboxv2/utils/system/types.py
1347 1348 |
|
load_all_mods_in_file(working_dir='mods')
async
¶proxi attr
Source code in toolboxv2/utils/system/types.py
1375 1376 |
|
load_mod(mod_name, mlm='I', **kwargs)
¶proxi attr
Source code in toolboxv2/utils/system/types.py
1369 1370 |
|
mod_online(mod_name, installed=False)
¶proxi attr
Source code in toolboxv2/utils/system/types.py
1356 1357 |
|
print(text, *args, **kwargs)
staticmethod
¶proxi attr
Source code in toolboxv2/utils/system/types.py
1496 1497 1498 |
|
print_ok()
¶proxi attr
Source code in toolboxv2/utils/system/types.py
1391 1392 1393 |
|
reload_mod(mod_name, spec='app', is_file=True, loc='toolboxv2.mods.')
¶proxi attr
Source code in toolboxv2/utils/system/types.py
1395 1396 |
|
remove_mod(mod_name, spec='app', delete=True)
¶proxi attr
Source code in toolboxv2/utils/system/types.py
1401 1402 |
|
rrun_flows(name, **kwargs)
¶proxi attr
Source code in toolboxv2/utils/system/types.py
1307 1308 |
|
run_a_from_sync(function, *args)
¶run a async fuction
Source code in toolboxv2/utils/system/types.py
1429 1430 1431 1432 |
|
run_any(mod_function_name, backwords_compability_variabel_string_holder=None, get_results=False, tb_run_function_with_state=True, tb_run_with_specification='app', args_=None, kwargs_=None, *args, **kwargs)
¶proxi attr
Source code in toolboxv2/utils/system/types.py
1480 1481 1482 1483 1484 |
|
run_flows(name, **kwargs)
¶proxi attr
Source code in toolboxv2/utils/system/types.py
1304 1305 |
|
run_function(mod_function_name, tb_run_function_with_state=True, tb_run_with_specification='app', args_=None, kwargs_=None, *args, **kwargs)
¶proxi attr
Source code in toolboxv2/utils/system/types.py
1434 1435 1436 1437 1438 1439 1440 1441 1442 |
|
run_http(mod_function_name, function_name=None, method='GET', args_=None, kwargs_=None, *args, **kwargs)
async
¶run a function remote via http / https
Source code in toolboxv2/utils/system/types.py
1474 1475 1476 1477 1478 |
|
save_autocompletion_dict()
¶proxi attr
Source code in toolboxv2/utils/system/types.py
1666 1667 |
|
save_exit()
¶proxi attr
Source code in toolboxv2/utils/system/types.py
1366 1367 |
|
save_initialized_module(tools_class, spec)
¶proxi attr
Source code in toolboxv2/utils/system/types.py
1353 1354 |
|
save_instance(instance, modular_id, spec='app', instance_type='file/application', tools_class=None)
¶proxi attr
Source code in toolboxv2/utils/system/types.py
1350 1351 |
|
save_load(modname, spec='app')
¶proxi attr
Source code in toolboxv2/utils/system/types.py
1416 1417 |
|
save_registry_as_enums(directory, filename)
¶proxi attr
Source code in toolboxv2/utils/system/types.py
1675 1676 |
|
set_flows(r)
¶proxi attr
Source code in toolboxv2/utils/system/types.py
1301 1302 |
|
set_logger(debug=False)
¶proxi attr
Source code in toolboxv2/utils/system/types.py
1290 1291 |
|
show_console(*args, **kwargs)
async
staticmethod
¶proxi attr
Source code in toolboxv2/utils/system/types.py
1282 1283 1284 |
|
sprint(text, *args, **kwargs)
staticmethod
¶proxi attr
Source code in toolboxv2/utils/system/types.py
1500 1501 1502 |
|
tb(name=None, mod_name='', helper='', version=None, test=True, restrict_in_virtual_mode=False, api=False, initial=False, exit_f=False, test_only=False, memory_cache=False, file_cache=False, row=False, request_as_kwarg=False, state=None, level=0, memory_cache_max_size=100, memory_cache_ttl=300, samples=None, interface=None, pre_compute=None, post_compute=None, api_methods=None)
¶A decorator for registering and configuring functions within a module.
This decorator is used to wrap functions with additional functionality such as caching, API conversion, and lifecycle management (initialization and exit). It also handles the registration of the function in the module's function registry.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str
|
The name to register the function under. Defaults to the function's own name. |
None
|
mod_name
|
str
|
The name of the module the function belongs to. |
''
|
helper
|
str
|
A helper string providing additional information about the function. |
''
|
version
|
str or None
|
The version of the function or module. |
None
|
test
|
bool
|
Flag to indicate if the function is for testing purposes. |
True
|
restrict_in_virtual_mode
|
bool
|
Flag to restrict the function in virtual mode. |
False
|
api
|
bool
|
Flag to indicate if the function is part of an API. |
False
|
initial
|
bool
|
Flag to indicate if the function should be executed at initialization. |
False
|
exit_f
|
bool
|
Flag to indicate if the function should be executed at exit. |
False
|
test_only
|
bool
|
Flag to indicate if the function should only be used for testing. |
False
|
memory_cache
|
bool
|
Flag to enable memory caching for the function. |
False
|
request_as_kwarg
|
bool
|
Flag to get request if the fuction is calld from api. |
False
|
file_cache
|
bool
|
Flag to enable file caching for the function. |
False
|
row
|
bool
|
rather to auto wrap the result in Result type default False means no row data aka result type |
False
|
state
|
bool or None
|
Flag to indicate if the function maintains state. |
None
|
level
|
int
|
The level of the function, used for prioritization or categorization. |
0
|
memory_cache_max_size
|
int
|
Maximum size of the memory cache. |
100
|
memory_cache_ttl
|
int
|
Time-to-live for the memory cache entries. |
300
|
samples
|
list or dict or None
|
Samples or examples of function usage. |
None
|
interface
|
str
|
The interface type for the function. |
None
|
pre_compute
|
callable
|
A function to be called before the main function. |
None
|
post_compute
|
callable
|
A function to be called after the main function. |
None
|
api_methods
|
list[str]
|
default ["AUTO"] (GET if not params, POST if params) , GET, POST, PUT or DELETE. |
None
|
Returns:
Name | Type | Description |
---|---|---|
function |
The decorated function with additional processing and registration capabilities. |
Source code in toolboxv2/utils/system/types.py
1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 |
|
watch_mod(mod_name, spec='app', loc='toolboxv2.mods.', use_thread=True, path_name=None)
¶proxi attr
Source code in toolboxv2/utils/system/types.py
1398 1399 |
|
web_context()
¶returns the build index ( toolbox web component )
Source code in toolboxv2/utils/system/types.py
1410 1411 |
|
Headers
dataclass
¶
Class representing HTTP headers with strongly typed common fields.
Source code in toolboxv2/utils/system/types.py
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 |
|
__post_init__()
¶Convert header keys with hyphens to underscores for attribute access.
Source code in toolboxv2/utils/system/types.py
162 163 164 165 166 167 168 169 170 171 172 173 |
|
from_dict(headers_dict)
classmethod
¶Create a Headers instance from a dictionary.
Source code in toolboxv2/utils/system/types.py
175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 |
|
to_dict()
¶Convert the Headers object back to a dictionary.
Source code in toolboxv2/utils/system/types.py
196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 |
|
MainToolType
¶
Source code in toolboxv2/utils/system/types.py
1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 |
|
load()
¶proxi attr
Source code in toolboxv2/utils/system/types.py
1186 1187 |
|
print(message, end='\n', **kwargs)
¶proxi attr
Source code in toolboxv2/utils/system/types.py
1189 1190 |
|
return_result(error=ToolBoxError.none, exec_code=0, help_text='', data_info=None, data=None, data_to=None)
staticmethod
¶proxi attr
Source code in toolboxv2/utils/system/types.py
1177 1178 1179 1180 1181 1182 1183 1184 |
|
webInstall(user_instance, construct_render)
¶"Returns a web installer for the given user instance and construct render template
Source code in toolboxv2/utils/system/types.py
1198 1199 |
|
Request
dataclass
¶
Class representing an HTTP request.
Source code in toolboxv2/utils/system/types.py
215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 |
|
from_dict(data)
classmethod
¶Create a Request instance from a dictionary.
Source code in toolboxv2/utils/system/types.py
226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 |
|
to_dict()
¶Convert the Request object back to a dictionary.
Source code in toolboxv2/utils/system/types.py
242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 |
|
RequestData
dataclass
¶
Main class representing the complete request data structure.
Source code in toolboxv2/utils/system/types.py
303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 |
|
__getattr__(name)
¶Delegate unknown attributes to the request
object.
Source code in toolboxv2/utils/system/types.py
327 328 329 330 331 332 333 |
|
from_dict(data)
classmethod
¶Create a RequestData instance from a dictionary.
Source code in toolboxv2/utils/system/types.py
310 311 312 313 314 315 316 317 |
|
to_dict()
¶Convert the RequestData object back to a dictionary.
Source code in toolboxv2/utils/system/types.py
319 320 321 322 323 324 325 |
|
Result
¶
Source code in toolboxv2/utils/system/types.py
621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 |
|
binary(data, content_type='application/octet-stream', download_name=None, info='OK', interface=ToolBoxInterfaces.remote)
classmethod
¶Create a binary data response Result.
Source code in toolboxv2/utils/system/types.py
879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 |
|
file(data, filename, content_type=None, info='OK', interface=ToolBoxInterfaces.remote)
classmethod
¶Create a file download response Result.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data
|
File data as bytes or base64 string |
required | |
filename
|
Name of the file for download |
required | |
content_type
|
MIME type of the file (auto-detected if None) |
None
|
|
info
|
Response info text |
'OK'
|
|
interface
|
Target interface |
remote
|
Returns:
Type | Description |
---|---|
Result object configured for file download |
Source code in toolboxv2/utils/system/types.py
902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 |
|
json(data, info='OK', interface=ToolBoxInterfaces.remote, exec_code=0, status_code=None)
classmethod
¶Create a JSON response Result.
Source code in toolboxv2/utils/system/types.py
847 848 849 850 851 852 853 854 855 856 857 858 859 860 |
|
redirect(url, status_code=302, info='Redirect', interface=ToolBoxInterfaces.remote)
classmethod
¶Create a redirect response.
Source code in toolboxv2/utils/system/types.py
946 947 948 949 950 951 952 953 954 955 956 957 958 959 |
|
sse(stream_generator, info='OK', interface=ToolBoxInterfaces.remote, cleanup_func=None)
classmethod
¶Create an Server-Sent Events (SSE) streaming response Result.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
stream_generator
|
Any
|
A source yielding individual data items. This can be an async generator, sync generator, iterable, or a single item. Each item will be formatted as an SSE event. |
required |
info
|
str
|
Optional help text for the Result. |
'OK'
|
interface
|
ToolBoxInterfaces
|
Optional ToolBoxInterface to target. |
remote
|
cleanup_func
|
Union[Callable[[], None], Callable[[], T], Callable[[], AsyncGenerator[T, None]], None]
|
Optional cleanup function to run when the stream ends or is cancelled. |
None
|
#http_headers
|
Optional dictionary of custom HTTP headers for the SSE response. |
required |
Returns:
Type | Description |
---|---|
A Result object configured for SSE streaming. |
Source code in toolboxv2/utils/system/types.py
805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 |
|
stream(stream_generator, content_type='text/event-stream', headers=None, info='OK', interface=ToolBoxInterfaces.remote, cleanup_func=None)
classmethod
¶Create a streaming response Result. Handles SSE and other stream types.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
stream_generator
|
Any
|
Any stream source (async generator, sync generator, iterable, or single item). |
required |
content_type
|
str
|
Content-Type header (default: text/event-stream for SSE). |
'text/event-stream'
|
headers
|
Union[dict, None]
|
Additional HTTP headers for the response. |
None
|
info
|
str
|
Help text for the result. |
'OK'
|
interface
|
ToolBoxInterfaces
|
Interface to send data to. |
remote
|
cleanup_func
|
Union[Callable[[], None], Callable[[], T], Callable[[], AsyncGenerator[T, None]], None]
|
Optional function for cleanup. |
None
|
Returns:
Type | Description |
---|---|
A Result object configured for streaming. |
Source code in toolboxv2/utils/system/types.py
726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 |
|
text(text_data, content_type='text/plain', exec_code=None, status=200, info='OK', interface=ToolBoxInterfaces.remote, headers=None)
classmethod
¶Create a text response Result with specific content type.
Source code in toolboxv2/utils/system/types.py
862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 |
|
SSEGenerator
¶
Production-ready SSE generator that converts any data source to properly formatted Server-Sent Events compatible with browsers.
Source code in toolboxv2/utils/system/types.py
2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 |
|
create_sse_stream(source, cleanup_func=None)
async
classmethod
¶Convert any source to a properly formatted SSE stream.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
source
|
Any
|
Can be async generator, sync generator, iterable, or a single item. |
required |
cleanup_func
|
Union[Callable[[], None], Callable[[], T], Callable[[], AsyncGenerator[T, None]], None]
|
Optional function to call when the stream ends or is cancelled. Can be a synchronous function, async function, or async generator. |
None
|
Yields:
Type | Description |
---|---|
AsyncGenerator[str, None]
|
Properly formatted SSE messages (strings). |
Source code in toolboxv2/utils/system/types.py
2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 |
|
format_sse_event(data)
staticmethod
¶Format any data as a proper SSE event message.
Source code in toolboxv2/utils/system/types.py
2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 |
|
wrap_sync_generator(generator)
async
classmethod
¶Convert a synchronous generator to an async generator.
Source code in toolboxv2/utils/system/types.py
2101 2102 2103 2104 2105 2106 2107 |
|
Session
dataclass
¶
Class representing a session.
Source code in toolboxv2/utils/system/types.py
261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 |
|
from_dict(data)
classmethod
¶Create a Session instance from a dictionary with default values.
Source code in toolboxv2/utils/system/types.py
271 272 273 274 275 276 277 278 279 280 281 282 |
|
to_dict()
¶Convert the Session object back to a dictionary.
Source code in toolboxv2/utils/system/types.py
284 285 286 287 288 289 290 291 292 293 294 295 296 |
|
parse_request_data(data)
¶
Parse the incoming request data into a strongly typed structure.
Source code in toolboxv2/utils/system/types.py
383 384 385 |
|
toolbox
¶
Main module.
App
¶
Source code in toolboxv2/utils/toolbox.py
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 |
|
disconnect(*args, **kwargs)
staticmethod
¶
proxi attr
Source code in toolboxv2/utils/toolbox.py
223 224 225 |
|
exit_main(*args, **kwargs)
staticmethod
¶
proxi attr
Source code in toolboxv2/utils/toolbox.py
211 212 213 |
|
get_function(name, **kwargs)
¶
Kwargs for _get_function metadata:: return the registered function dictionary stateless: (function_data, None), 0 stateful: (function_data, higher_order_function), 0 state::boolean specification::str default app
Source code in toolboxv2/utils/toolbox.py
1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 |
|
hide_console(*args, **kwargs)
staticmethod
¶
proxi attr
Source code in toolboxv2/utils/toolbox.py
215 216 217 |
|
run(*args, request=None, running_function_coro=None, **kwargs)
¶
Run a function with support for SSE streaming in both threaded and non-threaded contexts.
Source code in toolboxv2/utils/toolbox.py
744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 |
|
run_bg_task(task)
¶
Run a task in the background that will properly handle nested asyncio operations. This implementation ensures that asyncio.create_task() and asyncio.gather() work correctly within the background task.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
task
|
A callable function that can be synchronous or asynchronous |
required |
Source code in toolboxv2/utils/toolbox.py
600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 |
|
run_bg_task_advanced(task, *args, **kwargs)
¶
Alternative implementation for complex async scenarios where the task creates nested asyncio tasks using create_task() and gather().
This version ensures proper execution of nested tasks by maintaining the thread and its event loop throughout the lifetime of all child tasks.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
task
|
A callable function that can be synchronous or asynchronous |
required | |
*args,
|
**kwargs
|
Arguments to pass to the task |
required |
Source code in toolboxv2/utils/toolbox.py
660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 |
|
show_console(*args, **kwargs)
staticmethod
¶
proxi attr
Source code in toolboxv2/utils/toolbox.py
219 220 221 |
|
tb(name=None, mod_name='', helper='', version=None, test=True, restrict_in_virtual_mode=False, api=False, initial=False, exit_f=False, test_only=False, memory_cache=False, file_cache=False, request_as_kwarg=False, row=False, state=None, level=-1, memory_cache_max_size=100, memory_cache_ttl=300, samples=None, interface=None, pre_compute=None, post_compute=None, api_methods=None)
¶
A decorator for registering and configuring functions within a module.
This decorator is used to wrap functions with additional functionality such as caching, API conversion, and lifecycle management (initialization and exit). It also handles the registration of the function in the module's function registry.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str
|
The name to register the function under. Defaults to the function's own name. |
None
|
mod_name
|
str
|
The name of the module the function belongs to. |
''
|
helper
|
str
|
A helper string providing additional information about the function. |
''
|
version
|
str or None
|
The version of the function or module. |
None
|
test
|
bool
|
Flag to indicate if the function is for testing purposes. |
True
|
restrict_in_virtual_mode
|
bool
|
Flag to restrict the function in virtual mode. |
False
|
api
|
bool
|
Flag to indicate if the function is part of an API. |
False
|
initial
|
bool
|
Flag to indicate if the function should be executed at initialization. |
False
|
exit_f
|
bool
|
Flag to indicate if the function should be executed at exit. |
False
|
test_only
|
bool
|
Flag to indicate if the function should only be used for testing. |
False
|
memory_cache
|
bool
|
Flag to enable memory caching for the function. |
False
|
request_as_kwarg
|
bool
|
Flag to get request if the fuction is calld from api. |
False
|
file_cache
|
bool
|
Flag to enable file caching for the function. |
False
|
row
|
bool
|
rather to auto wrap the result in Result type default False means no row data aka result type |
False
|
state
|
bool or None
|
Flag to indicate if the function maintains state. |
None
|
level
|
int
|
The level of the function, used for prioritization or categorization. |
-1
|
memory_cache_max_size
|
int
|
Maximum size of the memory cache. |
100
|
memory_cache_ttl
|
int
|
Time-to-live for the memory cache entries. |
300
|
samples
|
list or dict or None
|
Samples or examples of function usage. |
None
|
interface
|
str
|
The interface type for the function. |
None
|
pre_compute
|
callable
|
A function to be called before the main function. |
None
|
post_compute
|
callable
|
A function to be called after the main function. |
None
|
api_methods
|
list[str]
|
default ["AUTO"] (GET if not params, POST if params) , GET, POST, PUT or DELETE. |
None
|
Returns:
Name | Type | Description |
---|---|---|
function |
The decorated function with additional processing and registration capabilities. |
Source code in toolboxv2/utils/toolbox.py
1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 |
|
wait_for_bg_tasks(timeout=None)
¶
Wait for all background tasks to complete.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
timeout
|
Maximum time to wait (in seconds) for all tasks to complete. None means wait indefinitely. |
None
|
Returns:
Name | Type | Description |
---|---|---|
bool |
True if all tasks completed, False if timeout occurred |
Source code in toolboxv2/utils/toolbox.py
721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 |
|
toolboxv2.show_console(show=True)
¶
Source code in toolboxv2/utils/extras/show_and_hide_console.py
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
|
Logging¶
toolboxv2.get_logger()
¶
Source code in toolboxv2/utils/system/tb_logger.py
136 137 |
|
toolboxv2.setup_logging(level, name=loggerNameOfToolboxv2, online_level=None, is_online=False, file_level=None, interminal=False, logs_directory='../logs', app_name='main')
¶
Source code in toolboxv2/utils/system/tb_logger.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 |
|
Styling & Console Output¶
toolboxv2.Style
¶
Source code in toolboxv2/utils/extras/Style.py
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 |
|
toolboxv2.Spinner
¶
Enhanced Spinner with tqdm-like line rendering.
Source code in toolboxv2/utils/extras/Style.py
525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 |
|
__enter__()
¶
Start the spinner.
Source code in toolboxv2/utils/extras/Style.py
591 592 593 594 595 596 |
|
__exit__(exc_type, exc_value, exc_traceback)
¶
Stop the spinner.
Source code in toolboxv2/utils/extras/Style.py
598 599 600 601 602 603 604 605 |
|
__init__(message='Loading...', delay=0.1, symbols=None, count_down=False, time_in_s=0)
¶
Initialize spinner with flexible configuration.
Source code in toolboxv2/utils/extras/Style.py
539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 |
|
toolboxv2.remove_styles(text, infos=False)
¶
Source code in toolboxv2/utils/extras/Style.py
331 332 333 334 335 336 337 338 339 340 341 342 |
|
Data Types & Structures¶
toolboxv2.AppArgs
¶
Source code in toolboxv2/utils/system/types.py
493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 |
|
toolboxv2.Result
¶
Source code in toolboxv2/utils/system/types.py
621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 |
|
binary(data, content_type='application/octet-stream', download_name=None, info='OK', interface=ToolBoxInterfaces.remote)
classmethod
¶
Create a binary data response Result.
Source code in toolboxv2/utils/system/types.py
879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 |
|
file(data, filename, content_type=None, info='OK', interface=ToolBoxInterfaces.remote)
classmethod
¶
Create a file download response Result.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data
|
File data as bytes or base64 string |
required | |
filename
|
Name of the file for download |
required | |
content_type
|
MIME type of the file (auto-detected if None) |
None
|
|
info
|
Response info text |
'OK'
|
|
interface
|
Target interface |
remote
|
Returns:
Type | Description |
---|---|
Result object configured for file download |
Source code in toolboxv2/utils/system/types.py
902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 |
|
json(data, info='OK', interface=ToolBoxInterfaces.remote, exec_code=0, status_code=None)
classmethod
¶
Create a JSON response Result.
Source code in toolboxv2/utils/system/types.py
847 848 849 850 851 852 853 854 855 856 857 858 859 860 |
|
redirect(url, status_code=302, info='Redirect', interface=ToolBoxInterfaces.remote)
classmethod
¶
Create a redirect response.
Source code in toolboxv2/utils/system/types.py
946 947 948 949 950 951 952 953 954 955 956 957 958 959 |
|
sse(stream_generator, info='OK', interface=ToolBoxInterfaces.remote, cleanup_func=None)
classmethod
¶
Create an Server-Sent Events (SSE) streaming response Result.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
stream_generator
|
Any
|
A source yielding individual data items. This can be an async generator, sync generator, iterable, or a single item. Each item will be formatted as an SSE event. |
required |
info
|
str
|
Optional help text for the Result. |
'OK'
|
interface
|
ToolBoxInterfaces
|
Optional ToolBoxInterface to target. |
remote
|
cleanup_func
|
Union[Callable[[], None], Callable[[], T], Callable[[], AsyncGenerator[T, None]], None]
|
Optional cleanup function to run when the stream ends or is cancelled. |
None
|
#http_headers
|
Optional dictionary of custom HTTP headers for the SSE response. |
required |
Returns:
Type | Description |
---|---|
A Result object configured for SSE streaming. |
Source code in toolboxv2/utils/system/types.py
805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 |
|
stream(stream_generator, content_type='text/event-stream', headers=None, info='OK', interface=ToolBoxInterfaces.remote, cleanup_func=None)
classmethod
¶
Create a streaming response Result. Handles SSE and other stream types.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
stream_generator
|
Any
|
Any stream source (async generator, sync generator, iterable, or single item). |
required |
content_type
|
str
|
Content-Type header (default: text/event-stream for SSE). |
'text/event-stream'
|
headers
|
Union[dict, None]
|
Additional HTTP headers for the response. |
None
|
info
|
str
|
Help text for the result. |
'OK'
|
interface
|
ToolBoxInterfaces
|
Interface to send data to. |
remote
|
cleanup_func
|
Union[Callable[[], None], Callable[[], T], Callable[[], AsyncGenerator[T, None]], None]
|
Optional function for cleanup. |
None
|
Returns:
Type | Description |
---|---|
A Result object configured for streaming. |
Source code in toolboxv2/utils/system/types.py
726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 |
|
text(text_data, content_type='text/plain', exec_code=None, status=200, info='OK', interface=ToolBoxInterfaces.remote, headers=None)
classmethod
¶
Create a text response Result with specific content type.
Source code in toolboxv2/utils/system/types.py
862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 |
|
toolboxv2.ApiResult
¶
Bases: BaseModel
Source code in toolboxv2/utils/system/types.py
589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 |
|
toolboxv2.RequestData
dataclass
¶
Main class representing the complete request data structure.
Source code in toolboxv2/utils/system/types.py
303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 |
|
__getattr__(name)
¶
Delegate unknown attributes to the request
object.
Source code in toolboxv2/utils/system/types.py
327 328 329 330 331 332 333 |
|
from_dict(data)
classmethod
¶
Create a RequestData instance from a dictionary.
Source code in toolboxv2/utils/system/types.py
310 311 312 313 314 315 316 317 |
|
to_dict()
¶
Convert the RequestData object back to a dictionary.
Source code in toolboxv2/utils/system/types.py
319 320 321 322 323 324 325 |
|
Security¶
toolboxv2.Code
¶
Source code in toolboxv2/utils/security/cryp.py
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 |
|
decrypt_asymmetric(encrypted_text_hex, private_key_str)
staticmethod
¶
Entschlüsselt einen Text mit einem gegebenen privaten Schlüssel.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
encrypted_text_hex
|
str
|
Der verschlüsselte Text als Hex-String. |
required |
private_key_str
|
str
|
Der private Schlüssel als String. |
required |
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
Der entschlüsselte Text. |
Source code in toolboxv2/utils/security/cryp.py
287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 |
|
decrypt_symmetric(encrypted_text, key, to_str=True, mute=False)
staticmethod
¶
Entschlüsselt einen Text mit einem gegebenen symmetrischen Schlüssel.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
encrypted_text
|
str
|
Der zu entschlüsselnde Text. |
required |
key
|
str
|
Der symmetrische Schlüssel. |
required |
to_str
|
bool
|
default true returns str if false returns bytes |
True
|
Returns: str: Der entschlüsselte Text.
Source code in toolboxv2/utils/security/cryp.py
126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 |
|
encrypt_asymmetric(text, public_key_str)
staticmethod
¶
Verschlüsselt einen Text mit einem gegebenen öffentlichen Schlüssel.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
text
|
str
|
Der zu verschlüsselnde Text. |
required |
public_key_str
|
str
|
Der öffentliche Schlüssel als String oder im pem format. |
required |
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
Der verschlüsselte Text. |
Source code in toolboxv2/utils/security/cryp.py
256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 |
|
encrypt_symmetric(text, key)
staticmethod
¶
Verschlüsselt einen Text mit einem gegebenen symmetrischen Schlüssel.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
text
|
str
|
Der zu verschlüsselnde Text. |
required |
key
|
str
|
Der symmetrische Schlüssel. |
required |
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
Der verschlüsselte Text. |
Source code in toolboxv2/utils/security/cryp.py
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 |
|
generate_asymmetric_keys()
staticmethod
¶
Generiert ein Paar von öffentlichen und privaten Schlüsseln für die asymmetrische Verschlüsselung.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
seed
|
int
|
Ein optionaler Seed-Wert. Standardmäßig None. |
required |
Returns:
Type | Description |
---|---|
(str, str)
|
Ein Tupel aus öffentlichem und privatem Schlüssel. |
Source code in toolboxv2/utils/security/cryp.py
156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 |
|
generate_seed()
staticmethod
¶
Erzeugt eine zufällige Zahl als Seed.
Returns:
Name | Type | Description |
---|---|---|
int |
int
|
Eine zufällige Zahl. |
Source code in toolboxv2/utils/security/cryp.py
68 69 70 71 72 73 74 75 76 |
|
generate_symmetric_key()
staticmethod
¶
Generiert einen Schlüssel für die symmetrische Verschlüsselung.
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
Der generierte Schlüssel. |
Source code in toolboxv2/utils/security/cryp.py
94 95 96 97 98 99 100 101 102 |
|
load_keys_from_files(directory='keys')
staticmethod
¶
Lädt die Schlüssel aus den Dateien. Der private Schlüssel wird mit dem Device Key entschlüsselt.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
directory
|
str
|
Das Verzeichnis, aus dem die Schlüssel geladen werden sollen |
'keys'
|
Returns:
Type | Description |
---|---|
(str, str)
|
Ein Tupel aus öffentlichem und privatem Schlüssel |
Raises:
Type | Description |
---|---|
FileNotFoundError
|
Wenn die Schlüsseldateien nicht gefunden werden können |
Source code in toolboxv2/utils/security/cryp.py
219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 |
|
one_way_hash(text, salt='', pepper='')
staticmethod
¶
Erzeugt einen Hash eines gegebenen Textes mit Salt, Pepper und optional einem Seed.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
text
|
str
|
Der zu hashende Text. |
required |
salt
|
str
|
Der Salt-Wert. |
''
|
pepper
|
str
|
Der Pepper-Wert. |
''
|
seed
|
int
|
Ein optionaler Seed-Wert. Standardmäßig None. |
required |
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
Der resultierende Hash-Wert. |
Source code in toolboxv2/utils/security/cryp.py
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
|
pem_to_public_key(pem_key)
staticmethod
¶
Konvertiert einen PEM-kodierten öffentlichen Schlüssel in ein PublicKey-Objekt.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
pem_key
|
str
|
Der PEM-kodierte öffentliche Schlüssel. |
required |
Returns:
Name | Type | Description |
---|---|---|
PublicKey |
Das PublicKey-Objekt. |
Source code in toolboxv2/utils/security/cryp.py
386 387 388 389 390 391 392 393 394 395 396 397 398 |
|
public_key_to_pem(public_key)
staticmethod
¶
Konvertiert ein PublicKey-Objekt in einen PEM-kodierten String.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
public_key
|
PublicKey
|
Das PublicKey-Objekt. |
required |
Returns:
Name | Type | Description |
---|---|---|
str |
Der PEM-kodierte öffentliche Schlüssel. |
Source code in toolboxv2/utils/security/cryp.py
400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 |
|
save_keys_to_files(public_key, private_key, directory='keys')
staticmethod
¶
Speichert die generierten Schlüssel in separate Dateien. Der private Schlüssel wird mit dem Device Key verschlüsselt.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
public_key
|
str
|
Der öffentliche Schlüssel im PEM-Format |
required |
private_key
|
str
|
Der private Schlüssel im PEM-Format |
required |
directory
|
str
|
Das Verzeichnis, in dem die Schlüssel gespeichert werden sollen |
'keys'
|
Source code in toolboxv2/utils/security/cryp.py
187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 |
|
Modules & Flows¶
toolboxv2.mods
¶
Canvas
¶
Tools
¶
Bases: MainTool
, EventManagerClass if EVENT_MANAGER_AVAILABLE else object
Source code in toolboxv2/mods/Canvas.py
116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 |
|
CloudM
¶
check_multiple_processes(pids)
¶
Checks the status of multiple processes in a single system call. Returns a dictionary mapping PIDs to their status (GREEN_CIRCLE, RED_CIRCLE, or YELLOW_CIRCLE).
Source code in toolboxv2/mods/CloudM/mini.py
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 |
|
get_service_pids(info_dir)
¶
Extracts service names and PIDs from pid files.
Source code in toolboxv2/mods/CloudM/mini.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
|
get_service_status(dir)
¶
Displays the status of all services.
Source code in toolboxv2/mods/CloudM/mini.py
124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 |
|
ModManager
¶
create_and_pack_module(path, module_name='', version='-.-.-', additional_dirs=None, yaml_data=None)
¶
Erstellt ein Python-Modul und packt es in eine ZIP-Datei.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path
|
str
|
Pfad zum Ordner oder zur Datei, die in das Modul aufgenommen werden soll. |
required |
additional_dirs
|
dict
|
Zusätzliche Verzeichnisse, die hinzugefügt werden sollen. |
None
|
version
|
str
|
Version des Moduls. |
'-.-.-'
|
module_name
|
str
|
Name des Moduls. |
''
|
Returns:
Name | Type | Description |
---|---|---|
str |
Pfad zur erstellten ZIP-Datei. |
Source code in toolboxv2/mods/CloudM/ModManager.py
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 |
|
download_files(urls, directory, desc, print_func, filename=None)
¶
Hilfsfunktion zum Herunterladen von Dateien.
Source code in toolboxv2/mods/CloudM/ModManager.py
72 73 74 75 76 77 78 79 80 81 |
|
handle_requirements(requirements_url, module_name, print_func)
¶
Verarbeitet und installiert Requirements.
Source code in toolboxv2/mods/CloudM/ModManager.py
84 85 86 87 88 89 90 91 92 93 94 95 |
|
increment_version(version_str, max_value=99)
¶
Inkrementiert eine Versionsnummer im Format "vX.Y.Z".
Parameters:
Name | Type | Description | Default |
---|---|---|---|
version_str
|
str
|
Die aktuelle Versionsnummer, z. B. "v0.0.1". |
required |
max_value
|
int
|
Die maximale Zahl pro Stelle (default: 99). |
99
|
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
Die inkrementierte Versionsnummer. |
Source code in toolboxv2/mods/CloudM/ModManager.py
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
|
installer(app, module_name, build_state=True)
async
¶
Installiert oder aktualisiert ein Modul basierend auf der Remote-Version.
Source code in toolboxv2/mods/CloudM/ModManager.py
356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 |
|
run_command(command, cwd=None)
¶
Führt einen Befehl aus und gibt den Output zurück.
Source code in toolboxv2/mods/CloudM/ModManager.py
488 489 490 491 492 |
|
uninstall_module(path, module_name='', version='-.-.-', additional_dirs=None, yaml_data=None)
¶
Deinstalliert ein Python-Modul, indem es das Modulverzeichnis oder die ZIP-Datei entfernt.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path
|
str
|
Pfad zum Ordner oder zur Datei, die in das Modul aufgenommen werden soll. |
required |
additional_dirs
|
dict
|
Zusätzliche Verzeichnisse, die hinzugefügt werden sollen. |
None
|
version
|
str
|
Version des Moduls. |
'-.-.-'
|
module_name
|
str
|
Name des Moduls. |
''
|
Source code in toolboxv2/mods/CloudM/ModManager.py
186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 |
|
unpack_and_move_module(zip_path, base_path='./mods', module_name='')
¶
Entpackt eine ZIP-Datei und verschiebt die Inhalte an die richtige Stelle. Überschreibt existierende Dateien für Update-Unterstützung.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
zip_path
|
str
|
Pfad zur ZIP-Datei, die entpackt werden soll |
required |
base_path
|
str
|
Basispfad, unter dem das Modul gespeichert werden soll |
'./mods'
|
module_name
|
str
|
Name des Moduls (optional, wird sonst aus ZIP-Namen extrahiert) |
''
|
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
Name des installierten Moduls |
Source code in toolboxv2/mods/CloudM/ModManager.py
228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 |
|
UserAccountManager
¶
get_current_user_from_request_api_wrapper(app, request)
async
¶
API callable version of get_current_user_from_request for tbjs/admin panel
Source code in toolboxv2/mods/CloudM/UserAccountManager.py
148 149 150 151 152 153 154 155 156 157 158 159 |
|
email_services
¶
send_email_verification_email(app, user_email, username, verification_url)
¶
Sends an email verification link to the user.
Source code in toolboxv2/mods/CloudM/email_services.py
235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 |
|
send_magic_link_email(app, user_email, magic_link_url, username=None)
¶
Sends a magic link email for login.
Source code in toolboxv2/mods/CloudM/email_services.py
214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 |
|
send_signup_invitation_email(app, invited_user_email, invited_username, inviter_username=None)
¶
Generates an invitation link and sends it via email.
Source code in toolboxv2/mods/CloudM/email_services.py
271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 |
|
send_waiting_list_confirmation_email(app, user_email)
¶
Sends a confirmation email for joining the waiting list.
Source code in toolboxv2/mods/CloudM/email_services.py
253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 |
|
send_welcome_email(app, user_email, username, welcome_action_url=None)
¶
Sends a welcome email to a new user.
Source code in toolboxv2/mods/CloudM/email_services.py
189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 |
|
mini
¶
check_multiple_processes(pids)
¶
Checks the status of multiple processes in a single system call. Returns a dictionary mapping PIDs to their status (GREEN_CIRCLE, RED_CIRCLE, or YELLOW_CIRCLE).
Source code in toolboxv2/mods/CloudM/mini.py
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 |
|
get_service_pids(info_dir)
¶
Extracts service names and PIDs from pid files.
Source code in toolboxv2/mods/CloudM/mini.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
|
get_service_status(dir)
¶
Displays the status of all services.
Source code in toolboxv2/mods/CloudM/mini.py
124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 |
|
module
¶
hash_password(password)
¶
Hash a password for storing.
Source code in toolboxv2/mods/CloudM/module.py
111 112 113 114 115 116 117 |
|
verify_password(stored_password, provided_password)
¶
Verify a stored password against one provided by user
Source code in toolboxv2/mods/CloudM/module.py
121 122 123 124 125 126 127 128 |
|
CodeVerification
¶
VerificationSystem
¶
Source code in toolboxv2/mods/CodeVerification.py
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 |
|
__init__(tools_db, scope='main')
¶
Initialize VerificationSystem with DB Tools integration
Parameters:
Name | Type | Description | Default |
---|---|---|---|
tools_db
|
Tools
|
Database tools from toolboxv2.mods.DB |
required |
scope
|
str
|
Scope for templates and codes. Defaults to "main". |
'main'
|
Source code in toolboxv2/mods/CodeVerification.py
27 28 29 30 31 32 33 34 35 36 37 38 |
|
add_config_template(template)
¶
Add a new configuration template to the database
Parameters:
Name | Type | Description | Default |
---|---|---|---|
template
|
ConfigTemplate
|
The configuration template |
required |
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
Unique identifier of the template |
Source code in toolboxv2/mods/CodeVerification.py
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
|
generate_code(template_id)
¶
Generate a code based on the configuration template
Parameters:
Name | Type | Description | Default |
---|---|---|---|
template_id
|
str
|
ID of the configuration template |
required |
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
Generated verification code |
Source code in toolboxv2/mods/CodeVerification.py
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 |
|
reset_scope_templates()
¶
Ensure a templates dictionary exists for the current scope in the database
Source code in toolboxv2/mods/CodeVerification.py
43 44 45 46 47 48 49 |
|
validate_code(code)
¶
Validate a code and return template information
Parameters:
Name | Type | Description | Default |
---|---|---|---|
code
|
str
|
Code to validate |
required |
Returns:
Type | Description |
---|---|
dict[str, Any] | None
|
Optional[Dict[str, Any]]: Template information for valid code, else None |
Source code in toolboxv2/mods/CodeVerification.py
172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 |
|
DB
¶
local_instance
¶
load_from_json(filename)
¶
Lädt Daten aus einer JSON-Datei.
:param filename: Der Dateiname oder Pfad der zu ladenden Datei. :return: Die geladenen Daten.
Source code in toolboxv2/mods/DB/local_instance.py
137 138 139 140 141 142 143 144 145 146 147 148 |
|
save_to_json(data, filename)
¶
Speichert die übergebenen Daten in einer JSON-Datei.
:param data: Die zu speichernden Daten. :param filename: Der Dateiname oder Pfad, in dem die Daten gespeichert werden sollen.
Source code in toolboxv2/mods/DB/local_instance.py
123 124 125 126 127 128 129 130 131 132 133 134 |
|
reddis_instance
¶
sync_redis_databases(source_url, target_url)
¶
Synchronize keys from the source Redis database to the target Redis database. This function scans all keys in the source DB and uses DUMP/RESTORE to replicate data to the target.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
source_url
|
str
|
The Redis URL of the source database. |
required |
target_url
|
str
|
The Redis URL of the target database. |
required |
Returns:
Name | Type | Description |
---|---|---|
int |
The number of keys successfully synchronized. |
Source code in toolboxv2/mods/DB/reddis_instance.py
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
|
tb_adapter
¶
DB
¶
Bases: ABC
Source code in toolboxv2/mods/DB/tb_adapter.py
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
|
append_on_set(query, value)
abstractmethod
¶
append set data
Source code in toolboxv2/mods/DB/tb_adapter.py
63 64 65 |
|
delete(query, matching=False)
abstractmethod
¶
delete data
Source code in toolboxv2/mods/DB/tb_adapter.py
67 68 69 |
|
exit()
abstractmethod
¶
Close DB connection and optional save data
Source code in toolboxv2/mods/DB/tb_adapter.py
75 76 77 |
|
get(query)
abstractmethod
¶
get data
Source code in toolboxv2/mods/DB/tb_adapter.py
55 56 57 |
|
if_exist(query)
abstractmethod
¶
return True if query exists
Source code in toolboxv2/mods/DB/tb_adapter.py
71 72 73 |
|
set(query, value)
abstractmethod
¶
set data
Source code in toolboxv2/mods/DB/tb_adapter.py
59 60 61 |
|
EventManager
¶
module
¶
EventManagerClass
¶
Source code in toolboxv2/mods/EventManager/module.py
197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 |
|
trigger_event(event_id)
async
¶
Exec source based on
source_types F -> call directly R -> use get_app(str(event_id)).run_any(args, *kwargs) S -> evaluate string scope instance -> _trigger_local local -> if you ar proxy app run the event through get_app(str(event_id)).run_any(TBEF.EventManager._trigger_local, args=args, kwargs=kwargs, get_result=True) local_network -> use proxy0 app to communicate withe Daemon0 then local global_network -> exec_in event_id threaded
Source code in toolboxv2/mods/EventManager/module.py
621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 |
|
Rout
dataclass
¶
Source code in toolboxv2/mods/EventManager/module.py
140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 |
|
close()
¶
Close
Source code in toolboxv2/mods/EventManager/module.py
165 166 |
|
FastApi
¶
fast_api_install
¶
FileBrowser
¶
Source code in toolboxv2/mods/FastApi/fast_api_install.py
390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 |
|
download_file(file_path)
async
¶
Handle file download.
Source code in toolboxv2/mods/FastApi/fast_api_install.py
405 406 407 408 409 410 411 412 |
|
is_path_allowed(file_path)
¶
Check if the path is within allowed directories.
Source code in toolboxv2/mods/FastApi/fast_api_install.py
397 398 399 400 401 402 403 |
|
refresh_view(path)
¶
Refresh the file browser view.
Source code in toolboxv2/mods/FastApi/fast_api_install.py
414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 |
|
fast_lit
¶
APIRequestHelper
¶
Source code in toolboxv2/mods/FastApi/fast_lit.py
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 |
|
make_api_request(endpoint, method, data=None, headers=None, session_token=None)
async
¶
Make API requests while maintaining session context
Source code in toolboxv2/mods/FastApi/fast_lit.py
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 |
|
BidirectionalStreamlitAppManager
¶
Bases: BaseHTTPMiddleware
Source code in toolboxv2/mods/FastApi/fast_lit.py
122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 |
|
resolve_session_token(request)
async
¶
Extract and validate session token from request
Source code in toolboxv2/mods/FastApi/fast_lit.py
160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 |
|
inject_custom_css(css_file_path='./web/assets/styles.css')
¶
Liest eine CSS-Datei ein und injiziert sie in die Streamlit-App.
Source code in toolboxv2/mods/FastApi/fast_lit.py
269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 |
|
make_api_request(endpoint, method='GET', data=None)
async
¶
Helper function for making API requests from Streamlit apps
Source code in toolboxv2/mods/FastApi/fast_lit.py
212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 |
|
fast_nice
¶
NiceGUIManager
¶
Source code in toolboxv2/mods/FastApi/fast_nice.py
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 |
|
broadcast_to_gui(gui_id, message)
async
¶
Broadcast a message to all sessions connected to a specific GUI
Source code in toolboxv2/mods/FastApi/fast_nice.py
362 363 364 365 366 |
|
handle_ws_message(session_id, gui_id, message)
async
¶
Handle incoming WebSocket messages
Source code in toolboxv2/mods/FastApi/fast_nice.py
352 353 354 355 356 357 358 359 360 |
|
init_app()
¶
Initialize the FastAPI application with NiceGUI integration
Source code in toolboxv2/mods/FastApi/fast_nice.py
398 399 400 401 402 403 404 405 406 407 |
|
middleware_dispatch(request, call_next)
async
¶
Custom middleware for session handling and authentication
Source code in toolboxv2/mods/FastApi/fast_nice.py
368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 |
|
register_gui(gui_id, setup_func, mount_path=None, additional=None, title=None, description=None, **kwargs)
¶
Register a new NiceGUI application
Source code in toolboxv2/mods/FastApi/fast_nice.py
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 |
|
remove_gui(gui_id)
¶
Remove a registered GUI application
Source code in toolboxv2/mods/FastApi/fast_nice.py
320 321 322 323 324 325 326 327 328 329 330 331 332 |
|
websocket_endpoint(websocket, session_id, gui_id)
async
¶
Handle WebSocket connections for real-time updates
Source code in toolboxv2/mods/FastApi/fast_nice.py
334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 |
|
create_nicegui_manager(app, token_secret=None)
¶
Create and initialize a NiceGUI manager instance
Source code in toolboxv2/mods/FastApi/fast_nice.py
414 415 416 417 418 419 |
|
manager
¶
Tools
¶
Bases: MainTool
, FileHandler
A production-ready API Manager for running, monitoring, and managing FastAPI instances.
This class allows you to
- Start API instances (live, development, debug)
- Stop and restart running APIs
- Update configuration for APIs
- Get live diagnostic info about running APIs
Source code in toolboxv2/mods/FastApi/manager.py
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 |
|
conf_api(api_name, host='localhost', port=5000)
¶
Update or create an API configuration.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
api_name
|
str
|
The name of the API. |
required |
host
|
str
|
The host address (default "localhost"). Use "lh" for "127.0.0.1" or "0" for "0.0.0.0". |
'localhost'
|
port
|
int
|
The port number (default 5000; use "0" for port 8000). |
5000
|
Source code in toolboxv2/mods/FastApi/manager.py
116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 |
|
info()
¶
Return diagnostic information about API configurations and currently running APIs.
Source code in toolboxv2/mods/FastApi/manager.py
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 |
|
on_exit()
async
¶
Gracefully stop all running APIs and save configuration upon exit.
Source code in toolboxv2/mods/FastApi/manager.py
444 445 446 447 448 449 450 451 452 453 454 455 456 |
|
on_start()
¶
Load API configuration from file when the tool starts.
Source code in toolboxv2/mods/FastApi/manager.py
428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 |
|
restart_api(api_name)
async
¶
Restart the given API by stopping it and starting it again.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
api_name
|
str
|
The name of the API to restart. |
required |
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
A status message. |
Source code in toolboxv2/mods/FastApi/manager.py
411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 |
|
show_running()
¶
Display and return the list of currently running APIs with their status.
Source code in toolboxv2/mods/FastApi/manager.py
378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 |
|
show_version()
¶
Display and return the current version.
Source code in toolboxv2/mods/FastApi/manager.py
95 96 97 98 |
|
start_debug(api_name)
¶
Start an API in debug mode.
Source code in toolboxv2/mods/FastApi/manager.py
168 169 170 171 172 |
|
start_dev(api_name, *modules, **kwargs)
¶
Start an API in development mode.
If additional modules are provided, they are stored in a BlobFile for later use.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
api_name
|
str
|
The API name. |
required |
*modules
|
str
|
Additional modules for the API. |
()
|
Returns:
Type | Description |
---|---|
str | None
|
Optional[str]: Status message. |
Source code in toolboxv2/mods/FastApi/manager.py
141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 |
|
start_live(api_name)
¶
Start an API in live mode.
Source code in toolboxv2/mods/FastApi/manager.py
162 163 164 165 166 |
|
stop_api(api_name, delete=True)
async
¶
Stop a running API and clean up resources.
Source code in toolboxv2/mods/FastApi/manager.py
300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 |
|
FileWidget
¶
FileUploadHandler
¶
Source code in toolboxv2/mods/FileWidget.py
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
|
save_file(chunk_info, storage)
¶
Speichert die Datei oder Chunk. Chunks werden lokal gespeichert, dann zu BlobStorage gemerged.
Source code in toolboxv2/mods/FileWidget.py
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
|
access_shared_file(self, request, share_id, filename=None, row=None)
async
¶
Accesses a shared file via its share_id. The URL for this would be like /api/FileWidget/shared/{share_id_value} The 'share_id: str' in signature implies ToolBoxV2 extracts it from path.
Source code in toolboxv2/mods/FileWidget.py
972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 |
|
get_main_ui(self)
async
¶
Serves the main HTML UI for the FileWidget.
Source code in toolboxv2/mods/FileWidget.py
599 600 601 602 603 |
|
handle_upload(self, request, form_data=None)
async
¶
Handles file uploads. Expects chunked data via form_data kwarg from Rust server. 'form_data' structure (from Rust's parsing of multipart) after client sends FormData with fields: 'file' (the blob), 'fileName', 'chunkIndex', 'totalChunks'.
Expected form_data
in this Python function:
{
"file": { // This 'file' key is the NAME of the form field that held the file blob
"filename": "original_file_name_for_this_chunk.txt", // from Content-Disposition of the 'file' field part
"content_type": "mime/type_of_chunk",
"content_base64": "BASE64_ENCODED_CHUNK_CONTENT"
},
"fileName": "overall_final_filename.txt", // From a separate form field named 'fileName'
"chunkIndex": "0", // From a separate form field named 'chunkIndex'
"totalChunks": "5" // From a separate form field named 'totalChunks'
}
Source code in toolboxv2/mods/FileWidget.py
606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 |
|
POA
¶
module
¶
ActionManagerEnhanced
¶
Source code in toolboxv2/mods/POA/module.py
234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 |
|
SchedulerManager
¶
SchedulerManagerClass
¶
Source code in toolboxv2/mods/SchedulerManager.py
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 |
|
job_wrapper(job_name, job_function)
¶
Wrap a job function to track success and errors.
Source code in toolboxv2/mods/SchedulerManager.py
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
|
register_job(job_id, second=-1, func=None, job=None, time_passer=None, object_name=None, receive_job=False, save=False, max_live=False, serializer=serializer_default, args=None, kwargs=None)
¶
Parameters¶
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
|
Returns¶
Source code in toolboxv2/mods/SchedulerManager.py
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 |
|
Tools
¶
Bases: MainTool
, SchedulerManagerClass
Source code in toolboxv2/mods/SchedulerManager.py
317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 |
|
register_instance(job_data)
¶
example dicts
{ "job_id": "job0", "second": 0, "func": None, "job": None, "time_passer": None, "object_name": "tb_job_fuction", "receive_job": False, "save": False, "max_live": True, # just lev it out "serializer": serializer_default, "args": [], "kwargs": {}, }
job_id : str id for the job for management second (optional): int The time interval in seconds between each call of the job. func (optional): Callable or str The function to be executed as the job. job (optional): schedule.Job An existing job object from the schedule library. time_passer (optional): schedule.Job A job without a function, used to specify the time interval. object_name (optional): str The name of the object containing in the 'func' var to be executed. receive_job (optional): bool A flag indicating whether the job should be received from an object from 'func' var. save (optional): bool A flag indicating whether the job should be saved. max_live (optional): bool A flag indicating whether the job should have a maximum live time. serializer (optional): bool json pickel or dill must have a dumps fuction args, *kwargs (optional): Additional arguments to be passed to the job function.
Parameters ---------- job_data : dict
example usage ---------- `python
1 |
|
Source code in toolboxv2/mods/SchedulerManager.py
382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 |
|
SocketManager
¶
The SocketManager Supports 2 types of connections 1. Client Server 2. Peer to Peer
TruthSeeker
¶
arXivCrawler
¶
ArXiv Crawler for TruthSeeker. Main module for processing research queries.
ArXivPDFProcessor
¶
Main processor for research queries. This is a wrapper around the new ResearchProcessor for backward compatibility.
Source code in toolboxv2/mods/TruthSeeker/arXivCrawler.py
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 |
|
__init__(query, tools, chunk_size=1000000, overlap=2000, max_workers=None, num_search_result_per_query=6, max_search=6, download_dir='pdfs', callback=None, num_workers=None)
¶
Initialize the ArXiv PDF processor.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
query
|
str
|
Research query |
required |
tools
|
Tools module |
required | |
chunk_size
|
int
|
Size of text chunks for processing |
1000000
|
overlap
|
int
|
Overlap between chunks |
2000
|
max_workers
|
Maximum number of worker threads |
None
|
|
num_search_result_per_query
|
Number of search results per query |
6
|
|
max_search
|
Maximum number of search queries |
6
|
|
download_dir
|
Directory to save downloaded files |
'pdfs'
|
|
callback
|
Callback function for status updates |
None
|
|
num_workers
|
Number of worker threads |
None
|
Source code in toolboxv2/mods/TruthSeeker/arXivCrawler.py
216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 |
|
estimate_processing_metrics(query_length, **config)
staticmethod
¶
Return estimated time (seconds) and price for processing.
Source code in toolboxv2/mods/TruthSeeker/arXivCrawler.py
422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 |
|
search_and_process_papers(queries)
async
¶
Search for and process papers based on queries.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
queries
|
list[str]
|
List of search queries |
required |
Returns:
Type | Description |
---|---|
list[Paper]
|
List of processed papers |
Source code in toolboxv2/mods/TruthSeeker/arXivCrawler.py
285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 |
|
send_status(step, progress=None, additional_info='')
¶
Send status update via callback.
Source code in toolboxv2/mods/TruthSeeker/arXivCrawler.py
322 323 324 325 326 327 328 329 330 |
|
main(query='Beste strategien in bretspielen sitler von katar')
async
¶
Main execution function
Source code in toolboxv2/mods/TruthSeeker/arXivCrawler.py
451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 |
|
nGui
¶
import colorsys import json import time from datetime import datetime, timedelta from queue import Queue from typing import Dict, Union, List, Any
from fastapi import Request import os import random from threading import Thread, Event
import networkx as nx from dataclasses import asdict
from toolboxv2 import get_app from toolboxv2.mods.FastApi.fast_nice import register_nicegui
import asyncio
from nicegui import ui
from pathlib import Path import stripe
from toolboxv2.mods.TruthSeeker.arXivCrawler import Paper from toolboxv2.mods.isaa.base.AgentUtils import anything_from_str_to_dict
Set your secret key (use environment variables in production!)¶
stripe.api_key = os.getenv('STRIPE_SECRET_KEY', 'sk_test_YourSecretKey')
def create_landing_page(): # Set up dynamic background ui.query("body").style("background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%)")
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
|
def create_video_demo(): with ui.card().classes('w-full max-w-3xl mx-auto').style( 'background: var(--background-color); color: var(--text-color)'): # Video container with responsive aspect ratio with ui.element('div').classes('relative w-full aspect-video'): video = ui.video('../api/TruthSeeker/video').classes('w-full h-full object-cover')
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
|
def create_about_page(): """Create a comprehensive About page for TruthSeeker""" with ui.column().classes('w-full max-w-4xl mx-auto p-6'): # Page Header ui.label('About TruthSeeker').classes('text-4xl font-bold text-primary mb-6')
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
|
Dummy-Implementierung für get_tools()¶
def get_tools(): """ Hier solltest du dein richtiges Werkzeug-Objekt zurückliefern. In diesem Beispiel gehen wir davon aus, dass du über eine Funktion wie get_app verfügst. """ return get_app("ArXivPDFProcessor", name=None).get_mod("isaa")
def create_graph_tab(processor_instance: Dict, graph_ui: ui.element, main_ui: ui.element): """Create and update the graph visualization"""
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
|
is_init = [False]
--- Database Setup ---¶
def get_db(): db = get_app().get_mod("DB") if not is_init[0]: is_init[0] = True db.edit_cli("LD") db.initialize_database() return db
import pickle
--- Session State Management ---¶
def get_user_state(session_id: str, is_new=False) -> dict: db = get_db() state_ = { 'balance': .5, 'last_reset': datetime.utcnow().isoformat(), 'research_history': [], 'payment_id': '', } if session_id is None: state_['balance'] *= -1 if is_new: return state_, True return state_ state = db.get(f"TruthSeeker::session:{session_id}") if state.get() is None: state = state_ if is_new: return state_, True else: try: state = pickle.loads(state.get()) except Exception as e: print(e) state = { 'balance': 0.04, 'last_reset': datetime.utcnow().isoformat(), 'research_history': ["Sorry we had an error recreating your state"], 'payment_id': '', } if is_new: return state, True if is_new: return state, False return state
def save_user_state(session_id: str, state: dict): db = get_db() print("Saving state") db.set(f"TruthSeeker::session:{session_id}", pickle.dumps(state)).print()
def delete_user_state(session_id: str): db = get_db() print("Saving state") db.delete(f"TruthSeeker::session:{session_id}").print()
def reset_daily_balance(state: dict, valid=False) -> dict: now = datetime.utcnow() last_reset = datetime.fromisoformat(state.get('last_reset', now.isoformat())) if now - last_reset > timedelta(hours=24): state['balance'] = max(state.get('balance', 1.6 if valid else 0.5), 1.6 if valid else 0.5) state['last_reset'] = now.isoformat() return state
class MemoryResultsDisplay
def init(self, results: List[Dict[str, Any]], main_ui: ui.element): self.results = results self.main_ui = main_ui self.setup_ui()
def setup_ui(self): """Set up the main UI for displaying memory results""" with self.main_ui: self.main_ui.clear() with ui.column().classes('w-full'): for mem_result in self.results: self.create_memory_card(mem_result)
def create_memory_card(self, mem_result: Dict[str, Any]): """Create a card for each memory result""" result = mem_result.get("result", {}) with self.main_ui: if isinstance(result, dict): self.display_dict_result(result) elif hasattr(result, 'overview'): # Assuming RetrievalResult type self.display_retrieval_result(result) else: ui.label("Unsupported result type").classes('--text-color:error')
def display_dict_result(self, result: Dict[str, Any]): """Display dictionary-based result with collapsible sections""" # Summary Section summary = result.get("summary", {}) if isinstance(summary, str): try: summary = json.loads(summary[:-1]) except json.JSONDecodeError: summary = {"error": "Could not parse summary"}
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
|
{json.dumps(metadata, indent=2)} ```").style("max-width: 100%;")
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
|
{json.dumps(value, indent=2)}
").classes("break-words w-full").style("max-width: 100%;")
else:
ui.label(str(value)).classes('--text-color:secondary')
elif isinstance(data, list):
with ui.column().classes(f'ml-{indent * 2}').style("max-width: 100%;"):
for item in data:
if isinstance(item, str):
item = json.loads(item)
if isinstance(item, list):
self.display_nested_data(item, indent + 1, main_ui=main_ui)
if isinstance(item, dict):
ui.markdown(f"
json
{json.dumps(item, indent=2)}
```").classes("break-words w-full").style("max-width: 100%;")
else:
ui.label(str(item)).classes('--text-color:secondary')
def create_followup_section(processor_instance: Dict, main_ui: ui.element, session_id, balance): main_ui.clear() with main_ui: ui.label("Query Interface (1ct)").classes("text-xl font-semibold mb-4")
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
|
"
1 |
|
online_states = [0] def create_research_interface(Processor):
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 |
|
".join(summaries) if summaries else "No summary available." summary_content.set_content(f"# Research Summary
{summary_text}")
1 2 3 4 5 |
|
" f"- query: {inst.query} " f"- chunk_size: {inst.chunk_size} " f"- overlap: {inst.overlap} " f"- max_workers: {inst.max_workers} " f"- num_search_result_per_query: {inst.nsrpq} " f"- max_search: {inst.max_search} " f"- download_dir: {inst.download_dir} " f"- mem_name: {inst.mem_name} " f"- current_session: {inst.current_session} " f"- all_ref_papers: {inst.all_ref_papers} " f"- all_texts_len: {inst.all_texts_len} " f"- final_texts_len: {inst.f_texts_len} " f"- num_workers: {inst.num_workers}" ) analysis_content.set_content(analysis_md)
1 2 |
|
" # Add papers references_md += " ".join( f"- ({i}) {getattr(paper, 'title', 'Unknown Title')}})" for i, paper in enumerate(papers) )
1 2 |
|
Insights¶
" for i, insight in enumerate(insights): print(insight) result = insight.get('result', {}) summary = result.get('summary', {})
1 2 3 4 5 |
|
Insight¶
" references_md += f"### Main Summary {summary.get('main_summary', 'No summary available.')} "
1 2 3 4 |
|
Concept Analysis¶
" references_md += "#### Key Concepts - " + " - ".join( concept_analysis.get('key_concepts', [])) + " " references_md += "
Relationships¶
- " + "
- ".join( concept_analysis.get('relationships', [])) + " " references_md += "
Importance Hierarchy¶
- " + "
-
".join( concept_analysis.get('importance_hierarchy', [])) + " "
1 2 3 4
# Topic Insights topic_insights = summary.get('topic_insights', {}) if topic_insights: references_md += "
Topic Insights¶
" references_md += "#### Primary Topics - " + " - ".join( topic_insights.get('primary_topics', [])) + " " references_md += "
Cross References¶
- " + "
- ".join( topic_insights.get('cross_references', [])) + " " references_md += "
Knowledge Gaps¶
- " + "
-
".join( topic_insights.get('knowledge_gaps', [])) + " "
1 2 3 4
# Relevance Assessment relevance = summary.get('relevance_assessment', {}) if relevance: references_md += "
Relevance Assessment¶
" references_md += f"- Query Alignment: {relevance.get('query_alignment', 'N/A')} " references_md += f"- Confidence Score: {relevance.get('confidence_score', 'N/A')} " references_md += f"- Coverage Analysis: {relevance.get('coverage_analysis', 'N/A')} "
1 2 3 4 5 6 7 8 9 10 11 12 13
references_content.set_content(references_md) # nx concpts graph if processor_instance["instance"] is not None: create_graph_tab( processor_instance, graph_ui,main_ui ) # Show results and followup cards results_card.visible = True followup_card.visible = True graph_ui.visible = True
def load_history(index: int): entry = state['research_history'][index] if processor_instance is not None and processor_instance['instance'] is not None:
1 2 3 4 5 6 7 8 9 10 11 12 13 14
processor_instance["instance"].mem_name = entry["mam_name"] processor_instance['instance'].query = entry["query"] pass else: processor = Processor(entry["query"], tools=get_tools(), **config) # Setze den Callback so, dass Updates in der GUI angezeigt werden processor.callback = update_status processor.mem_name = entry["mam_name"] processor_instance["instance"] = processor processor_instance["instance"].tools.get_memory().load_memory(entry["mam_name"], entry["processor_memory"]) processor_instance["instance"].mem_name = entry["mam_name"] update_results(entry, save=False)
return helpr
--- Stripe Integration ---¶
def regiser_stripe_integration(is_scc=True): def stripe_callback(request: Request):
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
|
def handle_stripe_payment(amount: float, session_id): base_url = f'https://{os.getenv("HOSTNAME")}/gui/open-Seeker.stripe' if not 'localhost' in os.getenv("HOSTNAME") else 'http://localhost:5000/gui/open-Seeker.stripe' session = stripe.checkout.Session.create( payment_method_types=['card', "link", ], line_items=[{ 'price_data': { 'currency': 'eur', 'product_data': {'name': 'Research Credits'}, 'unit_amount': int(amount * 100), }, 'quantity': 1, }], automatic_tax={"enabled": True}, mode='payment', success_url=f'{base_url}?session_id={session_id}', cancel_url=f'{base_url}.error' ) state = get_user_state(session_id) state['payment_id'] = session.id save_user_state(session_id, state) ui.navigate.to(session.url, new_tab=True)
--- UI Components ---¶
def balance_overlay(session_id): with ui.dialog().classes('w-full max-w-md bg-white/20 backdrop-blur-lg rounded-xl') as dialog: with ui.card().classes('w-full p-6 space-y-4').style("background-color: var(--background-color)"): ui.label('Add Research Credits').classes('text-2xl font-bold') amount = ui.number('Amount (€) min 2', value=5, format='%.2f', min=2, max=9999, step=1).classes('w-full') with ui.row().classes('w-full justify-between'): ui.button('Cancel', on_click=dialog.close).props('flat') ui.button('Purchase', on_click=lambda: handle_stripe_payment(amount.value, session_id)) return dialog
def create_ui(processor): # ui_instance = register_nicegui("open-Seeker", create_landing_page , additional=""" """, show=False) register_nicegui("open-Seeker.demo", create_video_demo, additional=""" """, show=False)
newui
¶
cleanup_module(app)
¶
Cleanup resources when the module is unloaded
Source code in toolboxv2/mods/TruthSeeker/newui.py
1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 |
|
create_payment(app, data)
async
¶
Create a Stripe payment session
Source code in toolboxv2/mods/TruthSeeker/newui.py
1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 |
|
estimate_processing(data)
async
¶
Estimate processing time and cost for a given query
Source code in toolboxv2/mods/TruthSeeker/newui.py
1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 |
|
follow_up_query(app, data)
async
¶
Ask a follow-up question about the research
Source code in toolboxv2/mods/TruthSeeker/newui.py
1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 |
|
initialize_module(app)
¶
Initialize the module and register UI with CloudM
Source code in toolboxv2/mods/TruthSeeker/newui.py
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
|
payment_cancel(app, session_id, request_as_kwarg=True, request=None)
async
¶
Handle cancelled payment
Source code in toolboxv2/mods/TruthSeeker/newui.py
1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 |
|
payment_stream(app, session_id)
async
¶
SSE stream endpoint for payment status updates
Source code in toolboxv2/mods/TruthSeeker/newui.py
1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 |
|
payment_success(app, session_id, request_as_kwarg=True, request=None)
async
¶
Handle successful payment
Source code in toolboxv2/mods/TruthSeeker/newui.py
1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 |
|
research_results(app, research_id)
async
¶
Get the results of a completed research process
Source code in toolboxv2/mods/TruthSeeker/newui.py
1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 |
|
research_status(app, research_id)
async
¶
Get the status of a research process
Source code in toolboxv2/mods/TruthSeeker/newui.py
1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 |
|
start_research(app, data)
async
¶
Start a new research process
Source code in toolboxv2/mods/TruthSeeker/newui.py
1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 |
|
status_stream(app, research_id)
async
¶
SSE stream endpoint for research status updates
Source code in toolboxv2/mods/TruthSeeker/newui.py
1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 |
|
stop_research(app, data)
async
¶
Stop a research process
Source code in toolboxv2/mods/TruthSeeker/newui.py
1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 |
|
one
¶
IntelligenceRingEmbeddings
¶
Source code in toolboxv2/mods/TruthSeeker/one.py
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 |
|
compute_query_embeddings(query, modality='text')
¶
Compute embeddings for query input
Source code in toolboxv2/mods/TruthSeeker/one.py
180 181 182 183 184 185 |
|
compute_source_embeddings(sources, modalities)
¶
Compute embeddings for source inputs
Source code in toolboxv2/mods/TruthSeeker/one.py
187 188 189 190 191 192 193 194 195 |
|
tests
¶
TestTruthSeeker
¶
Bases: TestCase
Source code in toolboxv2/mods/TruthSeeker/tests.py
209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 |
|
test_byCode_functionality()
¶
Test the byCode function
Source code in toolboxv2/mods/TruthSeeker/tests.py
337 338 339 340 341 342 343 344 |
|
test_codes_invalid_promo()
async
¶
Test the codes function with invalid promo code
Source code in toolboxv2/mods/TruthSeeker/tests.py
266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 |
|
test_codes_valid_request()
async
¶
Test the codes function with valid input
Source code in toolboxv2/mods/TruthSeeker/tests.py
242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 |
|
test_process_invalid_key()
async
¶
Test the process function with invalid key
Source code in toolboxv2/mods/TruthSeeker/tests.py
317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 |
|
test_process_valid_request()
async
¶
Test the process function with valid input
Source code in toolboxv2/mods/TruthSeeker/tests.py
285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 |
|
test_start_initialization(mock_open, mock_join)
¶
Test the start function initializes correctly
Source code in toolboxv2/mods/TruthSeeker/tests.py
225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 |
|
run_all_tests()
¶
Run all test classes
Source code in toolboxv2/mods/TruthSeeker/tests.py
393 394 395 396 |
|
run_arxiv_processor_tests(test_name=None)
¶
Run TestArXivPDFProcessor tests
Source code in toolboxv2/mods/TruthSeeker/tests.py
380 381 382 |
|
run_pdf_downloader_tests(test_name=None)
¶
Run TestRobustPDFDownloader tests
Source code in toolboxv2/mods/TruthSeeker/tests.py
375 376 377 |
|
run_specific_test(test_class, test_name)
¶
Run a specific test from a test class
Source code in toolboxv2/mods/TruthSeeker/tests.py
389 390 391 |
|
run_test_suite(test_class=None, test_name=None, verbosity=2)
¶
Run specific test class or test case.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
test_class
|
The test class to run (optional) |
None
|
|
test_name
|
Specific test method name to run (optional) |
None
|
|
verbosity
|
Output detail level (default=2) |
2
|
Returns:
Type | Description |
---|---|
TestResult object |
Source code in toolboxv2/mods/TruthSeeker/tests.py
346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 |
|
run_truth_seeker_tests(test_name=None)
¶
Run TestTruthSeeker tests
Source code in toolboxv2/mods/TruthSeeker/tests.py
384 385 386 |
|
test_arxiv_search()
¶
Run only ArXiv search tests
Source code in toolboxv2/mods/TruthSeeker/tests.py
414 415 416 417 418 419 420 |
|
test_pdf_download()
¶
Run only PDF download tests
Source code in toolboxv2/mods/TruthSeeker/tests.py
398 399 400 401 402 403 404 |
|
test_truth_seeker()
¶
Run only PDF download tests
Source code in toolboxv2/mods/TruthSeeker/tests.py
406 407 408 409 410 411 412 |
|
UltimateTTT
¶
UltimateTTTGameEngine
¶
Source code in toolboxv2/mods/UltimateTTT.py
178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 |
|
WebSocketManager
¶
WebSocketPoolManager
¶
Source code in toolboxv2/mods/WebSocketManager.py
529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 |
|
add_connection(pool_id, connection_id, websocket)
async
¶
Add a WebSocket connection to a pool.
Source code in toolboxv2/mods/WebSocketManager.py
546 547 548 549 550 551 552 |
|
broadcast(pool_id, message, exclude_connection_id=None)
async
¶
Broadcast a message to all connections in a pool, optionally excluding one connection.
Source code in toolboxv2/mods/WebSocketManager.py
602 603 604 605 606 607 608 609 610 611 612 613 |
|
close_all_pools()
async
¶
Close all connections in all pools and remove all pools.
Source code in toolboxv2/mods/WebSocketManager.py
647 648 649 650 651 |
|
close_pool(pool_id)
async
¶
Close all connections in a pool and remove the pool.
Source code in toolboxv2/mods/WebSocketManager.py
637 638 639 640 641 642 643 644 645 |
|
create_pool(pool_id)
async
¶
Create a new WebSocket pool.
Source code in toolboxv2/mods/WebSocketManager.py
534 535 536 537 538 539 540 541 542 543 544 |
|
get_all_pools()
¶
Get a list of all pool IDs.
Source code in toolboxv2/mods/WebSocketManager.py
633 634 635 |
|
get_pool_connections(pool_id)
¶
Get a list of all connection IDs in a pool.
Source code in toolboxv2/mods/WebSocketManager.py
625 626 627 628 629 630 631 |
|
handle_message(pool_id, connection_id, message)
async
¶
Handle incoming messages and route them to the appropriate action handler.
Source code in toolboxv2/mods/WebSocketManager.py
579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 |
|
register_action(pool_id, action_name, handler, connection_ids=None)
¶
Register an action for specific connections or the entire pool.
Source code in toolboxv2/mods/WebSocketManager.py
562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 |
|
remove_connection(pool_id, connection_id)
async
¶
Remove a WebSocket connection from a pool.
Source code in toolboxv2/mods/WebSocketManager.py
554 555 556 557 558 559 560 |
|
send_to_connection(pool_id, connection_id, message)
async
¶
Send a message to a specific connection in a pool.
Source code in toolboxv2/mods/WebSocketManager.py
615 616 617 618 619 620 621 622 623 |
|
WhatsAppTb
¶
client
¶
DocumentSystem
¶
Source code in toolboxv2/mods/WhatsAppTb/client.py
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 |
|
delete_document(blob_id)
¶
Delete a document
Source code in toolboxv2/mods/WhatsAppTb/client.py
107 108 109 110 111 112 113 114 |
|
list_documents(filter_type=None)
¶
List all documents with metadata
Source code in toolboxv2/mods/WhatsAppTb/client.py
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
|
save_document(file_data, filename, file_type)
¶
Save a document with metadata
Source code in toolboxv2/mods/WhatsAppTb/client.py
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
|
search_documents(query)
¶
Search documents by filename or content
Source code in toolboxv2/mods/WhatsAppTb/client.py
116 117 118 119 120 121 122 |
|
WhatsAppAssistant
dataclass
¶
Source code in toolboxv2/mods/WhatsAppTb/client.py
141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 |
|
agent_task(message)
async
¶
Initiate email search workflow
Source code in toolboxv2/mods/WhatsAppTb/client.py
752 753 754 755 756 757 758 759 760 761 762 |
|
check_emails(message, query='')
async
¶
Improved email checking with WhatsApp API formatting
Source code in toolboxv2/mods/WhatsAppTb/client.py
764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 |
|
complete_authorization(message)
¶
Complete the authorization process using the authorization code
:param authorization_code: Authorization code received from Google
Source code in toolboxv2/mods/WhatsAppTb/client.py
218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 |
|
delete_document(message)
async
¶
Delete document workflow
Source code in toolboxv2/mods/WhatsAppTb/client.py
1421 1422 1423 1424 1425 1426 1427 1428 1429 |
|
email_search(message)
async
¶
Initiate email search workflow
Source code in toolboxv2/mods/WhatsAppTb/client.py
871 872 873 874 875 876 877 878 879 880 881 |
|
email_summary(message)
async
¶
Generate AI-powered email summaries
Source code in toolboxv2/mods/WhatsAppTb/client.py
844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 |
|
find_time_slot(message)
async
¶
Find and display the next 5 available time slots with dynamic durations
Source code in toolboxv2/mods/WhatsAppTb/client.py
1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 |
|
generate_authorization_url(*a)
async
¶
Generate an authorization URL for user consent
:return: Authorization URL for the user to click and authorize access
Source code in toolboxv2/mods/WhatsAppTb/client.py
185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 |
|
get_email_details(email_id)
async
¶
Retrieve and format full email details
Source code in toolboxv2/mods/WhatsAppTb/client.py
812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 |
|
get_event_details(event_id)
async
¶
Retrieve and format calendar event details with location support
Source code in toolboxv2/mods/WhatsAppTb/client.py
1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 |
|
handle_audio_message(message)
async
¶
Process audio messages with STT and TTS
Source code in toolboxv2/mods/WhatsAppTb/client.py
536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 |
|
handle_button_interaction(content, message)
async
¶
Handle button click interactions
Source code in toolboxv2/mods/WhatsAppTb/client.py
602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 |
|
handle_calendar_actions(message)
async
¶
Handle calendar-related pending actions
Source code in toolboxv2/mods/WhatsAppTb/client.py
1188 1189 1190 1191 1192 1193 1194 1195 |
|
handle_email_actions(message)
async
¶
Handle multi-step email workflows
Source code in toolboxv2/mods/WhatsAppTb/client.py
896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 |
|
handle_interactive(message)
async
¶
Handle all interactive messages
Source code in toolboxv2/mods/WhatsAppTb/client.py
528 529 530 531 532 533 534 |
|
handle_media_message(message)
async
¶
Handle document/image/video uploads
Source code in toolboxv2/mods/WhatsAppTb/client.py
1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 |
|
handle_message(message)
async
¶
Main message handler for incoming WhatsApp messages
Source code in toolboxv2/mods/WhatsAppTb/client.py
451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 |
|
init_services()
¶
Initialize Gmail and Calendar services
Source code in toolboxv2/mods/WhatsAppTb/client.py
276 277 278 279 280 281 282 283 284 |
|
load_credentials()
¶
Load previously saved credentials if available
:return: Whether credentials were successfully loaded
Source code in toolboxv2/mods/WhatsAppTb/client.py
262 263 264 265 266 267 268 269 270 271 272 273 |
|
run()
¶
Start the WhatsApp assistant
Source code in toolboxv2/mods/WhatsAppTb/client.py
1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 |
|
save_credentials()
¶
Save the obtained credentials to a file for future use
Source code in toolboxv2/mods/WhatsAppTb/client.py
251 252 253 254 255 256 257 258 259 |
|
search_documents(message)
async
¶
Initiate document search workflow
Source code in toolboxv2/mods/WhatsAppTb/client.py
1372 1373 1374 1375 1376 1377 1378 1379 |
|
send_email(to, subject, body)
¶
Actual email sending function to be called by agent
Source code in toolboxv2/mods/WhatsAppTb/client.py
1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 |
|
send_structured_response(result)
¶
Send complex responses using appropriate WhatsApp features
Source code in toolboxv2/mods/WhatsAppTb/client.py
692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 |
|
setup_interaction_buttons()
¶
Define WhatsApp interaction buttons for different functionalities
Source code in toolboxv2/mods/WhatsAppTb/client.py
294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 |
|
setup_progress_messengers()
¶
Initialize progress messengers for different types of tasks
Source code in toolboxv2/mods/WhatsAppTb/client.py
286 287 288 289 290 291 292 |
|
show_task_stack(*a)
async
¶
Display current task stack
Source code in toolboxv2/mods/WhatsAppTb/client.py
1499 1500 1501 1502 1503 1504 |
|
show_today_events(message)
async
¶
Show today's calendar events
Source code in toolboxv2/mods/WhatsAppTb/client.py
1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 |
|
show_upcoming_events(message)
async
¶
Show upcoming events with interactive support
Source code in toolboxv2/mods/WhatsAppTb/client.py
1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 |
|
start_agent(*a)
async
¶
Start the agent in background mode
Source code in toolboxv2/mods/WhatsAppTb/client.py
1485 1486 1487 1488 1489 1490 |
|
start_document_upload(message)
async
¶
Initiate document upload workflow
Source code in toolboxv2/mods/WhatsAppTb/client.py
1363 1364 1365 1366 1367 1368 1369 1370 |
|
start_email_compose(message)
async
¶
Enhanced email composition workflow
Source code in toolboxv2/mods/WhatsAppTb/client.py
883 884 885 886 887 888 889 890 891 892 893 894 |
|
start_event_create(message)
async
¶
Initiate event creation workflow
Source code in toolboxv2/mods/WhatsAppTb/client.py
1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 |
|
stop_agent(*b)
async
¶
Stop the currently running agent
Source code in toolboxv2/mods/WhatsAppTb/client.py
1492 1493 1494 1495 1496 1497 |
|
system_task(message)
async
¶
Initiate email search workflow
Source code in toolboxv2/mods/WhatsAppTb/client.py
740 741 742 743 744 745 746 747 748 749 750 |
|
server
¶
AppManager
¶
Source code in toolboxv2/mods/WhatsAppTb/server.py
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 |
|
add_instance(instance_id, **kwargs)
¶
Add a new app instance to the manager with automatic port assignment.
Source code in toolboxv2/mods/WhatsAppTb/server.py
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 |
|
add_update_instance(instance_id, token, phone_key, phone_number)
¶
Add or update instance configuration
Source code in toolboxv2/mods/WhatsAppTb/server.py
301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 |
|
create_manager_ui(start_assistant)
¶
Enhanced WhatsApp Manager UI with instance configuration controls
Source code in toolboxv2/mods/WhatsAppTb/server.py
195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 |
|
get_next_available_port()
¶
Find the next available port in the range.
Source code in toolboxv2/mods/WhatsAppTb/server.py
78 79 80 81 82 83 84 |
|
on_event(instance_id, event)
async
¶
Handle events.
Source code in toolboxv2/mods/WhatsAppTb/server.py
156 157 158 159 160 |
|
on_message(instance_id, message)
async
¶
Handle and forward incoming messages.
Source code in toolboxv2/mods/WhatsAppTb/server.py
150 151 152 153 154 |
|
on_verification(instance_id, verification)
async
¶
Handle verification events.
Source code in toolboxv2/mods/WhatsAppTb/server.py
162 163 164 |
|
restart_instance(instance_id)
¶
Safe restart of instance
Source code in toolboxv2/mods/WhatsAppTb/server.py
327 328 329 330 |
|
run_all_instances()
¶
Start all instances in separate daemon threads.
Source code in toolboxv2/mods/WhatsAppTb/server.py
166 167 168 169 170 171 172 173 174 175 176 177 178 179 |
|
run_instance(instance_id)
¶
Run a single instance in a separate thread with error handling and automatic restart.
Source code in toolboxv2/mods/WhatsAppTb/server.py
125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 |
|
signal_handler(signum, frame)
¶
Handle shutdown signals gracefully.
Source code in toolboxv2/mods/WhatsAppTb/server.py
181 182 183 184 185 |
|
start_instance(instance_id)
¶
Start instance thread
Source code in toolboxv2/mods/WhatsAppTb/server.py
339 340 341 342 343 344 345 346 347 348 349 350 |
|
stop_all_instances()
¶
Stop all running instances gracefully.
Source code in toolboxv2/mods/WhatsAppTb/server.py
187 188 189 190 191 192 193 |
|
stop_instance(instance_id)
¶
Graceful stop of instance
Source code in toolboxv2/mods/WhatsAppTb/server.py
332 333 334 335 336 337 |
|
update_instance_config(instance_id, new_key, new_number)
¶
Update existing instance configuration
Source code in toolboxv2/mods/WhatsAppTb/server.py
318 319 320 321 322 323 324 325 |
|
utils
¶
ProgressMessenger
¶
Source code in toolboxv2/mods/WhatsAppTb/utils.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
|
send_initial_message(mode='progress')
¶
Sends the initial message. Modes can be 'progress' or 'loading'.
Source code in toolboxv2/mods/WhatsAppTb/utils.py
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
|
start_loading_in_background(stop_flag)
¶
Starts the loading update in a separate thread.
Source code in toolboxv2/mods/WhatsAppTb/utils.py
97 98 99 100 101 |
|
start_progress_in_background(step_flag)
¶
Starts the progress update in a separate thread.
Source code in toolboxv2/mods/WhatsAppTb/utils.py
91 92 93 94 95 |
|
update_loading(stop_flag)
¶
Continuously updates the reaction to represent a looping 'loading' indicator.
Source code in toolboxv2/mods/WhatsAppTb/utils.py
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
|
update_progress(step_flag)
¶
Updates the reaction on the message to represent progress.
Source code in toolboxv2/mods/WhatsAppTb/utils.py
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
|
cli_functions
¶
replace_bracketed_content(text, replacements, inlist=False)
¶
Ersetzt Inhalte in eckigen Klammern mit entsprechenden Werten aus einem Wörterbuch.
:param text: Der zu verarbeitende Text als String. :param replacements: Ein Wörterbuch mit Schlüssel-Wert-Paaren für die Ersetzung. :return: Den modifizierten Text.
Source code in toolboxv2/mods/cli_functions.py
180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 |
|
isaa
¶
CodingAgent
¶
live
¶
AsyncCodeDetector
¶
Bases: NodeVisitor
Detect async code and top-level await
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 |
|
BrowserWrapper
¶
A wrapper for browser agent functionality that allows seamless interaction with web browsers.
This class provides a system-agnostic interface to control browsers through the browser_use library, supporting both local and remote browser connections.
Attributes:
Name | Type | Description |
---|---|---|
browser |
The Browser instance for web automation |
|
agent |
The BrowserAgent instance for intelligent browsing |
|
is_initialized |
bool
|
Whether the browser has been initialized |
config |
Dict
|
Configuration for the browser |
remote_url |
Optional[str]
|
URL for remote browser connection if applicable |
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 |
|
__init__(llm=None, headless=False, chrome_path=None, remote_url=None, api_key=None, config=None)
¶Initialize the browser wrapper.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
llm
|
Any
|
Language model to use for the browser agent |
None
|
headless
|
bool
|
Whether to run the browser in headless mode |
False
|
chrome_path
|
str | None
|
Path to local Chrome executable |
None
|
remote_url
|
str | None
|
URL for remote browser connection (wss or cdp) |
None
|
config
|
dict[str, Any] | None
|
Additional browser configuration |
None
|
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 |
|
close()
async
¶Close the browser
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
1823 1824 1825 1826 1827 |
|
close_current_tab()
async
¶Close the current tab/page
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 |
|
create_agent(task, initial_actions=None)
async
¶Create a browser agent with the specified task
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 |
|
create_new_tab()
async
¶Create a new tab/page
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
1770 1771 1772 1773 1774 1775 1776 1777 1778 |
|
execute_js(code, page=None)
async
¶Execute JavaScript code in the browser context
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 |
|
extract_markdown(page=None, selector='body', include_images=True)
async
¶Extract content from a webpage and convert it to markdown.
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 |
|
extract_structured_content(page=None, config=None)
async
¶Extract structured content from a webpage based on a configuration.
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 |
|
extract_text(page=None, selector='body')
async
¶Extract plain text from a webpage.
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 |
|
get_parser()
¶Get a content parser for the browser
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
1831 1832 1833 1834 1835 |
|
get_tabs()
async
¶Get all open tabs/pages
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
1748 1749 1750 1751 1752 1753 1754 |
|
initialize()
async
¶Initialize the browser and context
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 |
|
navigate(url)
async
¶Navigate to a URL
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 |
|
restore_context(context_data)
async
¶Restore browser context from saved state
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
1816 1817 1818 1819 1820 1821 |
|
run(task)
async
¶Run the browser agent with the specified task
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
1723 1724 1725 1726 1727 |
|
save_context()
async
¶Save browser context state
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
1809 1810 1811 1812 1813 1814 |
|
switch_to_tab(tab_index)
async
¶Switch to a specific tab by index
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 |
|
take_scrolling_screenshot(page=None, full_page=True, path=None, initial_delay=1000, scroll_delay=500, format='png')
async
¶Take a screenshot with scrolling functionality and delay.
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 |
|
CargoRustInterface
¶
Usage :
Create interface¶
cargo_interface = CargoRustInterface()
Set up new project¶
await cargo_interface.setup_project("hello_rust")
Add a dependency¶
await cargo_interface.add_dependency("serde", "1.0")
Write and run some code¶
code = """ fn main() { println!("Hello, Rust!"); } """ result = await cargo_interface.run_code(code)
Modify code¶
new_function = """ fn main() { println!("Modified Hello, Rust!"); } """ await cargo_interface.modify_code(new_function, "main()")
Build and test¶
await cargo_interface.build() await cargo_interface.test()
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 |
|
__init__(session_dir=None, auto_remove=True)
¶Initialize the Rust/Cargo interface
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
288 289 290 291 292 293 294 295 296 |
|
add_dependency(name, version=None)
async
¶Add a dependency to Cargo.toml
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 |
|
build(release=False)
async
¶Build the project
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 |
|
load_session(name)
¶Load saved session state
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
480 481 482 483 484 485 486 487 |
|
modify_code(code, object_name, file='src/main.rs')
async
¶Modify existing Rust code
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 |
|
reset()
¶Reset the interface state
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
298 299 300 301 302 303 304 |
|
run_code(code)
async
¶Run Rust code
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 |
|
save_session(name)
¶Save current session state
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
469 470 471 472 473 474 475 476 477 478 |
|
setup_project(name)
async
¶Set up a new Cargo project
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 |
|
test()
async
¶Run project tests
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 |
|
EnhancedVerboseOutput
¶
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 |
|
log_header(text)
¶Log method update with structured formatting
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
192 193 194 195 196 197 |
|
log_message(role, content)
async
¶Log chat messages with role-based formatting
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
150 151 152 153 154 155 156 157 158 159 160 161 162 163 |
|
log_process_result(result)
async
¶Log processing results with structured formatting
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
177 178 179 180 181 182 183 184 185 186 187 188 189 190 |
|
log_state(state, user_ns, override=False)
¶Log method update with structured formatting
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
199 200 201 202 203 204 |
|
log_think_result(result)
async
¶Log thinking results with structured formatting
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
165 166 167 168 169 170 171 172 173 174 175 |
|
JSExecutionRecord
dataclass
¶
Records JavaScript execution details
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
44 45 46 47 48 49 50 51 |
|
MockIPython
¶
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 |
|
__str__()
¶String representation of current session
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 |
|
get_namespace()
¶Get current namespace
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
837 838 839 |
|
load_session(name)
¶Load session with UTF-8 encoding
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 |
|
modify_code(code=None, object_name=None, file=None)
async
¶1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
|
2. Change a method implementation¶
await ipython.modify_code( code='"""def sound(self): return "Woof""""', object_name="Dog.sound" )
3. Modify a function¶
await ipython.modify_code( code='"""def calculate_age(): return 25"""', object_name="calculate_age" )
4. Update variable in memory and file¶
await ipython.modify_code( code="100", object_name="MAX_SIZE", file="config.py" )
5. Modifying an attribute in init¶
await ipython.modify_code( code='"""def init(self): self.name = "Buddy""""', object_name="Dog.init" )
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 |
|
reset()
¶Reset the interpreter state
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 |
|
run_cell(code, live_output=True)
async
¶Async version of run_cell that handles both sync and async code
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 |
|
save_session(name)
¶Save session with UTF-8 encoding
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 |
|
update_namespace(variables)
¶Update namespace with new variables
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
841 842 843 |
|
ParentNodeTransformer
¶
Bases: NodeTransformer
Add parent references to AST nodes
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
688 689 690 691 692 693 |
|
Pipeline
¶
A pipeline for executing AI agent-driven tasks with interactive code execution and variable management.
The Pipeline class provides a structured environment for AI agents to: 1. Execute code in a controlled environment 2. Manage and track variables 3. Update methods dynamically 4. Save and load session states 5. Generate detailed variable descriptions
Attributes:
Name | Type | Description |
---|---|---|
agent |
The AI agent instance used for task execution |
|
task |
str
|
The task to be performed |
mas_iter |
int
|
Maximum number of iterations allowed (default: 12) |
variables |
Dict[str, Any]
|
Dictionary of variables available to the pipeline |
top_n |
Optional[int]
|
Limit variable descriptions to top N most used |
execution_history |
List[ExecutionRecord]
|
History of executed code and results |
session_name |
Optional[str]
|
Name of the current session if saved |
ipython |
IPython or MockIPython instance for code execution |
Example
agent = get_free_agent("demo", "anthropic/claude-3-haiku-20240307") pipeline = Pipeline( ... agent=agent, ... task="Calculate fibonacci sequence", ... variables={"n": 10} ... ) result = pipeline.run("...") print(result.result)
Notes
- The pipeline uses either IPython if available or a MockIPython implementation
- Variables can be provided as either a dictionary or list
- Session state can be saved and loaded
- Method updates are handled through a structured BaseModel approach
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 |
|
__init__(agent, verbose=False, max_iter=12, variables=None, top_n=None, restore=None, max_think_after_think=None, print_f=None, web_js=False, timeout_timer=25, v_agent=None, web_llm=None)
¶Initialize the Pipeline.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
agent
|
Any
|
AI agent instance to use for task execution |
required |
verbose
|
bool
|
print internal results |
False
|
max_iter
|
int
|
Maximum number of iterations (default: 12) |
12
|
variables
|
dict[str, Any] | list[Any] | None
|
Dictionary or list of variables to make available |
None
|
top_n
|
bool | None
|
Limit variable descriptions to top N most used |
None
|
web_js
|
if the agent is allow to use the web |
False
|
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 |
|
__str__()
¶String representation of pipeline session
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
2605 2606 2607 |
|
load_session(name)
¶Load saved session
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
2210 2211 2212 2213 |
|
run(task, do_continue=False)
async
¶Run the pipeline with separated thinking and processing phases
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 |
|
save_session(name)
¶Save current session
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
2205 2206 2207 2208 |
|
SyncReport
dataclass
¶
Report of variables synced from namespace to pipeline
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 |
|
TeeStream
¶
Stream that writes to both console and buffer
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
672 673 674 675 676 677 678 679 680 681 682 683 684 685 |
|
VerboseFormatter
¶
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 |
|
print_header(text)
¶Print a formatted header with separator line
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
61 62 63 64 65 66 |
|
print_iteration(current, maximum)
¶Print iteration progress with visual bar
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
83 84 85 86 87 |
|
print_method_update(method_update)
¶Print a formatted view of a MethodUpdate structure
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 |
|
print_section(title, content)
¶Print a formatted section with title and content
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
|
print_state(state, details=None)
¶Print current state with optional details
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
|
process_with_spinner(message, coroutine)
async
¶Execute a coroutine with a spinner indicator
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
136 137 138 139 140 |
|
VirtualEnvContext
¶
Context manager for temporary virtual environment activation
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 |
|
VirtualFileSystem
¶
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 |
|
change_directory(dirpath)
¶Change current working directory
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
560 561 562 563 564 565 |
|
create_directory(dirpath)
¶Create a new directory
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
546 547 548 549 550 |
|
delete_file(filepath)
¶Delete a virtual file
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
535 536 537 538 539 540 541 542 543 544 |
|
list_directory(dirpath='.')
¶List contents of a directory
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
553 554 555 556 557 558 |
|
load_state(state_file)
¶Load virtual filesystem state from disk
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
585 586 587 588 589 590 591 592 593 |
|
print_file_structure(start_path='.', indent='')
¶Print the file structure starting from the given path
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
595 596 597 598 599 600 601 602 603 604 605 606 607 608 |
|
read_file(filepath)
¶Read content from a virtual file using UTF-8
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 |
|
save_state(state_file)
¶Save virtual filesystem state to disk
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
576 577 578 579 580 581 582 583 |
|
write_file(filepath, content)
¶Write content to a virtual file and persist to disk using UTF-8
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 |
|
WebContentParser
¶
Parser for extracting content from web pages in various formats.
Provides methods to extract content as markdown, plain text, structured data, and take screenshots with scrolling support.
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 |
|
__init__(browser_wrapper)
¶Initialize the parser with a browser wrapper instance
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
1487 1488 1489 |
|
extract_all(page=None, selector='body', include_images=True, screenshot=True, screenshot_path=None)
async
¶Extract all content types (markdown, text, structured data, screenshot)
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 |
|
to_markdown(page=None, selector='main, article, #content, .content, body', include_images=True)
async
¶Convert webpage content to markdown format
Parameters:
Name | Type | Description | Default |
---|---|---|---|
page
|
The page to parse (uses current page if None) |
None
|
|
selector
|
CSS selector for the content to extract |
'main, article, #content, .content, body'
|
|
include_images
|
Whether to include image references |
True
|
Returns:
Name | Type | Description |
---|---|---|
str |
Markdown content |
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 |
|
to_screenshot(page=None, full_page=True, path=None, initial_delay=1000, scroll_delay=500, format='png')
async
¶Take a screenshot with scrolling functionality
Parameters:
Name | Type | Description | Default |
---|---|---|---|
page
|
The page to screenshot |
None
|
|
full_page
|
Whether to capture the full page |
True
|
|
path
|
Path to save the screenshot |
None
|
|
initial_delay
|
Delay in ms before starting screenshot |
1000
|
|
scroll_delay
|
Delay in ms between scrolls |
500
|
|
format
|
Image format ('png' or 'jpeg') |
'png'
|
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 |
|
to_structured(page=None, config=None)
async
¶Extract structured data from webpage using selector configuration
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
1510 1511 1512 |
|
to_text(page=None, selector='body')
async
¶Extract plain text from webpage
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
1506 1507 1508 |
|
auto_install(package_name, install_method='pip', upgrade=False, quiet=False, version=None, extra_args=None)
¶
Enhanced auto-save import with version and extra arguments support
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 |
|
sync_globals_to_vars(pipeline, namespace=None, prefix=None, include_types=None, exclude_patterns=None, exclude_private=True, deep_copy=False, only_serializable=False)
¶
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
|
Basic usage - sync all globals¶
report = sync_globals_to_vars(pipeline)
Sync only numeric types with prefix¶
report = sync_globals_to_vars( pipeline, include_types=[int, float], prefix="global_" )
Sync from specific namespace¶
import numpy as np namespace = {"arr": np.array([1,2,3])} report = sync_globals_to_vars(pipeline, namespace=namespace)
Sync with deep copy and serialization check¶
report = sync_globals_to_vars( pipeline, deep_copy=True, only_serializable=True )
Source code in toolboxv2/mods/isaa/CodingAgent/live.py
3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 |
|
parser
¶
CodeProcessor
¶
Source code in toolboxv2/mods/isaa/CodingAgent/parser.py
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
|
update_existing_file(filepath, new_code)
¶Update an existing Python file with new code while preserving existing implementations.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
filepath
|
str
|
Path to the file to be updated |
required |
new_code
|
str
|
New code to merge with existing code |
required |
Source code in toolboxv2/mods/isaa/CodingAgent/parser.py
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
|
SearchAgentCluster
¶
search_tool
¶
WebContentParser
¶
Utility class for parsing web content using BrowserAnt
Source code in toolboxv2/mods/isaa/SearchAgentCluster/search_tool.py
580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 |
|
__init__(browser_wrapper)
¶Initialize with a browser wrapper
Source code in toolboxv2/mods/isaa/SearchAgentCluster/search_tool.py
583 584 585 |
|
extract_article(url)
async
¶Extract article content with title, text, and metadata
Source code in toolboxv2/mods/isaa/SearchAgentCluster/search_tool.py
587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 |
|
extract_links(url, link_selector='a')
async
¶Extract all links from a webpage
Source code in toolboxv2/mods/isaa/SearchAgentCluster/search_tool.py
716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 |
|
extract_table_data(url, table_selector='table')
async
¶Extract tabular data from a webpage
Source code in toolboxv2/mods/isaa/SearchAgentCluster/search_tool.py
668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 |
|
WebScraper
¶
1 2 |
|
import asyncio from pydantic import BaseModel, Field from typing import List, Optional
Define a structured data model¶
class ProductInfo(BaseModel): title: str price: str description: Optional[str] = None rating: Optional[str] = None availability: Optional[str] = None
async def main(): # Initialize the scraper scraper = WebScraper()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
|
Source code in toolboxv2/mods/isaa/SearchAgentCluster/search_tool.py
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 |
|
__init__(config=WebScraperConfig(), llm=None, chrome_path=None, remote_url=None, browser_config=None)
¶Initialize the web scraper with configuration.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
config
|
WebScraperConfig
|
Configuration for scraper behavior |
WebScraperConfig()
|
llm
|
str | BaseChatModel | None
|
Language model for intelligent data extraction |
None
|
chrome_path
|
str | None
|
Path to Chrome executable |
None
|
remote_url
|
str | None
|
URL for remote browser connection |
None
|
browser_config
|
dict[str, Any] | None
|
Additional browser configuration |
None
|
Source code in toolboxv2/mods/isaa/SearchAgentCluster/search_tool.py
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 |
|
close()
async
¶Close the browser and clean up resources
Source code in toolboxv2/mods/isaa/SearchAgentCluster/search_tool.py
127 128 129 130 131 132 |
|
initialize()
async
¶Initialize the browser if not already initialized
Source code in toolboxv2/mods/isaa/SearchAgentCluster/search_tool.py
123 124 125 |
|
scrape_structured_data(urls, model, extraction_task=None)
async
¶Scrape and parse structured data into pydantic models
Parameters:
Name | Type | Description | Default |
---|---|---|---|
urls
|
list[str]
|
List of URLs to scrape |
required |
model
|
type[T]
|
Pydantic model class for structured data |
required |
extraction_task
|
str
|
Natural language description of what to extract |
None
|
Returns:
Type | Description |
---|---|
list[T]
|
List of parsed data objects |
Source code in toolboxv2/mods/isaa/SearchAgentCluster/search_tool.py
453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 |
|
scrape_url(url, extract_config=None)
async
¶Scrape a single URL and return the results
Parameters:
Name | Type | Description | Default |
---|---|---|---|
url
|
str
|
URL to scrape |
required |
extract_config
|
dict[str, Any]
|
Configuration for structured data extraction |
None
|
Returns:
Type | Description |
---|---|
dict[str, Any]
|
Dictionary containing scraped data |
Source code in toolboxv2/mods/isaa/SearchAgentCluster/search_tool.py
409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 |
|
scrape_urls(urls, extract_config=None)
async
¶Scrape multiple URLs in parallel and return all results
Parameters:
Name | Type | Description | Default |
---|---|---|---|
urls
|
list[str]
|
List of URLs to scrape |
required |
extract_config
|
dict[str, Any] | None
|
Configuration for structured data extraction |
None
|
Returns:
Type | Description |
---|---|
list[dict[str, Any]]
|
List of dictionaries containing scraped data |
Source code in toolboxv2/mods/isaa/SearchAgentCluster/search_tool.py
425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 |
|
search_web(query, max_results=5, include_content=True, extract_images=False, extract_tables=False, extract_links=False, save_to_file=None)
async
¶Perform a comprehensive web search and return high-quality data for the given query.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
query
|
str
|
Search query string |
required |
max_results
|
int
|
Maximum number of results to process (default: 5) |
5
|
include_content
|
bool
|
Whether to include full content from result pages (default: True) |
True
|
extract_images
|
bool
|
Whether to extract images from result pages (default: False) |
False
|
extract_tables
|
bool
|
Whether to extract tables from result pages (default: False) |
False
|
extract_links
|
bool
|
Whether to extract links from result pages (default: False) |
False
|
save_to_file
|
str | None
|
Path to save results as JSON (optional) |
None
|
Returns:
Type | Description |
---|---|
dict[str, Any]
|
Dictionary containing search results and extracted information |
Source code in toolboxv2/mods/isaa/SearchAgentCluster/search_tool.py
136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 |
|
WebScraperConfig
¶
Bases: BaseModel
Configuration for web scraper operations
Source code in toolboxv2/mods/isaa/SearchAgentCluster/search_tool.py
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
|
sanitize_filename(filename)
¶
Convert a string to a valid filename
Source code in toolboxv2/mods/isaa/SearchAgentCluster/search_tool.py
978 979 980 981 982 |
|
scrape_documentation_to_markdown(start_url, topic=None, max_pages=30, max_depth=3, output_dir=None, toc_filename='table_of_contents.md')
async
¶
Recursively scrape documentation pages starting from a URL, focused on a specific topic, and convert to Markdown.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
start_url
|
str
|
The documentation homepage or entry point |
required |
topic
|
str | None
|
The topic to focus on (e.g., "streaming", "authentication") |
None
|
max_pages
|
int
|
Maximum number of pages to scrape |
30
|
max_depth
|
int
|
Maximum depth of link traversal |
3
|
output_dir
|
str | None
|
Directory to save the MD files (if None, just returns them) |
None
|
toc_filename
|
str
|
Filename for the table of contents |
'table_of_contents.md'
|
Returns:
Type | Description |
---|---|
dict[str, str]
|
Dictionary mapping page titles to markdown content |
Source code in toolboxv2/mods/isaa/SearchAgentCluster/search_tool.py
745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 |
|
base
¶
Agent
¶
agent
¶
AgentModelData
¶
Bases: BaseModel
Configuration for the LLM model and API settings via LiteLLM.
Source code in toolboxv2/mods/isaa/base/Agent/agent.py
343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 |
|
EnhancedAgent
¶
Bases: *_AgentBaseClass
Enhanced, production-oriented Unified Agent integrating LiteLLM, ADK, A2A, and MCP (via ADK).
Source code in toolboxv2/mods/isaa/base/Agent/agent.py
468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 |
|
a_format_class(pydantic_model, prompt, message_context=None, max_retries=2)
async
¶Uses LiteLLM's response_format feature to get structured JSON output, with retries.
Source code in toolboxv2/mods/isaa/base/Agent/agent.py
1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 |
|
a_run(user_input, session_id=None, persist_history=True, strategy_override=None, kwargs_override=None, a2a_task_id=None)
async
¶Main asynchronous execution logic for the agent turn.
Orchestrates world model updates, state sync, strategy selection, execution, cost tracking, and callbacks.
Source code in toolboxv2/mods/isaa/base/Agent/agent.py
947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 |
|
a_run_llm_completion(llm_messages=None, **kwargs)
async
¶Core wrapper around LiteLLM acompletion with error handling, streaming, and cost tracking.
Source code in toolboxv2/mods/isaa/base/Agent/agent.py
1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 |
|
adk_tool_a2a_cancel_task(tool_context, target_agent_url, task_id)
async
¶ADK Tool: Attempts to cancel an ongoing A2A task.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
target_agent_url
|
str
|
The URL of the agent hosting the task. |
required |
task_id
|
str
|
The ID of the task to cancel. |
required |
Returns:
Type | Description |
---|---|
dict[str, Any]
|
A dictionary indicating success or failure, possibly with the task's state after cancellation attempt. |
Source code in toolboxv2/mods/isaa/base/Agent/agent.py
2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 |
|
adk_tool_a2a_get_task_status(tool_context, target_agent_url, task_id)
async
¶ADK Tool: Gets the current status and details of an A2A task.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
target_agent_url
|
str
|
The URL of the agent hosting the task. |
required |
task_id
|
str
|
The ID of the task to check. |
required |
Returns:
Type | Description |
---|---|
dict[str, Any]
|
A dictionary containing task status details (state, message, artifacts) or an error. |
Source code in toolboxv2/mods/isaa/base/Agent/agent.py
1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 |
|
adk_tool_a2a_send_and_wait(tool_context, target_agent_url, task_prompt, session_id=None)
async
¶ADK Tool: Sends a task to another agent via A2A and waits for the final text result.
Source code in toolboxv2/mods/isaa/base/Agent/agent.py
1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 |
|
adk_tool_a2a_send_no_wait(tool_context, target_agent_url, task_prompt, session_id=None)
async
¶ADK Tool: Sends a task to another agent via A2A and returns the task ID immediately.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
target_agent_url
|
str
|
The full URL of the target A2A agent. |
required |
task_prompt
|
str
|
The natural language prompt or task for the target agent. |
required |
session_id
|
Optional[str]
|
Optional session ID to use for the A2A interaction. |
None
|
Returns:
Type | Description |
---|---|
str
|
The unique ID of the submitted A2A task, or an error message. |
Source code in toolboxv2/mods/isaa/base/Agent/agent.py
1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 |
|
adk_tool_world_model_get(tool_context, key)
async
¶ADK Tool: Retrieves a specific value from the agent's world model.
Source code in toolboxv2/mods/isaa/base/Agent/agent.py
1903 1904 1905 1906 1907 |
|
adk_tool_world_model_show(tool_context)
async
¶ADK Tool: Returns a string representation of the agent's entire world model.
Source code in toolboxv2/mods/isaa/base/Agent/agent.py
1909 1910 1911 1912 1913 |
|
close()
async
¶Gracefully close connections and resources.
Source code in toolboxv2/mods/isaa/base/Agent/agent.py
2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 |
|
close_a2a_clients()
async
¶Closes all cached A2A client connections.
Source code in toolboxv2/mods/isaa/base/Agent/agent.py
901 902 903 904 905 906 907 908 909 |
|
construct_initial_prompts()
¶Constructs the initial system/context messages for the LLM prompt.
Source code in toolboxv2/mods/isaa/base/Agent/agent.py
1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 |
|
flow_world_model(text_input, session_id, adk_session_state)
async
¶Analyzes input, updates internal WorldModel, and syncs with ADK state if enabled. Sync Priority: If ADK state exists, sync from it first. Then update based on text. The sync to ADK happens after the agent run completes.
Source code in toolboxv2/mods/isaa/base/Agent/agent.py
1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 |
|
print_verbose(*args)
¶Conditional logging helper.
Source code in toolboxv2/mods/isaa/base/Agent/agent.py
2194 2195 2196 2197 |
|
run(user_input, session_id=None, **kwargs)
¶Synchronous wrapper for a_run.
Source code in toolboxv2/mods/isaa/base/Agent/agent.py
1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 |
|
run_a2a_server(host='0.0.0.0', port=5000, **kwargs)
¶Starts the A2A server (blocking) using the python-a2a run_server function.
Source code in toolboxv2/mods/isaa/base/Agent/agent.py
856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 |
|
run_mcp_server(transport='sse', **kwargs)
¶Starts the MCP server (blocking).
Source code in toolboxv2/mods/isaa/base/Agent/agent.py
665 666 667 668 669 670 671 672 673 674 675 676 677 678 |
|
setup_a2a_client(target_agent_url)
async
¶Gets or creates an A2A client for a specific target agent URL using python-a2a.
Source code in toolboxv2/mods/isaa/base/Agent/agent.py
876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 |
|
setup_a2a_server(host='0.0.0.0', port=5000, **a2a_server_options)
¶Initialize and configure the A2A server capabilities using python-a2a. This dynamically creates a server class with the agent's capabilities.
Source code in toolboxv2/mods/isaa/base/Agent/agent.py
683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 |
|
setup_adk_runner(runner_options=None)
¶Initializes an ADK runner for this agent (if ADK enabled).
Source code in toolboxv2/mods/isaa/base/Agent/agent.py
911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 |
|
setup_mcp_server(host='0.0.0.0', port=8000, **mcp_kwargs)
¶Initialize and configure the MCP server capabilities for this agent. This agent will ACT AS an MCP Server.
Source code in toolboxv2/mods/isaa/base/Agent/agent.py
585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 |
|
LLMMessage
dataclass
¶Represents a message in a conversation, compatible with LiteLLM.
Source code in toolboxv2/mods/isaa/base/Agent/agent.py
375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 |
|
to_dict()
¶Converts to dict suitable for LiteLLM.
Source code in toolboxv2/mods/isaa/base/Agent/agent.py
386 387 388 389 390 391 392 393 394 395 |
|
WorldModel
dataclass
¶Thread-safe persistent understanding of the world for the agent.
Source code in toolboxv2/mods/isaa/base/Agent/agent.py
282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 |
|
sync_from_adk_state(adk_state)
¶Updates the WorldModel from an ADK Session State.
Source code in toolboxv2/mods/isaa/base/Agent/agent.py
324 325 326 327 328 329 330 331 |
|
sync_to_adk_state(adk_state)
¶Updates an ADK Session State from the WorldModel.
Source code in toolboxv2/mods/isaa/base/Agent/agent.py
333 334 335 336 337 338 339 340 |
|
builder
¶
BuilderConfig
¶
Bases: BaseModel
Serializable configuration state for the EnhancedAgentBuilder.
Source code in toolboxv2/mods/isaa/base/Agent/builder.py
291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 |
|
EnhancedAgentBuilder
¶Fluent builder for configuring and constructing production-ready EnhancedAgent instances. Supports loading configuration from files and provides methods for detailed setup.
Source code in toolboxv2/mods/isaa/base/Agent/builder.py
344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 |
|
__init__(agent_name='DefaultAgent', config=None, config_path=None)
¶Initialize the builder. Can start with a config object, path, or blank.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
config
|
BuilderConfig | None
|
An existing BuilderConfig object. |
None
|
config_path
|
str | Path | None
|
Path to a YAML/JSON configuration file for the builder. |
None
|
Source code in toolboxv2/mods/isaa/base/Agent/builder.py
350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 |
|
build()
async
¶Constructs and returns the configured EnhancedAgent instance. Handles asynchronous setup like fetching ADK MCP tools.
Source code in toolboxv2/mods/isaa/base/Agent/builder.py
735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 |
|
enable_adk(runner_class=InMemoryRunner, runner_options=None)
¶Enables ADK integration with a specified runner.
Source code in toolboxv2/mods/isaa/base/Agent/builder.py
549 550 551 552 553 554 555 |
|
load_config(path)
¶Loads builder configuration from a JSON file, overwriting current settings.
Source code in toolboxv2/mods/isaa/base/Agent/builder.py
406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 |
|
save_config(path, indent=2)
¶Saves the current builder configuration to a JSON file.
Source code in toolboxv2/mods/isaa/base/Agent/builder.py
389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 |
|
with_adk_code_executor(executor_type)
¶Configures the type of ADK code executor to use (saved in config).
Source code in toolboxv2/mods/isaa/base/Agent/builder.py
600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 |
|
with_adk_code_executor_instance(executor)
¶Provides a pre-initialized ADK code executor instance (transient).
Source code in toolboxv2/mods/isaa/base/Agent/builder.py
618 619 620 621 622 623 624 625 626 |
|
with_adk_mcp_toolset(connection_type, **kwargs)
¶Configures an ADK MCP Toolset connection (saved in config).
Source code in toolboxv2/mods/isaa/base/Agent/builder.py
585 586 587 588 589 590 591 592 593 594 595 596 597 598 |
|
with_adk_tool_function(func, name=None, description=None)
¶Adds a callable function as an ADK tool (transient).
Source code in toolboxv2/mods/isaa/base/Agent/builder.py
570 571 572 573 574 575 576 577 578 579 580 581 582 583 |
|
with_adk_tool_instance(tool)
¶Adds a pre-initialized ADK Tool instance (transient).
Source code in toolboxv2/mods/isaa/base/Agent/builder.py
562 563 564 565 566 567 568 |
|
with_cost_tracker(tracker)
¶Provides a pre-initialized UserCostTracker instance (transient).
Source code in toolboxv2/mods/isaa/base/Agent/builder.py
669 670 671 672 673 674 675 676 677 |
|
with_json_cost_tracker(filepath)
¶Configures the builder to use the JsonFileUserCostTracker (saved in config).
Source code in toolboxv2/mods/isaa/base/Agent/builder.py
679 680 681 682 683 684 |
|
with_litellm_budget_manager(manager)
¶Provides a pre-initialized LiteLLM BudgetManager instance (transient).
Source code in toolboxv2/mods/isaa/base/Agent/builder.py
686 687 688 689 690 691 692 693 694 |
|
with_telemetry_provider_instance(provider)
¶Provides a pre-initialized OpenTelemetry TracerProvider instance (transient).
Source code in toolboxv2/mods/isaa/base/Agent/builder.py
711 712 713 714 715 716 717 718 719 720 721 722 |
|
JsonFileUserCostTracker
¶Stores user costs persistently in a JSON file.
Source code in toolboxv2/mods/isaa/base/Agent/builder.py
185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 |
|
UserCostTracker
¶
Bases: Protocol
Protocol for tracking costs per user.
Source code in toolboxv2/mods/isaa/base/Agent/builder.py
177 178 179 180 181 182 183 |
|
config
¶
A2AConfig
¶
Bases: BaseModel
Configuration for A2A integration.
Source code in toolboxv2/mods/isaa/base/Agent/config.py
116 117 118 119 120 121 122 |
|
ADKConfig
¶
Bases: BaseModel
Configuration for ADK integration.
Source code in toolboxv2/mods/isaa/base/Agent/config.py
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
|
AgentConfig
¶
Bases: BaseModel
Main configuration schema for an EnhancedAgent.
Source code in toolboxv2/mods/isaa/base/Agent/config.py
135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 |
|
load_from_yaml(path)
classmethod
¶Loads configuration from a YAML file.
Source code in toolboxv2/mods/isaa/base/Agent/config.py
201 202 203 204 205 206 207 208 209 210 |
|
save_to_yaml(path)
¶Saves the current configuration to a YAML file.
Source code in toolboxv2/mods/isaa/base/Agent/config.py
212 213 214 215 216 217 218 219 |
|
MCPConfig
¶
Bases: BaseModel
Configuration for MCP integration.
Source code in toolboxv2/mods/isaa/base/Agent/config.py
107 108 109 110 111 112 113 |
|
ModelConfig
¶
Bases: BaseModel
Configuration specific to an LLM model via LiteLLM.
Source code in toolboxv2/mods/isaa/base/Agent/config.py
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
|
ObservabilityConfig
¶
Bases: BaseModel
Configuration for observability (OpenTelemetry).
Source code in toolboxv2/mods/isaa/base/Agent/config.py
125 126 127 128 129 130 131 132 |
|
executors
¶
DockerCodeExecutor
¶
Bases: _BaseExecutorClass
Executes Python code in a sandboxed Docker container.
Requires Docker to be installed and running, and the 'docker' Python SDK.
Source code in toolboxv2/mods/isaa/base/Agent/executors.py
199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 |
|
execute(code)
¶Directly execute code, returning detailed dictionary.
Source code in toolboxv2/mods/isaa/base/Agent/executors.py
330 331 332 333 |
|
RestrictedPythonExecutor
¶
Bases: _BaseExecutorClass
Executes Python code using restrictedpython.
Safer than exec() but NOT a full sandbox. Known vulnerabilities exist. Use with extreme caution and only with trusted code sources or for low-risk operations. Docker is strongly recommended for untrusted code.
Source code in toolboxv2/mods/isaa/base/Agent/executors.py
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 |
|
execute(code)
¶Directly execute code, returning detailed dictionary.
Source code in toolboxv2/mods/isaa/base/Agent/executors.py
190 191 192 193 |
|
get_code_executor(config)
¶Creates a code executor instance based on configuration.
Source code in toolboxv2/mods/isaa/base/Agent/executors.py
337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 |
|
utils
¶
LLMMessage
dataclass
¶Represents a message in a conversation with the LLM.
Source code in toolboxv2/mods/isaa/base/Agent/utils.py
134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 |
|
to_dict()
¶Convert to dictionary, handling potential dataclass nuances.
Source code in toolboxv2/mods/isaa/base/Agent/utils.py
144 145 146 147 148 149 150 151 |
|
WorldModel
dataclass
¶Thread-safe representation of the agent's persistent understanding of the world.
Source code in toolboxv2/mods/isaa/base/Agent/utils.py
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 |
|
AgentUtils
¶
AISemanticMemory
¶
Source code in toolboxv2/mods/isaa/base/AgentUtils.py
630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 |
|
__init__(base_path='/semantic_memory', default_model=os.getenv('DEFAULTMODELSUMMERY'), default_embedding_model=os.getenv('DEFAULTMODELEMBEDDING'), default_similarity_threshold=0.61, default_batch_size=64, default_n_clusters=2, default_deduplication_threshold=0.85)
¶Initialize AISemanticMemory with KnowledgeBase integration
Parameters:
Name | Type | Description | Default |
---|---|---|---|
base_path
|
str
|
Root directory for memory storage |
'/semantic_memory'
|
default_model
|
str
|
Default model for text generation |
getenv('DEFAULTMODELSUMMERY')
|
default_embedding_model
|
str
|
Default embedding model |
getenv('DEFAULTMODELEMBEDDING')
|
default_similarity_threshold
|
float
|
Default similarity threshold for retrieval |
0.61
|
default_batch_size
|
int
|
Default batch size for processing |
64
|
default_n_clusters
|
int
|
Default number of clusters for FAISS |
2
|
default_deduplication_threshold
|
float
|
Default threshold for deduplication |
0.85
|
Source code in toolboxv2/mods/isaa/base/AgentUtils.py
631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 |
|
add_data(memory_name, data, metadata=None)
async
¶Add data to memory store
Parameters:
Name | Type | Description | Default |
---|---|---|---|
memory_name
|
str
|
Target memory store |
required |
data
|
str | list[str] | bytes | dict
|
Text, list of texts, binary file, or structured data |
required |
metadata
|
dict | None
|
Optional metadata |
None
|
Source code in toolboxv2/mods/isaa/base/AgentUtils.py
736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 |
|
create_memory(name, model_config=None, storage_config=None)
¶Create new memory store with KnowledgeBase
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str
|
Unique name for the memory store |
required |
model_config
|
dict | None
|
Configuration for embedding model |
None
|
storage_config
|
dict | None
|
Configuration for KnowledgeBase parameters |
None
|
Source code in toolboxv2/mods/isaa/base/AgentUtils.py
686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 |
|
delete_memory(name)
async
¶Delete a memory store
Source code in toolboxv2/mods/isaa/base/AgentUtils.py
858 859 860 861 862 863 864 |
|
list_memories()
¶List all available memories
Source code in toolboxv2/mods/isaa/base/AgentUtils.py
854 855 856 |
|
load_all_memories(path)
¶Load all memory stores from disk
Source code in toolboxv2/mods/isaa/base/AgentUtils.py
887 888 889 890 891 892 893 894 895 896 |
|
load_memory(name, path)
¶Load a memory store from disk
Source code in toolboxv2/mods/isaa/base/AgentUtils.py
898 899 900 901 902 903 904 905 906 907 908 |
|
query(query, memory_names=None, query_params=None, to_str=False, unified_retrieve=False)
async
¶Query memories using KnowledgeBase retrieval
Parameters:
Name | Type | Description | Default |
---|---|---|---|
query
|
str
|
Search query |
required |
memory_names
|
str | list[str] | None
|
Target memory names |
None
|
query_params
|
dict | None
|
Query parameters |
None
|
to_str
|
bool
|
Return string format |
False
|
unified_retrieve
|
bool
|
Unified retrieve |
False
|
Source code in toolboxv2/mods/isaa/base/AgentUtils.py
784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 |
|
save_all_memories(path)
¶Save all memory stores to disk
Source code in toolboxv2/mods/isaa/base/AgentUtils.py
877 878 879 880 881 882 883 884 885 |
|
save_memory(name, path)
¶Save a memory store to disk
Source code in toolboxv2/mods/isaa/base/AgentUtils.py
866 867 868 869 870 871 872 873 874 875 |
|
PyEnvEval
¶
Source code in toolboxv2/mods/isaa/base/AgentUtils.py
1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 |
|
run_and_display(python_code)
¶function to eval python code
Source code in toolboxv2/mods/isaa/base/AgentUtils.py
1109 1110 1111 1112 1113 1114 |
|
anything_from_str_to_dict(data, expected_keys=None, mini_task=lambda x: '')
¶
Versucht, einen String in ein oder mehrere Dictionaries umzuwandeln. Berücksichtigt dabei die erwarteten Schlüssel und ihre Standardwerte.
Source code in toolboxv2/mods/isaa/base/AgentUtils.py
1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 |
|
complete_json_object(data, mini_task)
¶
Ruft eine Funktion auf, um einen String in das richtige Format zu bringen. Gibt das resultierende JSON-Objekt zurück, wenn die Funktion erfolgreich ist, sonst None.
Source code in toolboxv2/mods/isaa/base/AgentUtils.py
1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 |
|
find_json_objects_in_str(data)
¶
Sucht nach JSON-Objekten innerhalb eines Strings. Gibt eine Liste von JSON-Objekten zurück, die im String gefunden wurden.
Source code in toolboxv2/mods/isaa/base/AgentUtils.py
1540 1541 1542 1543 1544 1545 1546 1547 1548 |
|
get_json_from_json_str(json_str, repeat=1)
¶
Versucht, einen JSON-String in ein Python-Objekt umzuwandeln.
Wenn beim Parsen ein Fehler auftritt, versucht die Funktion, das Problem zu beheben,
indem sie das Zeichen an der Position des Fehlers durch ein Escape-Zeichen ersetzt.
Dieser Vorgang wird bis zu repeat
-mal wiederholt.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
json_str
|
str or list or dict
|
Der JSON-String, der geparst werden soll. |
required |
repeat
|
int
|
Die Anzahl der Versuche, das Parsen durchzuführen. |
1
|
Returns:
Type | Description |
---|---|
dict or None
|
Das resultierende Python-Objekt. |
Source code in toolboxv2/mods/isaa/base/AgentUtils.py
1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 |
|
parse_json_with_auto_detection(json_data)
¶
Parses JSON data, automatically detecting if a value is a JSON string and parsing it accordingly. If a value cannot be parsed as JSON, it is returned as is.
Source code in toolboxv2/mods/isaa/base/AgentUtils.py
1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 |
|
KnowledgeBase
¶
Chunk
dataclass
¶
Represents a chunk of text with its embedding and metadata
Source code in toolboxv2/mods/isaa/base/KnowledgeBase.py
28 29 30 31 32 33 34 35 |
|
ConceptAnalysis
¶
Bases: BaseModel
Represents the analysis of key concepts.
Attributes:
Name | Type | Description |
---|---|---|
key_concepts |
list[str]
|
A list of primary key concepts identified. |
relationships |
list[str]
|
A list of relationships between the identified key concepts. |
importance_hierarchy |
list[str]
|
A list that represents the hierarchical importance of the key concepts. |
Source code in toolboxv2/mods/isaa/base/KnowledgeBase.py
112 113 114 115 116 117 118 119 120 121 122 123 |
|
ConceptExtractor
¶
Handles extraction of concepts and relationships from text
Source code in toolboxv2/mods/isaa/base/KnowledgeBase.py
278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 |
|
extract_concepts(texts, metadatas)
async
¶Extract concepts from texts using concurrent processing with rate limiting. Requests are made at the specified rate while responses are processed asynchronously.
Source code in toolboxv2/mods/isaa/base/KnowledgeBase.py
286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 |
|
process_chunks(chunks)
async
¶Process all chunks in batch to extract and store concepts. Each chunk's metadata will be updated with the concept names and relationships.
Source code in toolboxv2/mods/isaa/base/KnowledgeBase.py
430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 |
|
query_concepts(query)
async
¶Query the concept graph based on natural language query
Source code in toolboxv2/mods/isaa/base/KnowledgeBase.py
448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 |
|
ConceptGraph
¶
Manages concept relationships and hierarchies
Source code in toolboxv2/mods/isaa/base/KnowledgeBase.py
169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 |
|
add_concept(concept)
¶Add or update a concept in the graph
Source code in toolboxv2/mods/isaa/base/KnowledgeBase.py
175 176 177 178 179 180 181 182 183 184 185 186 187 188 |
|
convert_to_networkx()
¶Convert ConceptGraph to NetworkX graph with layout
Source code in toolboxv2/mods/isaa/base/KnowledgeBase.py
205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 |
|
get_related_concepts(concept_name, relationship_type=None)
¶Get related concepts, optionally filtered by relationship type
Source code in toolboxv2/mods/isaa/base/KnowledgeBase.py
190 191 192 193 194 195 196 197 198 199 200 201 202 |
|
Concepts
¶
Bases: BaseModel
Represents a collection of key concepts.
Attributes:
Name | Type | Description |
---|---|---|
concepts |
List[rConcept]
|
A list of Concept instances, each representing an individual key concept. |
Source code in toolboxv2/mods/isaa/base/KnowledgeBase.py
103 104 105 106 107 108 109 110 |
|
DataModel
¶
Bases: BaseModel
The main data model that encapsulates the overall analysis.
Attributes:
Name | Type | Description |
---|---|---|
main_summary |
str
|
A Detailed overview summarizing the key findings and relations format MD string. |
concept_analysis |
ConceptAnalysis
|
An instance containing the analysis of key concepts. |
topic_insights |
TopicInsights
|
An instance containing insights regarding the topics. |
relevance_assessment |
RelevanceAssessment
|
An instance assessing the relevance and alignment of the query. |
Source code in toolboxv2/mods/isaa/base/KnowledgeBase.py
154 155 156 157 158 159 160 161 162 163 164 165 166 167 |
|
DynamicRateLimiter
¶
Source code in toolboxv2/mods/isaa/base/KnowledgeBase.py
258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 |
|
acquire()
async
¶Acquire permission to make a request
Source code in toolboxv2/mods/isaa/base/KnowledgeBase.py
267 268 269 270 271 272 273 274 275 |
|
update_rate(requests_per_second)
¶Update rate limit dynamically
Source code in toolboxv2/mods/isaa/base/KnowledgeBase.py
263 264 265 |
|
GraphVisualizer
¶
Source code in toolboxv2/mods/isaa/base/KnowledgeBase.py
234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 |
|
visualize(nx_graph, output_file='concept_graph.html', get_output=False)
staticmethod
¶Create interactive visualization using PyVis
Source code in toolboxv2/mods/isaa/base/KnowledgeBase.py
235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 |
|
KnowledgeBase
¶
Source code in toolboxv2/mods/isaa/base/KnowledgeBase.py
605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 |
|
__init__(embedding_dim=768, similarity_threshold=0.61, batch_size=64, n_clusters=4, deduplication_threshold=0.85, model_name=os.getenv('DEFAULTMODELSUMMERY'), embedding_model=os.getenv('DEFAULTMODELEMBEDDING'), vis_class='FaissVectorStore', vis_kwargs=None, requests_per_second=85.0, chunk_size=3600, chunk_overlap=130, separator='\n')
¶Initialize the knowledge base with given parameters
Source code in toolboxv2/mods/isaa/base/KnowledgeBase.py
606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 |
|
add_data(texts, metadata=None)
async
¶Enhanced version with smart splitting and clustering
Source code in toolboxv2/mods/isaa/base/KnowledgeBase.py
836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 |
|
compute_hash(text)
staticmethod
¶Compute SHA-256 hash of text
Source code in toolboxv2/mods/isaa/base/KnowledgeBase.py
679 680 681 682 |
|
forget_irrelevant(irrelevant_concepts, similarity_threshold=None)
async
¶Remove chunks similar to irrelevant concepts Returns: Number of chunks removed
Source code in toolboxv2/mods/isaa/base/KnowledgeBase.py
938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 |
|
load(path)
classmethod
¶Load a complete knowledge base from disk, including all sub-components
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path
|
str
|
Path from where to load the knowledge base |
required |
Returns:
Name | Type | Description |
---|---|---|
KnowledgeBase |
KnowledgeBase
|
A fully restored knowledge base instance |
Source code in toolboxv2/mods/isaa/base/KnowledgeBase.py
1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 |
|
query_concepts(query)
async
¶Query concepts extracted from the knowledge base
Source code in toolboxv2/mods/isaa/base/KnowledgeBase.py
1481 1482 1483 |
|
retrieve(query='', query_embedding=None, k=5, min_similarity=0.2, include_connected=True)
async
¶Enhanced retrieval with connected information
Source code in toolboxv2/mods/isaa/base/KnowledgeBase.py
898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 |
|
retrieve_with_overview(query, query_embedding=None, k=5, min_similarity=0.2, max_sentences=5, cross_ref_depth=2, max_cross_refs=10)
async
¶Enhanced retrieval with better cross-reference handling
Source code in toolboxv2/mods/isaa/base/KnowledgeBase.py
1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 |
|
save(path)
¶Save the complete knowledge base to disk, including all sub-components
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path
|
str
|
Path where the knowledge base will be saved |
required |
Source code in toolboxv2/mods/isaa/base/KnowledgeBase.py
1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 |
|
unified_retrieve(query, k=5, min_similarity=0.2, cross_ref_depth=2, max_cross_refs=10, max_sentences=10)
async
¶Unified retrieval function that combines concept querying, retrieval with overview, and basic retrieval, then generates a comprehensive summary using LLM.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
query
|
str
|
Search query string |
required |
k
|
int
|
Number of primary results to retrieve |
5
|
min_similarity
|
float
|
Minimum similarity threshold for retrieval |
0.2
|
cross_ref_depth
|
int
|
Depth for cross-reference search |
2
|
max_cross_refs
|
int
|
Maximum number of cross-references per topic |
10
|
max_sentences
|
int
|
Maximum number Sentences in the main summary text |
10
|
Returns:
Type | Description |
---|---|
dict[str, Any]
|
Dictionary containing comprehensive results including summary and details |
Source code in toolboxv2/mods/isaa/base/KnowledgeBase.py
1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 |
|
RelevanceAssessment
¶
Bases: BaseModel
Represents an assessment of the relevance of the data in relation to a specific query.
Attributes:
Name | Type | Description |
---|---|---|
query_alignment |
float
|
A float representing the alignment between the query and the data. |
confidence_score |
float
|
A float indicating the confidence level in the alignment. |
coverage_analysis |
str
|
A textual description analyzing the data coverage. |
Source code in toolboxv2/mods/isaa/base/KnowledgeBase.py
140 141 142 143 144 145 146 147 148 149 150 151 |
|
RetrievalResult
dataclass
¶
Structure for organizing retrieval results
Source code in toolboxv2/mods/isaa/base/KnowledgeBase.py
38 39 40 41 42 43 |
|
TConcept
¶
Bases: BaseModel
Represents the criteria or target parameters for concept selection and filtering.
Attributes:
Name | Type | Description |
---|---|---|
min_importance |
float
|
The minimum importance score a concept must have to be considered. |
target_concepts |
List[str]
|
A list of names of target concepts to focus on. |
relationship_types |
List[str]
|
A list of relationship types to be considered in the analysis. |
categories |
List[str]
|
A list of concept categories to filter or group the concepts. |
Source code in toolboxv2/mods/isaa/base/KnowledgeBase.py
87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
|
TextSplitter
¶
Source code in toolboxv2/mods/isaa/base/KnowledgeBase.py
528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 |
|
approximate(text_len)
¶Approximate the number of chunks and average chunk size for a given text length
Parameters:
Name | Type | Description | Default |
---|---|---|---|
text_len
|
int
|
Length of the text to be split |
required |
Returns:
Type | Description |
---|---|
float
|
Tuple[int, int]: (number_of_chunks, approximate_chunk_size) |
Source code in toolboxv2/mods/isaa/base/KnowledgeBase.py
539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 |
|
split_text(text)
¶Split text into chunks with overlap
Source code in toolboxv2/mods/isaa/base/KnowledgeBase.py
568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 |
|
TopicInsights
¶
Bases: BaseModel
Represents insights related to various topics.
Attributes:
Name | Type | Description |
---|---|---|
primary_topics |
list[str]
|
A list of main topics addressed. |
cross_references |
list[str]
|
A list of cross-references that connect different topics. |
knowledge_gaps |
list[str]
|
A list of identified gaps in the current knowledge. |
Source code in toolboxv2/mods/isaa/base/KnowledgeBase.py
126 127 128 129 130 131 132 133 134 135 136 137 |
|
rConcept
¶
Bases: BaseModel
Represents a key concept with its relationships and associated metadata.
Attributes:
Name | Type | Description |
---|---|---|
name |
str
|
The name of the concept. |
category |
str
|
The category of the concept (e.g., 'technical', 'domain', 'method', etc.). |
relationships |
Dict[str, List[str]]
|
A mapping where each key is a type of relationship and the value is a list of related concept names. |
importance_score |
float
|
A numerical score representing the importance or relevance of the concept. |
context_snippets |
List[str]
|
A list of text snippets providing context where the concept appears. |
Source code in toolboxv2/mods/isaa/base/KnowledgeBase.py
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
|
normalize_vectors(vectors)
¶
Normalize vectors to unit length
Source code in toolboxv2/mods/isaa/base/KnowledgeBase.py
53 54 55 56 |
|
VectorStores
¶
Vector store implementations for the toolboxv2 system.
taichiNumpyNumbaVectorStores
¶
NumpyVectorStore
¶
Bases: AbstractVectorStore
Source code in toolboxv2/mods/isaa/base/VectorStores/taichiNumpyNumbaVectorStores.py
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 |
|
types
¶
AbstractVectorStore
¶
Bases: ABC
Abstract base class for vector stores
Source code in toolboxv2/mods/isaa/base/VectorStores/types.py
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
|
add_embeddings(embeddings, chunks)
abstractmethod
¶Add embeddings and their corresponding chunks to the store
Source code in toolboxv2/mods/isaa/base/VectorStores/types.py
20 21 22 23 |
|
clear()
abstractmethod
¶Clear all data from the store
Source code in toolboxv2/mods/isaa/base/VectorStores/types.py
40 41 42 43 |
|
load(data)
abstractmethod
¶Load the vector store from disk
Source code in toolboxv2/mods/isaa/base/VectorStores/types.py
35 36 37 38 |
|
rebuild_index()
abstractmethod
¶Optional for faster searches
Source code in toolboxv2/mods/isaa/base/VectorStores/types.py
45 46 47 48 |
|
save()
abstractmethod
¶Save the vector store to disk
Source code in toolboxv2/mods/isaa/base/VectorStores/types.py
30 31 32 33 |
|
search(query_embedding, k=5, min_similarity=0.7)
abstractmethod
¶Search for similar vectors
Source code in toolboxv2/mods/isaa/base/VectorStores/types.py
25 26 27 28 |
|
Chunk
dataclass
¶Represents a chunk of text with its embedding and metadata
Source code in toolboxv2/mods/isaa/base/VectorStores/types.py
7 8 9 10 11 12 13 14 |
|
chainUi
¶
delete_task_chain(app, request=None)
async
¶
Deletes a task chain.
Source code in toolboxv2/mods/isaa/chainUi.py
146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 |
|
get_task_chain_definition(app, request=None)
async
¶
Gets the definition of a specific task chain, including its Drawflow export if available.
Source code in toolboxv2/mods/isaa/chainUi.py
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
|
get_task_chain_editor_page_drawflow(app, request=None)
async
¶
Serves the HTML page for the Drawflow-based Task Chain Editor.
Source code in toolboxv2/mods/isaa/chainUi.py
239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 |
|
get_task_chain_list(app, request=None)
async
¶
Lists all available global task chains.
Source code in toolboxv2/mods/isaa/chainUi.py
35 36 37 38 39 40 41 42 43 44 |
|
initialize_module(app)
¶
Initializes the ISAA ChainUI module and registers its UI with CloudM.
Source code in toolboxv2/mods/isaa/chainUi.py
259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 |
|
run_chain_visualized(app, request=None, data=None)
async
¶
Executes a specified task chain with the given input.
Source code in toolboxv2/mods/isaa/chainUi.py
183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 |
|
save_task_chain_definition(app, request=None, data=None)
async
¶
Saves a task chain definition. Expects logical tasks and optional Drawflow export.
Source code in toolboxv2/mods/isaa/chainUi.py
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 |
|
extras
¶
adapter
¶
LiteLLM LLM Interface Module¶
This module provides interfaces for interacting with LiteLLM's language models, including text generation and embedding capabilities.
Author: Lightrag Team Created: 2025-02-04 License: MIT License Version: 1.0.0
Change Log: - 1.0.0 (2025-02-04): Initial LiteLLM release * Ported OpenAI logic to use litellm async client * Updated error types and environment variable names * Preserved streaming and embedding support
Dependencies
- litellm
- numpy
- pipmaster
- Python >= 3.10
Usage
from llm_interfaces.litellm import litellm_complete, litellm_embed
litellm_complete(prompt, system_prompt=None, history_messages=None, keyword_extraction=False, model_name='groq/gemma2-9b-it', **kwargs)
async
¶
Public completion interface using the model name specified in the global configuration. Optionally extracts keywords if requested.
Source code in toolboxv2/mods/isaa/extras/adapter.py
135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 |
|
litellm_complete_if_cache(model, prompt, system_prompt=None, history_messages=None, base_url=None, api_key=None, **kwargs)
async
¶
Core function to query the LiteLLM model. It builds the message context, invokes the completion API, and returns either a complete result string or an async iterator for streaming responses.
Source code in toolboxv2/mods/isaa/extras/adapter.py
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 |
|
litellm_embed(texts, model='gemini/text-embedding-004', base_url=None, api_key=None)
async
¶
Generates embeddings for the given list of texts using LiteLLM.
Source code in toolboxv2/mods/isaa/extras/adapter.py
159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 |
|
filter
¶
filter_relevant_texts(query, texts, fuzzy_threshold=70, semantic_threshold=0.75, model=None)
¶
Filters a list of texts based on their relevance to the query. It first uses a fuzzy matching score and, if that score is below the threshold, it then checks the semantic similarity.
:param query: The query string. :param texts: List of page texts. :param fuzzy_threshold: Fuzzy matching score threshold (0-100). :param semantic_threshold: Semantic similarity threshold (0.0-1.0). :param model: A preloaded SentenceTransformer model (if None, one will be loaded). :return: Filtered list of texts deemed relevant.
Source code in toolboxv2/mods/isaa/extras/filter.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
|
modes
¶
generate_prompt(subject, context='', additional_requirements=None)
¶
Generates a prompt based on the given subject, with optional context and additional requirements.
Parameters: - subject (str): The main subject for the prompt. - context (str): Optional additional context to tailor the prompt. - additional_requirements (Dict[str, Any]): Optional additional parameters or requirements for the prompt.
Returns: - str: A crafted prompt.
Source code in toolboxv2/mods/isaa/extras/modes.py
177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 |
|
toolboxv2.flows_dict(s='.py', remote=False, dir_path=None, flows_dict_=None)
¶
Source code in toolboxv2/flows/__init__.py
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
|
toolboxv2.TBEF
¶
Automatic generated by ToolBox v = 0.1.21