Skip to main content
Version: 1.0

aixplain.modules.agent.tool.python_interpreter_tool

__author__

Copyright 2024 The aiXplain SDK authors

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Author: Lucas Pavanelli and Thiago Castro Ferreira Date: May 16th 2024 Description: Agentification Class

PythonInterpreterTool Objects

class PythonInterpreterTool(Tool)

[view_source]

A tool that provides a Python shell for executing Python commands.

This tool allows direct execution of Python code within the aiXplain platform. It acts as an interface to a Python interpreter, enabling dynamic code execution and computation.

Attributes:

  • name Text - Always set to "Python Interpreter".
  • description Text - Description of the tool's functionality.
  • status AssetStatus - The current status of the tool (ONBOARDED or DRAFT).

__init__

def __init__(**additional_info) -> None

[view_source]

Initialize a new PythonInterpreterTool instance.

This initializes a Python interpreter tool with a fixed name and description. The tool is set to ONBOARDED status by default.

Arguments:

  • **additional_info - Additional keyword arguments for tool configuration.

to_dict

def to_dict()

[view_source]

Convert the tool instance to a dictionary representation.

Returns:

  • dict - A dictionary containing the tool's configuration with keys:
    • description: The tool's description
    • type: Always "utility"
    • utility: Always "custom_python_code"

validate

def validate()

[view_source]

Validate the tool's configuration.

This is a placeholder method as the Python interpreter tool has a fixed configuration that doesn't require validation.

__repr__

def __repr__() -> Text

[view_source]

Return a string representation of the tool.

Returns:

  • Text - A string in the format "PythonInterpreterTool()".

deploy

def deploy()

[view_source]

Deploy the Python interpreter tool.

This is a placeholder method as the Python interpreter tool is automatically available and doesn't require explicit deployment.