No project description provided
Project description
Agentscript.rs
A Rust based interpreter for the Agentscript language.
Syntax
Invoke
Invoke a tool based on the ToolsV1 protocol.
An example of invoking the Translator
tool to translate text from English to Spanish
We need to do translation <invoke tool="Translator" action="translate" parameters={"text": "Hello", "options": {"from": "en", "to": "es"}} />
Python API
pip install agentscript
Usage
Execute the tranlator tool from python
from agentscript import Interpreter
from agent_tools import Tool, action
# Create a fake translator tool
class Translator(Tool):
"""A fake translator tool"""
@action
def translate(self, text: str, options: Dict[str, Any]) -> str:
return "Hola"
# Create the interpreter supplying our translator tool
interpreter = Interpreter(tools=[Translator()])
# Parse the script, find the tool, and execute it
interpreter.execute("""
We need to do translation <invoke tool="Translator" action="translate" parameters={"text": "Hello", "options": {"from": "en", "to": "es"}} />
""")
# Show the past invocations with the results
print(interpreter.invocations())
Devloping
When changing the rust code
make develop-rs
Will complile it and make the package available to the Python project.
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
agentscript-0.1.0.tar.gz
(30.9 kB
view hashes)
Built Distributions
Close
Hashes for agentscript-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e6cfcbc0f7d6fb767b9b679f22d369f00dc47ad2deb24e404db196627ecefd03 |
|
MD5 | 2137283f3c628a2ffce1612e7dafcd68 |
|
BLAKE2b-256 | a0c17fec306fddebb491929849b0fb02f8938595d6532cf271309f10d2b13712 |
Close
Hashes for agentscript-0.1.0-cp310-cp310-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 09f86a58ea7e500b082fc221477645fb0b428fdd6120086fd8ff5606092506b9 |
|
MD5 | 14b20457db912a083ffed61c63a36fca |
|
BLAKE2b-256 | 438f9702d2f5b28fdfe77e8253a03909cc31cdedb7b82eee70ade8d52cfc2927 |