Skip to content

Commit

Permalink
community[patch],core[minor]: Move BaseToolKit to core.tools (#20669)
Browse files Browse the repository at this point in the history
  • Loading branch information
eyurtsev authored Apr 22, 2024
1 parent ce23f82 commit 38adbfd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 14 deletions.
15 changes: 2 additions & 13 deletions libs/community/langchain_community/agent_toolkits/base.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,4 @@
"""Toolkits for agents."""
from abc import ABC, abstractmethod
from typing import List
from langchain_core.tools import BaseToolkit

from langchain_core.pydantic_v1 import BaseModel

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."""
__all__ = ["BaseToolkit"]
10 changes: 9 additions & 1 deletion libs/core/langchain_core/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import inspect
import uuid
import warnings
from abc import abstractmethod
from abc import ABC, abstractmethod
from functools import partial
from inspect import signature
from typing import Any, Awaitable, Callable, Dict, List, Optional, Tuple, Type, Union
Expand Down Expand Up @@ -1038,3 +1038,11 @@ def render_text_description_and_args(tools: List[BaseTool]) -> str:
args_schema = str(tool.args)
tool_strings.append(f"{tool.name}: {tool.description}, args: {args_schema}")
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."""

0 comments on commit 38adbfd

Please sign in to comment.