llama-index tools code_interpreter integration
Project description
Code Interpreter Tool
This tool can be used to run python scripts and capture the results of stdout and stderr
WARNING: This tool provides the Agent access to the subprocess.run
command.
Arbitrary code execution is possible on the machine running this tool.
This tool is not recommended to be used in a production setting, and would require heavy sandboxing or virtual machines
Usage
Here's an example usage of the CodeInterpreterToolSpec.
from llama_index.tools.code_interpreter import CodeInterpreterToolSpec
from llama_index.agent.openai import OpenAIAgent
code_spec = CodeInterpreterToolSpec()
agent = OpenAIAgent.from_tools(code_spec.to_tool_list())
# Prime the agent to use the tool
agent.chat(
"Can you help me write some python code to pass to the code_interpreter tool"
)
agent.chat(
"write a python function to calculate volume of a sphere with radius 4.3cm"
)
The tools available are:
code_interpreter
: A tool to evaluate a python script
This loader is designed to be used as a way to load data as a Tool in a Agent.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file llama_index_tools_code_interpreter-0.3.0.tar.gz
.
File metadata
- Download URL: llama_index_tools_code_interpreter-0.3.0.tar.gz
- Upload date:
- Size: 2.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.11.10 Darwin/22.3.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3c373e285e86ccf529a4630688ab55ea1a026e74666cfa911762fa4eb85b5ee6 |
|
MD5 | 49952a4ed66355bac6b494759de516d6 |
|
BLAKE2b-256 | 24327fa57ab18b736cca96729d28d227a8ccb82cd6be95660d3d7dd476df7a10 |
File details
Details for the file llama_index_tools_code_interpreter-0.3.0-py3-none-any.whl
.
File metadata
- Download URL: llama_index_tools_code_interpreter-0.3.0-py3-none-any.whl
- Upload date:
- Size: 2.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.11.10 Darwin/22.3.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1750f37a7552271c4ddb81bc3feb775117e8d552431b4e6326af6abbc5e5466b |
|
MD5 | cd6292061ec896994df08380943f8a14 |
|
BLAKE2b-256 | cb00652db9f35b63c31aceb16ac80cc3d0283c3df3eee9ad3c531bde72d7d15e |