Skip to main content

functai

Write a Python function. A language model does the work. You measure how well.

functai turns a typed Python function into a call to a language model. The function's name, docstring and types say what you want; the answer comes back as the type you asked for. Then you run it on a whole table, find out how often it is right, and make it better.

from typing import Literal
from dpyr import col
import functai
from functai import ai

@ai
def team(message: str) -> Literal["shipping", "billing", "product", "account"]:
    """Which team should answer this customer message?"""

team("I was charged twice for order B-2210, please fix this.")    # 'billing'

tickets = functai.datasets.tickets()                              # 80 labelled support messages
tickets.mutate(team=team(col.message))                            # a new column, one call per message
functai.evaluate(team, tickets, expected="category")              # how often it's right, with a range

Installation

pip install "functai[data]"      # Python 3.11+

With an API key in your environment (OPENAI_API_KEY, ANTHROPIC_API_KEY, GEMINI_API_KEY, …) or a Claude, ChatGPT or Copilot subscription, there's nothing to set up: functai picks a small model you can use and tells you which. To choose: functai.configure(lm="claude-haiku-4-5").

Documentation

maximerivest.github.io/functai, with three ways in:

The examples each solve one problem end to end.

Built on

lm15 (every provider, no SDKs), lmcc (how values are written into prompts and read back) and dpyr (tables).

Development

From git: pip install "functai @ git+https://github.com/MaximeRivest/functai#subdirectory=python".

This folder is the Python package; the repository around it holds the contract every language's FunctAI follows and the documentation site. In this folder: uv sync --all-groups, then uv run pytest (offline, a fake provider). The documentation runs against real models: .venv/bin/python tests/docs_live.py --render (costs cents).

Metadata

Release files for functai 1.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for functai 1.1.0
File Size Uploaded
functai-1.1.0.tar.gz 188.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for functai 1.1.0
File Interpreter ABI Platform
functai-1.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 395.6 kB

Release files / functai-1.1.0.tar.gz

Download URL functai-1.1.0.tar.gz
Size 188.3 kB
Tags Source
SHA-256 checksum
How to use checksums
39d259c2c305a03d83705e805bb9a6ba03e666b19109a5bc3df3a4d4cde2da61
BLAKE2b-256 checksum
How to use checksums
cce5ffb05297c764042874dcefe9ff8a542eab8c7ffef3ef0edc053b19592250
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 27, 2026.

Transparency log

Release files / functai-1.1.0-py3-none-any.whl

Download URL functai-1.1.0-py3-none-any.whl
Size 207.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
301e6905cc5700590db7d5c31cca55c890d009566383b6694e953a51506651e6
BLAKE2b-256 checksum
How to use checksums
36a1037c81b97b4e9b0a5474530a9d9f07c70b6f7cccebf6e47f1f308728a7b9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 27, 2026.

Transparency log

Release history Release notifications | RSS feed

1.2.0

2 release files

This release

1.1.0 This release

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.9.0

2 release files

0.8.1

2 release files

0.8.0

2 release files

0.7.0

2 release files

0.6.0

2 release files

0.1.3

2 release files

0.1.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page