Skip to main content

LLM function calling on steroids using Abstract Syntax Trees.

Project description

treelang

treelang uses Abstract Syntax Trees (ASTs) for advanced function calling with Large Language Models (LLMs), i.e. function-calling on steroids!

Why treelang

  • Complex worflows/function nesting: Primarily treelang was created as a practical way to support arbitrarily complex function-calling workflows, where the answer to a question may involve multiple steps each with its own multiple dependencies.
  • Cost Saving: With treelang you 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. treelang generates the AST for the full solution using a single call to the underlying LLM!
  • Security: treelang deals 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: treelang speaks Trees.
  • MCP Client: treelang is an MCP client out of the box.
  • 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.

Installation

 pip install treelang

Resources

  • Cookbooks: Play with the Jupiter Notebooks in the cookbook directory to learn more about treelang.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

treelang-0.1.0.tar.gz (8.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

treelang-0.1.0-py3-none-any.whl (9.9 kB view details)

Uploaded Python 3

File details

Details for the file treelang-0.1.0.tar.gz.

File metadata

  • Download URL: treelang-0.1.0.tar.gz
  • Upload date:
  • Size: 8.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.1 CPython/3.12.8 Linux/6.9.3-76060903-generic

File hashes

Hashes for treelang-0.1.0.tar.gz
Algorithm Hash digest
SHA256 23b03c79f2de8496358e07ff956e4eb48c944e9f854a3aa3e31166a154880ea9
MD5 a4549f6d543054f052448a38ac055df6
BLAKE2b-256 f64e0aa9f6378a8448634db42ae67480a30c78a0bc30d51506e73ed8b1271bbc

See more details on using hashes here.

File details

Details for the file treelang-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: treelang-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 9.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.1 CPython/3.12.8 Linux/6.9.3-76060903-generic

File hashes

Hashes for treelang-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4ecc34bf733c3eabdc4bebab18ac253a090aaa97985abea7480812c3ad2f3736
MD5 3e8aca35c4c4808c164ec5a894cd47d5
BLAKE2b-256 a276c5871e06c778f586a96e864483671fc039a12ae52d630f950d216593a5a5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page