mirror of
https://github.com/hwchase17/langchain.git
synced 2025-07-14 00:47:27 +00:00
[simple] updated annotation in load_tools.py (#3544)
- added a few missing annotation for complex local variables. - auto formatted. - I also went through all other files in agent directory. no seeing any other missing piece. (there are several prompt strings not annotated, but I think it’s trivial. Also adding annotation will make it harder to read in terms of indents.) Anyway, I think this is the last PR in agent/annotation.
This commit is contained in:
parent
d6d697a41b
commit
64501329ab
@ -2,7 +2,7 @@
|
|||||||
"""Load tools."""
|
"""Load tools."""
|
||||||
import warnings
|
import warnings
|
||||||
from typing import Any, Dict, List, Optional, Callable, Tuple
|
from typing import Any, Dict, List, Optional, Callable, Tuple
|
||||||
from mypy_extensions import KwArg
|
from mypy_extensions import Arg, KwArg
|
||||||
|
|
||||||
from langchain.agents.tools import Tool
|
from langchain.agents.tools import Tool
|
||||||
from langchain.callbacks.base import BaseCallbackManager
|
from langchain.callbacks.base import BaseCallbackManager
|
||||||
@ -74,7 +74,7 @@ def _get_terminal() -> BaseTool:
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
_BASE_TOOLS = {
|
_BASE_TOOLS: Dict[str, Callable[[], BaseTool]] = {
|
||||||
"python_repl": _get_python_repl,
|
"python_repl": _get_python_repl,
|
||||||
"requests": _get_tools_requests_get, # preserved for backwards compatability
|
"requests": _get_tools_requests_get, # preserved for backwards compatability
|
||||||
"requests_get": _get_tools_requests_get,
|
"requests_get": _get_tools_requests_get,
|
||||||
@ -120,7 +120,7 @@ def _get_open_meteo_api(llm: BaseLLM) -> BaseTool:
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
_LLM_TOOLS = {
|
_LLM_TOOLS: Dict[str, Callable[[BaseLLM], BaseTool]] = {
|
||||||
"pal-math": _get_pal_math,
|
"pal-math": _get_pal_math,
|
||||||
"pal-colored-objects": _get_pal_colored_objects,
|
"pal-colored-objects": _get_pal_colored_objects,
|
||||||
"llm-math": _get_llm_math,
|
"llm-math": _get_llm_math,
|
||||||
@ -226,7 +226,9 @@ def _get_human_tool(**kwargs: Any) -> BaseTool:
|
|||||||
return HumanInputRun(**kwargs)
|
return HumanInputRun(**kwargs)
|
||||||
|
|
||||||
|
|
||||||
_EXTRA_LLM_TOOLS = {
|
_EXTRA_LLM_TOOLS: Dict[
|
||||||
|
str, Tuple[Callable[[Arg(BaseLLM, "llm"), KwArg(Any)], BaseTool], List[str]]
|
||||||
|
] = {
|
||||||
"news-api": (_get_news_api, ["news_api_key"]),
|
"news-api": (_get_news_api, ["news_api_key"]),
|
||||||
"tmdb-api": (_get_tmdb_api, ["tmdb_bearer_token"]),
|
"tmdb-api": (_get_tmdb_api, ["tmdb_bearer_token"]),
|
||||||
"podcast-api": (_get_podcast_api, ["listen_api_key"]),
|
"podcast-api": (_get_podcast_api, ["listen_api_key"]),
|
||||||
|
Loading…
Reference in New Issue
Block a user