Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nlt-tools — Natural Language Tools

Replace structured JSON function calling with natural-language YES/NO grids. Instead of serializing tool schemas on every call and asking the model to emit JSON, NLT asks the model a question it is good at: "Do you need this tool? YES or NO." — then extracts arguments in a second, equally plain exchange.

Validated across 14 models and 8,560 trials: +14.9pp selection accuracy, 93% fewer errors, 25.2% token savings versus structured function calling — with the gap widest on small and open models.

Zero core dependencies (stdlib only). You bring the LLM.

Quick start

import nlt

tools = [
    nlt.ToolSpec(
        name="search",
        description="Search the web for information.",
        parameters={
            "type": "object",
            "properties": {"query": {"type": "string"}},
            "required": ["query"],
        },
    ),
]

def my_llm(user_prompt: str, system_prompt: str) -> str:
    ...  # call any model; return its text

selected = nlt.select_tools("Find articles about climate change", tools, call_llm=my_llm)
for tool in selected:
    print(tool.name, tool.args)

How it works

Two phases, both plain text:

  1. Selection (nlt.select) — every tool is presented as one row of a YES/NO grid; the parsed answers say which tools are relevant.
  2. Extraction (nlt.extract_args) — for each selected tool with parameters, one more call extracts the argument values.

nlt.select_tools chains both. NLTConfig controls strategy (nlt, structured, or hybrid fallback), the per-turn tool cap, and whether parameterless tools skip extraction.

Install

pip install -e .                # core, stdlib only
pip install -e ".[langchain]"   # + from_langchain_tools converter
pip install -e ".[openai]"      # + OpenAI client adapter

Integrations

from nlt.integrations.langchain import from_langchain_tools
specs = from_langchain_tools(my_langchain_tools)   # BaseTool -> ToolSpec

NLT is the default tool-selection path of the Startr.Team agent framework (spec).

License

AGPL-3.0-or-later.

About

Natural Language Tools — LLM tool selection via YES/NO grids instead of JSON function calling. +14.9pp accuracy, 93% fewer errors, 25% fewer tokens across 14 models.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages