[docs]: standardize tool docstrings (#25351)

This commit is contained in:
Isaac Francisco
2024-08-13 16:10:00 -07:00
committed by GitHub
parent d5b548b4ce
commit e0bbb81d04
7 changed files with 196 additions and 12 deletions

View File

@@ -19,7 +19,43 @@ class ExecPythonInput(BaseModel):
class ExecPython(BaseTool):
"""A tool implementation to execute Python via Riza's Code Interpreter API."""
"""Riza Code tool.
Setup:
Install ``langchain-community`` and ``rizaio`` and set environment variable ``RIZA_API_KEY``.
.. code-block:: bash
pip install -U langchain-community rizaio
export RIZA_API_KEY="your-api-key"
Instantiation:
.. code-block:: python
from langchain_community.tools.riza.command import ExecPython
tool = ExecPython()
Invocation with args:
.. code-block:: python
tool.invoke("x = 5; print(x)")
.. code-block:: python
'5\\n'
Invocation with ToolCall:
.. code-block:: python
tool.invoke({"args": {"code":"x = 5; print(x)"}, "id": "1", "name": tool.name, "type": "tool_call"})
.. code-block:: python
tool.invoke({"args": {"code":"x = 5; print(x)"}, "id": "1", "name": tool.name, "type": "tool_call"})
""" # noqa: E501
name: str = "riza_exec_python"
description: str = """Execute Python code to solve problems.