Concepts

Tool

Wraps a plain Python function as something an LLM can call — auto-generates the JSON schema from type hints and docstrings, no hand-written schema required.

Why it exists

LLMs need a structured schema to know what a function expects; Tool generates that automatically from your existing function signature so you don't write it by hand.

View source on GitHub
educhain.py
from educhain.core.tool import Tool

def get_weather(city: str) -> str:
    """Get the current weather for a specific named city."""
    return f"It's sunny in {city}"

weather_tool = Tool(get_weather)

Related