https://github.com/electro199/simple-agents
https://github.com/electro199/simple-agents
Last synced: about 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/electro199/simple-agents
- Owner: electro199
- License: mit
- Created: 2024-07-29T20:44:12.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-08-24T21:57:33.000Z (almost 2 years ago)
- Last Synced: 2024-08-24T22:44:49.568Z (almost 2 years ago)
- Language: Python
- Size: 15.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# simple-agents
A simple package for function calling package. Easy to use and straight forward.
# Installation
```bash
pip install git+https://github.com/electro199/simple-agents.git
```
## Usage
Adding tools
```py
from function_caller import tool_func
@tool_func
def print_to_console(msg: str) -> None:
"print the given msg(str) to console"
print(msg)
```
## Retriving Tools
you can you get relevant tools
```py
Tools=get_relevant_tools("Can you print in console ?")
```
With ollama and tools usage :
```py
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"]))
```