You can automatically report evaluation results to a server (like a Google Cloud Function) using the --upload_url flag.
1. Deploy a Cloud Function
The repository provides sample functions for BigQuery and Postgres.
Setup:
- Copy
.env.yaml.template to .env.yaml and fill in the fields. - For BigQuery, place your service account
key.json in the folder and set CREDENTIALS_PATH in .env.yaml.
Deploy BigQuery function:
gcloud functions deploy results_bigquery \
--source results_fn_bigquery \
--entry-point bigquery \
--env-vars-file results_fn_bigquery/.env.yaml \
--runtime python311 \
--memory 512MB \
--trigger-http \
--allow-unauthenticated \
--gen2
Deploy Postgres function:
gcloud functions deploy results_postgres \
--source results_fn_postgres \
--entry-point postgres \
--env-vars-file results_fn_postgres/.env.yaml \
--runtime python311 \
--memory 512MB \
--trigger-http \
--allow-unauthenticated \
--gen2
2. Run Evaluation
Pass the deployed URL to your main.py command:
python main.py \
-db postgres \
-o results/test.csv \
-g oa \
-f prompts/prompt_openai.json \
-m gpt-4o-mini \
-n 1 \
--upload_url <your cloud function url>
Tip: To always report to a specific URL without passing the flag every time, set the SQL_EVAL_UPLOAD_URL environment variable.