mirror of
https://github.com/hwchase17/langchain.git
synced 2025-06-22 06:39:52 +00:00
community[patch],core[minor]: Move BaseToolKit to core.tools (#20669)
This commit is contained in:
parent
ce23f8293a
commit
38adbfdf34
@ -1,15 +1,4 @@
|
|||||||
"""Toolkits for agents."""
|
"""Toolkits for agents."""
|
||||||
from abc import ABC, abstractmethod
|
from langchain_core.tools import BaseToolkit
|
||||||
from typing import List
|
|
||||||
|
|
||||||
from langchain_core.pydantic_v1 import BaseModel
|
__all__ = ["BaseToolkit"]
|
||||||
|
|
||||||
from langchain_community.tools import BaseTool
|
|
||||||
|
|
||||||
|
|
||||||
class BaseToolkit(BaseModel, ABC):
|
|
||||||
"""Base Toolkit representing a collection of related tools."""
|
|
||||||
|
|
||||||
@abstractmethod
|
|
||||||
def get_tools(self) -> List[BaseTool]:
|
|
||||||
"""Get the tools in the toolkit."""
|
|
||||||
|
@ -22,7 +22,7 @@ from __future__ import annotations
|
|||||||
import inspect
|
import inspect
|
||||||
import uuid
|
import uuid
|
||||||
import warnings
|
import warnings
|
||||||
from abc import abstractmethod
|
from abc import ABC, abstractmethod
|
||||||
from functools import partial
|
from functools import partial
|
||||||
from inspect import signature
|
from inspect import signature
|
||||||
from typing import Any, Awaitable, Callable, Dict, List, Optional, Tuple, Type, Union
|
from typing import Any, Awaitable, Callable, Dict, List, Optional, Tuple, Type, Union
|
||||||
@ -1038,3 +1038,11 @@ args: {"expression": {"type": "string"}}
|
|||||||
args_schema = str(tool.args)
|
args_schema = str(tool.args)
|
||||||
tool_strings.append(f"{tool.name}: {tool.description}, args: {args_schema}")
|
tool_strings.append(f"{tool.name}: {tool.description}, args: {args_schema}")
|
||||||
return "\n".join(tool_strings)
|
return "\n".join(tool_strings)
|
||||||
|
|
||||||
|
|
||||||
|
class BaseToolkit(BaseModel, ABC):
|
||||||
|
"""Base Toolkit representing a collection of related tools."""
|
||||||
|
|
||||||
|
@abstractmethod
|
||||||
|
def get_tools(self) -> List[BaseTool]:
|
||||||
|
"""Get the tools in the toolkit."""
|
||||||
|
Loading…
Reference in New Issue
Block a user