A simple package for function calling package. Easy to use and straight forward.
pip install git+https://github.com/electro199/simple-agents.git
Adding tools
from function_caller import tool_func
@tool_func
def print_to_console(msg: str) -> None:
"print the given msg(str) to console"
print(msg)
you can you get relevant tools
Tools=get_relevant_tools("Can you print in console ?")
With ollama and tools usage :
import ollama
from simple_agents.tools_generator import get_relevant_tools, tools, tool_func, call_tools
@tool_func
def print_to_console(msg: str) -> str:
"print the given msg(str) to console"
print(msg)
return "print_to_console" + msg
client = ollama.Client()
chat = "Can you print in console ?"
response = client.chat(
model="llama3.1",
messages=messages,
tools=get_relevant_tools(chat),
options=ollama.Options(temperature=0.5),
)
if response["message"].get("tool_calls"):
print(call_tools(response["message"]["tool_calls"]))