cayu.storage.evals_postgres
Public Cayu API. Definitions are grouped by their public source module, and definitions from private implementation modules appear on their package’s page; adding a symbol does not move existing links. The import shown at each entry is a supported public namespace. Read the Python API overview and install the required extra.
PostgresEvalStore
Section titled “PostgresEvalStore”from cayu.storage import PostgresEvalStoreRestart-durable, multi-worker eval persistence for PostgreSQL.
Bases: _PostgresStoreBase, EvalStore.
init (method)
Section titled “init (method)”PostgresEvalStore.__init__(conninfo: str | None=None, *, pool: AsyncConnectionPool | None=None, min_size: int=1, max_size: int=8, schema_mode: schema.SchemaMode=schema.SchemaMode.VALIDATE, read_only: bool=False, migration_reset_empty_recall_state: bool=False, migration_expected_input_state: schema.SchemaState | None=None, migration_operation_sha256: str | None=None, migration_receipt_json: str | None=None) -> Noneensure_schema (method)
Section titled “ensure_schema (method)”async PostgresEvalStore.ensure_schema() -> NoneOpen the pool and reconcile the schema now (per schema_mode).
Normally reconciliation happens lazily on first use; the cayu storage
CLI calls this to run a migrate (or validate) as an explicit step.
close (method)
Section titled “close (method)”async PostgresEvalStore.close() -> NoneRelease store resources; process-local stores may perform no work.
save_corpus (method)
Section titled “save_corpus (method)”async PostgresEvalStore.save_corpus(corpus: EvalCorpusDocument, *, redact_json: Callable[[Any], Any]) -> EvalCorpusCatalogEntryload_corpus (method)
Section titled “load_corpus (method)”async PostgresEvalStore.load_corpus(revision: str, *, max_bytes: int=EVAL_CORPUS_MAX_BYTES) -> EvalCorpusDocument | Nonelist_corpora (method)
Section titled “list_corpora (method)”async PostgresEvalStore.list_corpora(query: EvalCatalogQuery | None=None) -> EvalCorpusCatalogPagesave_scenario (method)
Section titled “save_scenario (method)”async PostgresEvalStore.save_scenario(scenario: EvalScenarioDocumentV2, *, redact_json: Callable[[Any], Any]) -> EvalScenarioCatalogEntryload_scenario (method)
Section titled “load_scenario (method)”async PostgresEvalStore.load_scenario(revision: str, *, max_bytes: int=EVAL_SCENARIO_MAX_BYTES) -> EvalScenarioDocumentV2 | Nonelist_scenarios (method)
Section titled “list_scenarios (method)”async PostgresEvalStore.list_scenarios(query: EvalScenarioCatalogQuery | None=None) -> EvalScenarioCatalogPagesave_authored_suite (method)
Section titled “save_authored_suite (method)”async PostgresEvalStore.save_authored_suite(document: EvalSuiteDocument, *, redact_json: Callable[[Any], Any]) -> EvalAuthoredSuiteCatalogEntryload_authored_suite (method)
Section titled “load_authored_suite (method)”async PostgresEvalStore.load_authored_suite(revision: str, *, max_bytes: int=EVAL_SUITE_AUTHORING_MAX_BYTES) -> EvalSuiteDocument | Nonelist_authored_suites (method)
Section titled “list_authored_suites (method)”async PostgresEvalStore.list_authored_suites(query: EvalAuthoredSuiteCatalogQuery | None=None) -> EvalAuthoredSuiteCatalogPagesave_judge_calibration (method)
Section titled “save_judge_calibration (method)”async PostgresEvalStore.save_judge_calibration(report: EvalJudgeCalibrationReportV1, *, redact_json: Callable[[Any], Any]) -> EvalJudgeCalibrationReportV1load_judge_calibration (method)
Section titled “load_judge_calibration (method)”async PostgresEvalStore.load_judge_calibration(revision: str, *, max_bytes: int=EVAL_JUDGE_CALIBRATION_MAX_BYTES) -> EvalJudgeCalibrationReportV1 | Noneload_judge_calibration_by_run_id (method)
Section titled “load_judge_calibration_by_run_id (method)”async PostgresEvalStore.load_judge_calibration_by_run_id(run_id: str, *, max_bytes: int=EVAL_JUDGE_CALIBRATION_MAX_BYTES) -> EvalJudgeCalibrationReportV1 | Nonelist_suites (method)
Section titled “list_suites (method)”async PostgresEvalStore.list_suites(query: EvalSuiteCatalogQuery) -> EvalSuiteCatalogPagelist_cases (method)
Section titled “list_cases (method)”async PostgresEvalStore.list_cases(query: EvalCaseCatalogQuery) -> EvalCaseCatalogPageadmit_run (method)
Section titled “admit_run (method)”async PostgresEvalStore.admit_run(request: EvalRunRequest, *, redact_json: Callable[[Any], Any]) -> EvalRunRecordload_run_by_idempotency_key (method)
Section titled “load_run_by_idempotency_key (method)”async PostgresEvalStore.load_run_by_idempotency_key(idempotency_key: str) -> EvalRunRecord | Noneload_run (method)
Section titled “load_run (method)”async PostgresEvalStore.load_run(run_id: str) -> EvalRunRecord | Noneload_run_observation (method)
Section titled “load_run_observation (method)”async PostgresEvalStore.load_run_observation(run_id: str) -> EvalRunObservation | Nonewait_for_run_terminal (method)
Section titled “wait_for_run_terminal (method)”async PostgresEvalStore.wait_for_run_terminal(run_id: str, *, timeout_seconds: float=30.0, poll_interval_seconds: float=EVAL_RUN_MIN_OBSERVATION_INTERVAL_SECONDS, max_poll_interval_seconds: float=EVAL_RUN_MAX_OBSERVATION_INTERVAL_SECONDS) -> EvalRunObservation | NoneWait within a strict deadline for a terminal run observation.
Polling begins no faster than the public 50 ms floor and exponentially backs
off to the caller’s bounded ceiling. A missing run returns None; deadline
exhaustion raises TimeoutError.
list_runs (method)
Section titled “list_runs (method)”async PostgresEvalStore.list_runs(query: EvalRunQuery | None=None) -> EvalRunPageclaim_run (method)
Section titled “claim_run (method)”async PostgresEvalStore.claim_run(*, target_key: str | None=None, launch_revision: str | None=None, lease_seconds: int=300) -> EvalRunLease | Noneclaim_run_for_targets (method)
Section titled “claim_run_for_targets (method)”async PostgresEvalStore.claim_run_for_targets(target_keys: tuple[str, ...], *, lease_seconds: int=300) -> EvalRunLease | Noneheartbeat_run (method)
Section titled “heartbeat_run (method)”async PostgresEvalStore.heartbeat_run(claim: EvalRunClaim, *, extend_seconds: int=300) -> EvalRunRecordheartbeat_run_observation (method)
Section titled “heartbeat_run_observation (method)”async PostgresEvalStore.heartbeat_run_observation(claim: EvalRunClaim, *, extend_seconds: int=300) -> EvalRunObservationrequest_cancel (method)
Section titled “request_cancel (method)”async PostgresEvalStore.request_cancel(run_id: str) -> EvalRunRecordinitialize_scenario_progress (method)
Section titled “initialize_scenario_progress (method)”async PostgresEvalStore.initialize_scenario_progress(claim: EvalRunClaim, progress: EvalScenarioRunProgress) -> EvalRunRecordupdate_scenario_trial (method)
Section titled “update_scenario_trial (method)”async PostgresEvalStore.update_scenario_trial(claim: EvalRunClaim, trial: EvalScenarioTrialProgress) -> EvalRunRecordload_trial_checkpoints (method)
Section titled “load_trial_checkpoints (method)”async PostgresEvalStore.load_trial_checkpoints(claim: EvalRunClaim) -> tuple[EvalRunTrialCheckpoint, ...]load_trial_evidence_links (method)
Section titled “load_trial_evidence_links (method)”async PostgresEvalStore.load_trial_evidence_links(run_id: str) -> tuple[EvalTrialEvidenceLinkV1, ...]save_trial_checkpoint (method)
Section titled “save_trial_checkpoint (method)”async PostgresEvalStore.save_trial_checkpoint(claim: EvalRunClaim, checkpoint: EvalRunTrialCheckpoint, *, redact_json: Callable[[Any], Any]) -> Nonesubmit_scenario_approval (method)
Section titled “submit_scenario_approval (method)”async PostgresEvalStore.submit_scenario_approval(run_id: str, submission: EvalScenarioApprovalSubmission) -> EvalRunRecordpublish_result (method)
Section titled “publish_result (method)”async PostgresEvalStore.publish_result(claim: EvalRunClaim, result: CorpusExecutionResult, *, redact_json: Callable[[Any], Any]) -> EvalRunRecordfail_run (method)
Section titled “fail_run (method)”async PostgresEvalStore.fail_run(claim: EvalRunClaim, code: EvalRunFailureCode, *, diagnostic: EvalRunFailureDiagnostic | None=None) -> EvalRunRecordfinish_cancel (method)
Section titled “finish_cancel (method)”async PostgresEvalStore.finish_cancel(claim: EvalRunClaim) -> EvalRunRecordrelease_run (method)
Section titled “release_run (method)”async PostgresEvalStore.release_run(claim: EvalRunClaim) -> EvalRunRecordload_result (method)
Section titled “load_result (method)”async PostgresEvalStore.load_result(run_id: str, *, max_bytes: int=CORPUS_EXECUTION_RESULT_MAX_BYTES) -> CorpusExecutionResult | Nonesave_captured_result (method)
Section titled “save_captured_result (method)”async PostgresEvalStore.save_captured_result(corpus: EvalCorpusDocument, result: CapturedEvaluationResultV1, *, redact_json: Callable[[Any], Any]) -> EvalResultRecordload_result_by_revision (method)
Section titled “load_result_by_revision (method)”async PostgresEvalStore.load_result_by_revision(revision: str, *, max_bytes: int=CORPUS_EXECUTION_RESULT_MAX_BYTES) -> CorpusExecutionResult | CapturedEvaluationResultV1 | Noneload_result_record (method)
Section titled “load_result_record (method)”async PostgresEvalStore.load_result_record(revision: str) -> EvalResultRecord | Nonelist_results (method)
Section titled “list_results (method)”async PostgresEvalStore.list_results(query: EvalResultQuery) -> EvalResultPageset_baseline (method)
Section titled “set_baseline (method)”async PostgresEvalStore.set_baseline(update: EvalBaselineUpdate, *, redact_json: Callable[[Any], Any]) -> EvalBaselineMutationRecordload_baseline (method)
Section titled “load_baseline (method)”async PostgresEvalStore.load_baseline(key: EvalBaselineKey) -> EvalBaselineRecord | Noneload_baseline_mutation (method)
Section titled “load_baseline_mutation (method)”async PostgresEvalStore.load_baseline_mutation(operation_id: str) -> EvalBaselineMutationRecord | None