Skip to content

feat: forecast time series through the TabPFN API - #467

Draft
eddiebergman-priorlabs wants to merge 6 commits into
mainfrom
eddie/forecast
Draft

eddiebergman-priorlabs wants to merge 6 commits into
mainfrom
eddie/forecast

Conversation

@eddiebergman-priorlabs

Copy link
Copy Markdown
Contributor

Generated by Claude Code

Adds tabpfn_client.timeseries.forecast(), which forecasts the next horizon steps of every item in a long table, with optional past, known and static covariates. The client checks only the structure of the request (column roles, reserved names, limits from get_settings().forecast); the server worker checks the values and returns typed parse or validation errors. It calls /forecast/forecast first and polls /forecast/get_job_result through the shared poll loop when the job outlives the request.

The server side is on tabpfn-server branch eddie/forecast-gapi (not yet merged), so this PR stays a draft until that lands.

Details
  • Returns ForecastResult(forecast: DataFrame, metadata: ForecastMetadata(n_items, runtime_s)).
  • Tables go inline when their parquet fits max_inline_table_bytes, else through /forecast/prepare_upload (a signed URL each for the series and the known-covariates table).
  • Errors: InvalidSeriesError for request problems; TimeSeriesInputParseError / TimeSeriesInputValidationError (subclasses of TimeSeriesJobFailedError) for worker input errors; TimeSeriesJobFailedError otherwise.
  • ForecastLimits mirrors the server with no defaults. Without forecast in the settings, forecast() raises.
  • _PollResponseT is now bound to a protocol that needs only retry_in_secs, so the forecast poll reuses _poll_until_done.
  • Tests: 63 new unit tests; the full unit suite passes; ruff and basedpyright clean.

🤖 Generated with Claude Code

https://claude.ai/code/session_01FT4GDz1gUFQ8SxzCYfncoz

`tabpfn_client.timeseries.forecast()` checks the structure of the request
against the limits in `get_settings().forecast`, sends the tables inline or
through `/forecast/prepare_upload`, waits on `/forecast/forecast` and polls
`/forecast/get_job_result` with the shared poll loop when the job outlives
the request. The server checks the values; its parse and validation errors
come back as typed exceptions.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FT4GDz1gUFQ8SxzCYfncoz
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FT4GDz1gUFQ8SxzCYfncoz
Job ids on every job error, USER_ERROR refusals as InvalidSeriesError, the
pending retry hint in the poll loop, and quota and rate limits as for predict.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FT4GDz1gUFQ8SxzCYfncoz
Target and covariate names never become columns of the result, so any name
is fine for them. The id and timestamp columns are output columns.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FT4GDz1gUFQ8SxzCYfncoz
The server's forecast limits replace `max_table_bytes` with `max_file_bytes`
and `max_decoded_bytes`. The old model fails to parse `get_settings`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FT4GDz1gUFQ8SxzCYfncoz
The server refuses a job whose tables, times its targets, have more than
`max_target_rows` rows. The client now refuses it first.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FT4GDz1gUFQ8SxzCYfncoz

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant