
treelang
LLM function calling on steroids using Abstract Syntax Trees.
Repository Info
About This Server
LLM function calling on steroids using Abstract Syntax Trees.
Model Context Protocol (MCP) - This server can be integrated with AI applications to provide additional context and capabilities, enabling enhanced AI interactions and functionality.
Documentation
🌲 treelang
!PyPI - Version
Abstract Syntax Trees (ASTs) for advanced function calling with Large Language Models (LLMs), i.e. function-calling on steroids!
Why treelang
-
Complex worflows: Primarily
treelangwas created as a practical way to support arbitrarily complex function composition and conditionals, where the answer to a question may involve multiple steps each with its own multiple dependencies. -
Cost-Saving and Green: With
treelangyou avoid the typical function-calling loop whereby the LLM outputs a function call, your program evaluates it and returns the result back to the LLM for this cycle to repeat until the final result is computed.treelanggenerates the AST for the full solution using a single call to the underlying LLM! -
Security:
treelangdeals with ASTs which means it never needs to know the result from any node in the tree, which may be sensitive (e.g. "my patients email addresses"). The developer can focus on the reliability and security of the underlying tools that will be used to evaluate the AST. -
Portability:
treelang"packages" solutions into ASTs which means that solutions can be easily reused, shared, cached and interpreted. -
Automated solutions generator: coming soon...
Features
- Abstract Syntax Tree Representation:
treelangspeaks Trees. - MCP Client:
treelangis an MCP client out of the box but any other method of tool provision can be used via theToolProviderabstraction. - LLM Integration: Use LLMs (e.g., OpenAI models) to generate ASTs.
- Tool Selection: Dynamically select tools (functions) available in the system.
- Asynchronous Execution: Fully asynchronous design for efficient computation.
- Higher Order Functions: Support for functional patterns using lambda, map, filter and reduce nodes.
- Tool generation from Trees: Convert
treelangASTs into Tools that can be added dynamically to MCP servers.
Installation
pip install treelang
Resources
- Cookbooks: Play with the Jupiter Notebooks in the
cookbookdirectory to learn more abouttreelang.
Quick Start
Clone the repository
git clone https://github.com/cs0lar/treelangInstall dependencies
cd treelang
npm installFollow the documentation
Check the repository's README.md file for specific installation and usage instructions.
Repository Details
Recommended MCP Servers
Discord MCP
Enable AI assistants to seamlessly interact with Discord servers, channels, and messages.
Knit MCP
Connect AI agents to 200+ SaaS applications and automate workflows.
Apify MCP Server
Deploy and interact with Apify actors for web scraping and data extraction.
BrowserStack MCP
BrowserStack MCP Server for automated testing across multiple browsers.
Zapier MCP
A Zapier server that provides automation capabilities for various apps.