This document explains how to use the update_function.py script to update your deployed cloud function with a new TabPFN API token and switch from mock mode to real predictions.
- Python 3.6 or higher
tabpfn-clientpackage installed (pip install tabpfn-client)- Google Cloud SDK installed and configured
- A TabPFN account (sign up at tabpfn.github.io if needed)
The script provides several options for updating your function:
Simply run the script with no arguments to be prompted for all necessary information:
python update_function.pyThis will:
- Detect your current GCP project
- Prompt for your TabPFN email and password
- Retrieve an API token
- Save the token to
~/.tabpfn_tokenfor future use - Update your cloud function to use the real TabPFN API
python update_function.py --email your.email@example.comYou'll be prompted securely for your password.
If you already have a TabPFN API token:
python update_function.py --token "your-api-token"python update_function.py --project your-project-id --region us-central1python update_function.py --use-mock trueusage: update_function.py [-h] [--project PROJECT] [--region REGION]
[--function FUNCTION] [--email EMAIL]
[--password PASSWORD] [--token TOKEN]
[--use-mock {true,false}] [--use-gcs {true,false}]
[--no-save-token]
options:
-h, --help show this help message and exit
--project PROJECT Google Cloud project ID
--region REGION GCP region where the function is deployed
--function FUNCTION Function name
--email EMAIL TabPFN account email
--password PASSWORD TabPFN account password (not recommended - use prompt)
--token TOKEN Use existing TabPFN token (skip login)
--use-mock {true,false}
Whether to use mock predictions (default: false)
--use-gcs {true,false}
Whether to use GCS for storage (default: false)
--no-save-token Don't save token to ~/.tabpfn_token
- The script logs in to TabPFN using your credentials and obtains an API token
- It retrieves the current configuration of your deployed cloud function
- It updates the environment variables with the new token and settings
- It redeploys only the configuration (not the entire function)
If you encounter issues:
- Authentication errors: Make sure you're using the correct TabPFN credentials
- Permission errors: Ensure your Google Cloud account has permission to update the function
- Token not working: Try logging in to the TabPFN website to verify your account status
- Cloud Function not found: Check the function name and region with
gcloud functions list
- The script stores your TabPFN token in
~/.tabpfn_tokenwith restricted permissions (readable only by you) - Never include your TabPFN password in command line arguments (use the prompt)
- The token is securely transmitted to Google Cloud and stored as an environment variable
After updating your function, you can test it with the test_deployment.py script:
python test_deployment.py --url "https://your-function-url" --verbose