Skip to content

Commit

Permalink
Python goat-sdk 0.1.1: Support async tool calling (#211)
Browse files Browse the repository at this point in the history
Support async tool calling
  • Loading branch information
karimodm authored Jan 10, 2025
1 parent 684e74e commit fe16a1b
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
12 changes: 6 additions & 6 deletions python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,16 @@ readme = "README.md"
keywords = ["goat", "sdk", "web3", "agents", "ai"]
homepage = "https://ohmygoat.dev/"
repository = "https://github.com/goat-sdk/goat"
package-mode = false

[tool.poetry.dependencies]
python = "^3.12"
pydantic = "^2.10.0"
goat-sdk = { path = "src/goat-sdk/" }
goat-sdk-plugin-coingecko = { path = "src/plugins/coingecko/" }
goat-sdk-plugin-erc20 = { path = "src/plugins/erc20/" }
goat-sdk-wallet-web3 = { path = "src/wallets/web3/" }
goat-sdk-adapter-langchain = { path = "src/adapters/langchain/" }

[tool.poetry.group.test.dependencies]
pytest = "^8.3.4"
Expand All @@ -30,12 +36,6 @@ asyncio_default_fixture_loop_scope = "function"
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

[tool.poetry.group.dev.dependencies]
ruff = "^0.8.6"
goat-sdk = { path = "src/goat-sdk/", develop = true }
goat-sdk-plugin-coingecko = { path = "src/plugins/coingecko/", develop = true }
goat-sdk-plugin-erc20 = { path = "src/plugins/erc20/", develop = true }

[tool.ruff]
line-length = 120
target-version = "py312"
8 changes: 7 additions & 1 deletion python/src/goat-sdk/goat/classes/plugin_base.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import asyncio
import inspect
from abc import ABC, abstractmethod
from typing import List, Any, TypeVar, Generic

Expand Down Expand Up @@ -112,4 +114,8 @@ def _execute_tool(
args[parameters_index - 1] = params

method = getattr(tool_provider, tool_metadata.target.__name__)
return method(*args)
result = method(*args)

if inspect.iscoroutine(result):
return asyncio.get_event_loop().run_until_complete(result)
return result
3 changes: 2 additions & 1 deletion python/src/goat-sdk/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "goat-sdk"
version = "0.1.0"
version = "0.1.1"
description = "Goat 🐐 (Great Onchain Agent Toolkit) is an open-source framework for connecting AI agents to any onchain app"
authors = ["Andrea Villa <[email protected]>"]
readme = "README.md"
Expand All @@ -14,6 +14,7 @@ packages = [
[tool.poetry.dependencies]
python = "^3.10"
pydantic = "^2.10.0"
asyncio = "^3.4.1"

[tool.poetry.group.test.dependencies]
pytest = "^8.3.4"
Expand Down

0 comments on commit fe16a1b

Please sign in to comment.