Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.mathfi.ai/llms.txt

Use this file to discover all available pages before exploring further.

Interact with MathFi.ai using our Python SDK.

Installation and example

At this point in time, there’s a need to request access (email us to [email protected]) to the Python SDK and install it locally from source.
git clone https://github.com/Mathficast/butterfly-ai-python-sdk.git
cd butterfly-ai-python-sdk
# Local install
pip install -e .

# Run the example
export BAI_URL=<url>
export BAI_USERNAME=<username>
export BAI_PASSWORD=<password>

python examples/list-datasets-sdk.py

Example using SDK

import os
from butterflyai_sdk import login, init_client, list_datasets
from butterflyai_sdk.datasets import pretty

print(f"=== MathFi.ai SDK Example ===")

# Credentials from environment

base_url = os.environ["BAI_URL"]
email = os.environ["BAI_EMAIL"]
password = os.environ["BAI_PASSWORD"]

# 1) Login and get token
print("Logging in...")
token = login(email, password, base_url)
print("Got access token (truncated):", token[:20], "...")

# 2) Init client
client = init_client(token, base_url)

# 3) Fetch datasets
print("Fetching datasets...")
datasets = list_datasets(client)

# Pretty print
print("Response:")
pretty(datasets)