mirror of
https://github.com/Mintplex-Labs/langchain-python.git
synced 2026-07-21 00:35:23 -04:00
84ea17b786
Move tool validation to each implementation of the Agent. Another alternative would be to adjust the `_validate_tools()` signature to accept the output parser (and format instructions) and add logic there. Something like `parser.outputs_structured_actions(format_instructions)` But don't think that's needed right now.
13 lines
384 B
Python
13 lines
384 B
Python
from typing import Sequence
|
|
|
|
from langchain.tools.base import BaseTool
|
|
|
|
|
|
def validate_tools_single_input(class_name: str, tools: Sequence[BaseTool]) -> None:
|
|
"""Validate tools for single input."""
|
|
for tool in tools:
|
|
if not tool.is_single_input:
|
|
raise ValueError(
|
|
f"{class_name} does not support multi-input tool {tool.name}."
|
|
)
|