File size: 1,339 Bytes
a622ede
 
 
 
 
 
 
cdf6171
a622ede
 
 
 
 
 
 
 
cdf6171
 
 
 
 
 
 
 
 
 
8dd9efe
cdf6171
 
 
 
 
8dd9efe
cdf6171
 
 
 
 
 
 
8dd9efe
cdf6171
 
 
 
 
8dd9efe
cdf6171
 
 
a622ede
 
 
 
 
 
 
 
 
 
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
#!/usr/bin/env python3
"""File-based function tool entrypoints for the production Monty runtime."""

from __future__ import annotations

import sys
from pathlib import Path
from typing import Any

_PACKAGE_DIR = Path(__file__).resolve().parent
_ROOT_DIR = _PACKAGE_DIR.parent
for candidate in (_ROOT_DIR, _PACKAGE_DIR):
    candidate_str = str(candidate)
    if candidate_str not in sys.path:
        sys.path.insert(0, candidate_str)

from monty_api import (  # noqa: E402
    HELPER_EXTERNALS,
    hf_hub_query as _hf_hub_query,
    hf_hub_query_raw as _hf_hub_query_raw,
    main,
)


async def hf_hub_query(
    code: str,
    query: str | None = None,
    max_calls: int | None = None,
    timeout_sec: int | None = None,
) -> dict[str, Any]:
    return await _hf_hub_query(
        code=code,
        query=query,
        max_calls=max_calls,
        timeout_sec=timeout_sec,
    )


async def hf_hub_query_raw(
    code: str,
    query: str | None = None,
    max_calls: int | None = None,
    timeout_sec: int | None = None,
) -> Any:
    return await _hf_hub_query_raw(
        code=code,
        query=query,
        max_calls=max_calls,
        timeout_sec=timeout_sec,
    )

__all__ = [
    "HELPER_EXTERNALS",
    "hf_hub_query",
    "hf_hub_query_raw",
    "main",
]

if __name__ == "__main__":
    raise SystemExit(main())