Skip to content

Simple agent framework using Ollama tool calling

Notifications You must be signed in to change notification settings

foziaShareen/easy-agent

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

EasyAgent

Ollama tool calling agent framework.

Using this framework you can run a single agent with lightweight tools framework.

Ollama: Tool support (blogpost)

Usage

import datetime
from args_description import describe_args

@describe_args()
def now() -> str:
    """Call this function when you want to get current date and time."""
    return datetime.datetime.now().isoformat()

ea = EasyAgent(
    model="llama3.1:8b",
    tools=[now],
    system=None,
)

ea.ask("What is the date today?")
# 'The current date is July 26, 2024.'

ea.tick("What is the date today?")
# {'content': '',
#  'role': 'assistant',
#  'tool_calls': [{'function': {'arguments': {}, 'name': 'now'}}]}

Installation

python3 -m venv ./venv
source ./venv/bin/activate
pip install -r requirements.txt
python3 ./src/launchers/hello.py

Calendar agent (WIP)

To test calendar features:

  • Configure Google Calendar Simple API credentials following Getting started guide: Credentials.
    • Additionally, I added my email as a test user for given OAuth consent screen in GCP panel. I'm not sure if it's needed but it works for me.
  • Update your email in src/launchers/assistant.py
  • Run src/launchers/assistant.py
    • By the first run web browser with consent screen should appear. Give consent, enjoy working code.

The code is messy but it was meant to be a tech demo atm.

About

Simple agent framework using Ollama tool calling

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%