🌓

tiny_fnc_engine Documentation

Welcome to the tiny_fnc_engine documentation. Use the sidebar to navigate through different sections of the documentation.

Introduction

tiny_fnc_engine is a minimal Python library that provides a flexible engine for calling functions extracted from Large Language Model (LLM) outputs in JSON format. The engine stores functions and their outputs in memory, allowing for chained function calls and parameter referencing.

Features

Quickstart

from tiny_fnc_engine import FunctionCallingEngine

# Initialize the engine
engine = FunctionCallingEngine()

# Add functions to the engine
def greet(name):
    return f"Hello, {name}!"

engine.add_functions([greet])

# Call a function using JSON format
result = engine.parse_and_call_functions({
    "name": "greet",
    "parameters": {"name": "Alice"},
    "returns": [{"name": "greeting", "type": "str"}]
})

print(result[0])  # Output: Hello, Alice!