mirror of
https://github.com/hwchase17/langchain.git
synced 2025-09-05 21:12:48 +00:00
[docs]: standardize tool docstrings (#25351)
This commit is contained in:
@@ -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.
|
||||
|
Reference in New Issue
Block a user