Skip to content

calls

calls(program=None, *, folder=None, since=None)

Every logged call, as a table.

Parameters

Name Type Description Default
program AI function, module or name Only this program's calls. Its inputs then get a column each, and its outputs pred_<output> columns, as in evaluate's table. Default: every program's, with inputs and outputs as JSON text. None
folder str or path The log folder. Default: the one calls are logged to here, else the default one (~/.local/share/functai/calls). None
since (date, datetime, timedelta or text) Only calls from then on: "2026-09-20", "7d", "12h". None

Returns

Name Type Description
dpyr dataframe One row per call, oldest first: the inputs and pred_<output> (for one program; else program, inputs and outputs), rating (the latest judgement: right, wrong, or null), error, started, seconds, input_tokens, output_tokens, reasoning_tokens, total_tokens (Gemini's output_tokens leave its hidden reasoning out; a cost is total_tokens - input_tokens at the output price), model, version, purpose (use, or evaluation and optimization for calls that answered known questions), caller (who called, as JSON), call (its id) and parent (the call it ran in).

See Also

  • rated: the rated calls as rows with known answers.
  • rate: judge a call.

Examples

import functai
from functai import *
import tempfile
from typing import Literal

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

with functai.configure(log_calls=tempfile.mkdtemp()):
    team("My parcel never came.")
    team("I was charged twice.")
    table = functai.calls(team)
table.select("message", "pred_result", "rating", "model", "seconds")
functai: no model chosen, so using gpt-4.1-mini (environment ($OPENAI_API_KEY)). Choose one with functai.configure(lm=...).
# dpyr dataframe · source: polars · showing 2 of 2 rows
┌───────────────────────┬─────────────┬────────┬──────────────┬──────────┐
│ message               ┆ pred_result ┆ rating ┆ model        ┆ seconds  │
│ ---                   ┆ ---         ┆ ---    ┆ ---          ┆ ---      │
│ str                   ┆ str         ┆ null   ┆ str          ┆ f64      │
╞═══════════════════════╪═════════════╪════════╪══════════════╪══════════╡
│ My parcel never came. ┆ shipping    ┆ null   ┆ gpt-4.1-mini ┆ 1.016987 │
│ I was charged twice.  ┆ billing     ┆ null   ┆ gpt-4.1-mini ┆ 0.834514 │
└───────────────────────┴─────────────┴────────┴──────────────┴──────────┘