mirror of
https://github.com/hwchase17/langchain
synced 2024-11-10 01:10:59 +00:00
community: docstrings toolkits
(#23616)
Added missed docstrings. Formatted docstrings to the consistent form.
This commit is contained in:
parent
19eb82e68b
commit
e4caa41aa9
@ -38,7 +38,17 @@ class AINetworkToolkit(BaseToolkit):
|
||||
|
||||
@root_validator(pre=True)
|
||||
def set_interface(cls, values: dict) -> dict:
|
||||
"""Set the interface if not provided."""
|
||||
"""Set the interface if not provided.
|
||||
|
||||
If the interface is not provided, attempt to authenticate with the
|
||||
network using the network value provided.
|
||||
|
||||
Args:
|
||||
values: The values to validate.
|
||||
|
||||
Returns:
|
||||
The validated values.
|
||||
"""
|
||||
if not values.get("interface"):
|
||||
values["interface"] = authenticate(network=values.get("network", "testnet"))
|
||||
return values
|
||||
|
@ -27,10 +27,13 @@ class ConneryToolkit(BaseToolkit):
|
||||
"""
|
||||
Validate the attributes of the ConneryToolkit class.
|
||||
|
||||
Parameters:
|
||||
Args:
|
||||
values (dict): The arguments to validate.
|
||||
Returns:
|
||||
dict: The validated arguments.
|
||||
|
||||
Raises:
|
||||
ValueError: If the 'tools' attribute is not set
|
||||
"""
|
||||
|
||||
if not values.get("tools"):
|
||||
@ -45,7 +48,7 @@ class ConneryToolkit(BaseToolkit):
|
||||
|
||||
Parameters:
|
||||
connery_service (ConneryService): The Connery Service
|
||||
to to get the list of Connery Actions.
|
||||
to get the list of Connery Actions.
|
||||
Returns:
|
||||
ConneryToolkit: The Connery Toolkit.
|
||||
"""
|
||||
|
@ -41,6 +41,15 @@ class GitLabToolkit(BaseToolkit):
|
||||
def from_gitlab_api_wrapper(
|
||||
cls, gitlab_api_wrapper: GitLabAPIWrapper
|
||||
) -> "GitLabToolkit":
|
||||
"""Create a GitLabToolkit from a GitLabAPIWrapper.
|
||||
|
||||
Args:
|
||||
gitlab_api_wrapper: GitLabAPIWrapper. The GitLab API wrapper.
|
||||
|
||||
Returns:
|
||||
GitLabToolkit. The GitLab toolkit.
|
||||
"""
|
||||
|
||||
operations: List[Dict] = [
|
||||
{
|
||||
"mode": "get_issues",
|
||||
|
@ -587,13 +587,17 @@ def load_huggingface_tool(
|
||||
|
||||
Args:
|
||||
task_or_repo_id: Task or model repo id.
|
||||
model_repo_id: Optional model repo id.
|
||||
token: Optional token.
|
||||
model_repo_id: Optional model repo id. Defaults to None.
|
||||
token: Optional token. Defaults to None.
|
||||
remote: Optional remote. Defaults to False.
|
||||
**kwargs:
|
||||
**kwargs: Additional keyword arguments.
|
||||
|
||||
Returns:
|
||||
A tool.
|
||||
|
||||
Raises:
|
||||
ImportError: If the required libraries are not installed.
|
||||
NotImplementedError: If multimodal outputs or inputs are not supported.
|
||||
"""
|
||||
try:
|
||||
from transformers import load_tool
|
||||
@ -649,7 +653,8 @@ def load_tools(
|
||||
|
||||
Args:
|
||||
tool_names: name of tools to load.
|
||||
llm: An optional language model, may be needed to initialize certain tools.
|
||||
llm: An optional language model may be needed to initialize certain tools.
|
||||
Defaults to None.
|
||||
callbacks: Optional callback manager or list of callback handlers.
|
||||
If not provided, default global callback manager will be used.
|
||||
allow_dangerous_tools: Optional flag to allow dangerous tools.
|
||||
@ -661,9 +666,17 @@ def load_tools(
|
||||
Please note that this list may not be fully exhaustive.
|
||||
It is your responsibility to understand which tools
|
||||
you're using and the risks associated with them.
|
||||
Defaults to False.
|
||||
**kwargs: Additional keyword arguments.
|
||||
|
||||
Returns:
|
||||
List of tools.
|
||||
|
||||
Raises:
|
||||
ValueError: If the tool name is unknown.
|
||||
ValueError: If the tool requires an LLM to be provided.
|
||||
ValueError: If the tool requires some parameters that were not provided.
|
||||
ValueError: If the tool is a dangerous tool and allow_dangerous_tools is False.
|
||||
"""
|
||||
tools = []
|
||||
callbacks = _handle_callbacks(
|
||||
|
@ -288,6 +288,9 @@ class OpenAIAssistantV2Runnable(OpenAIAssistantRunnable):
|
||||
Union[List[OpenAIAssistantAction], OpenAIAssistantFinish]. Otherwise,
|
||||
will return OpenAI types
|
||||
Union[List[ThreadMessage], List[RequiredActionFunctionToolCall]].
|
||||
|
||||
Raises:
|
||||
BaseException: If an error occurs during the invocation.
|
||||
"""
|
||||
|
||||
config = ensure_config(config)
|
||||
|
Loading…
Reference in New Issue
Block a user