agentinputlab 0.1.0a1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- agentinputlab/__init__.py +28 -0
- agentinputlab/algorithms/__init__.py +6 -0
- agentinputlab/algorithms/acquire/__init__.py +145 -0
- agentinputlab/algorithms/acquire/adaptive_rag/__init__.py +43 -0
- agentinputlab/algorithms/acquire/adaptive_rag/replay.py +367 -0
- agentinputlab/algorithms/acquire/adaptive_rag/runtime.py +1202 -0
- agentinputlab/algorithms/acquire/adaptive_rag_common_support.py +542 -0
- agentinputlab/algorithms/acquire/hyde.py +296 -0
- agentinputlab/algorithms/acquire/hyde_controlled.py +200 -0
- agentinputlab/algorithms/acquire/hyde_external.py +148 -0
- agentinputlab/algorithms/acquire/ircot.py +28 -0
- agentinputlab/algorithms/acquire/ircot_common_support.py +478 -0
- agentinputlab/algorithms/acquire/ircot_native.py +355 -0
- agentinputlab/algorithms/acquire/ircot_replay.py +327 -0
- agentinputlab/algorithms/acquire/qrag/__init__.py +79 -0
- agentinputlab/algorithms/acquire/qrag/bridge.py +828 -0
- agentinputlab/algorithms/acquire/qrag/common_support.py +891 -0
- agentinputlab/algorithms/acquire/qrag/native_axis.py +71 -0
- agentinputlab/algorithms/acquire/qrag/reader_adapter.py +139 -0
- agentinputlab/algorithms/acquire/r2ag/__init__.py +57 -0
- agentinputlab/algorithms/acquire/r2ag/bridge.py +1312 -0
- agentinputlab/algorithms/acquire/r2ag/common_support.py +1029 -0
- agentinputlab/algorithms/acquire/r2ag/socket_runtime.py +255 -0
- agentinputlab/algorithms/clarify/__init__.py +61 -0
- agentinputlab/algorithms/clarify/_structured.py +64 -0
- agentinputlab/algorithms/clarify/active_task_disambiguation.py +371 -0
- agentinputlab/algorithms/clarify/ask_or_assume/__init__.py +17 -0
- agentinputlab/algorithms/clarify/ask_or_assume/monitor.py +410 -0
- agentinputlab/algorithms/clarify/future_turns.py +379 -0
- agentinputlab/algorithms/clarify/udcs.py +255 -0
- agentinputlab/algorithms/clarify/udcs_deterministic.py +196 -0
- agentinputlab/algorithms/curate/__init__.py +65 -0
- agentinputlab/algorithms/curate/acon/__init__.py +27 -0
- agentinputlab/algorithms/curate/acon/common.py +284 -0
- agentinputlab/algorithms/curate/acon/common_support.py +136 -0
- agentinputlab/algorithms/curate/acon/history_bridge.py +309 -0
- agentinputlab/algorithms/curate/acon/observation_bridge.py +290 -0
- agentinputlab/algorithms/curate/llmlingua/__init__.py +30 -0
- agentinputlab/algorithms/curate/llmlingua/adapters.py +537 -0
- agentinputlab/algorithms/curate/llmlingua/budget.py +48 -0
- agentinputlab/algorithms/curate/llmlingua/controlled.py +175 -0
- agentinputlab/algorithms/curate/llmlingua/multilingual.py +105 -0
- agentinputlab/algorithms/curate/llmlingua/span_map.py +167 -0
- agentinputlab/algorithms/curate/recomp/__init__.py +47 -0
- agentinputlab/algorithms/curate/recomp/external.py +1129 -0
- agentinputlab/algorithms/curate/recomp/selective.py +304 -0
- agentinputlab/algorithms/decompose/__init__.py +107 -0
- agentinputlab/algorithms/decompose/decomp/__init__.py +53 -0
- agentinputlab/algorithms/decompose/decomp/common_support.py +478 -0
- agentinputlab/algorithms/decompose/decomp/planner_component.py +199 -0
- agentinputlab/algorithms/decompose/decomp/worker_bridge.py +416 -0
- agentinputlab/algorithms/decompose/llm_compiler/__init__.py +35 -0
- agentinputlab/algorithms/decompose/llm_compiler/bridge.py +520 -0
- agentinputlab/algorithms/decompose/llm_compiler/common_support.py +504 -0
- agentinputlab/algorithms/decompose/plan_and_budget/__init__.py +43 -0
- agentinputlab/algorithms/decompose/plan_and_budget/cached_soft_budget.py +362 -0
- agentinputlab/algorithms/decompose/plan_and_budget/decomposer_component.py +107 -0
- agentinputlab/algorithms/decompose/plan_and_budget/full.py +205 -0
- agentinputlab/algorithms/decompose/plan_and_budget/hard_cap.py +246 -0
- agentinputlab/algorithms/decompose/plan_and_budget/regenerated_soft_budget.py +448 -0
- agentinputlab/algorithms/decompose/plan_and_solve/__init__.py +33 -0
- agentinputlab/algorithms/decompose/plan_and_solve/plan_component.py +192 -0
- agentinputlab/algorithms/decompose/plan_and_solve/ps_prompt.py +127 -0
- agentinputlab/algorithms/decompose/self_ask/__init__.py +27 -0
- agentinputlab/algorithms/decompose/self_ask/loop.py +362 -0
- agentinputlab/algorithms/decompose/self_ask/planner_component.py +117 -0
- agentinputlab/algorithms/reformulate/__init__.py +85 -0
- agentinputlab/algorithms/reformulate/infocqr/__init__.py +40 -0
- agentinputlab/algorithms/reformulate/infocqr/cache_replay.py +362 -0
- agentinputlab/algorithms/reformulate/infocqr/external.py +675 -0
- agentinputlab/algorithms/reformulate/infocqr/student.py +189 -0
- agentinputlab/algorithms/reformulate/query2doc/__init__.py +42 -0
- agentinputlab/algorithms/reformulate/query2doc/controlled_live.py +190 -0
- agentinputlab/algorithms/reformulate/query2doc/models.py +95 -0
- agentinputlab/algorithms/reformulate/query2doc/official_cached.py +335 -0
- agentinputlab/algorithms/reformulate/query2doc/querygym_bridge.py +223 -0
- agentinputlab/algorithms/reformulate/query2doc/querygym_runtime.py +326 -0
- agentinputlab/algorithms/reformulate/reformer/__init__.py +23 -0
- agentinputlab/algorithms/reformulate/reformer/external.py +417 -0
- agentinputlab/algorithms/reformulate/rrr.py +696 -0
- agentinputlab/annotation/__init__.py +5 -0
- agentinputlab/annotation/independent.py +428 -0
- agentinputlab/annotation/server.py +233 -0
- agentinputlab/annotation/static/app.js +121 -0
- agentinputlab/annotation/static/index.html +60 -0
- agentinputlab/annotation/static/review.css +2 -0
- agentinputlab/annotation/static/review.html +10 -0
- agentinputlab/annotation/static/review.js +11 -0
- agentinputlab/annotation/static/styles.css +55 -0
- agentinputlab/annotation/store.py +444 -0
- agentinputlab/api.py +368 -0
- agentinputlab/artifacts/__init__.py +15 -0
- agentinputlab/artifacts/json_file.py +104 -0
- agentinputlab/artifacts/manifest.py +98 -0
- agentinputlab/artifacts/store.py +157 -0
- agentinputlab/backends/__init__.py +98 -0
- agentinputlab/backends/embedding/__init__.py +25 -0
- agentinputlab/backends/embedding/base.py +145 -0
- agentinputlab/backends/embedding/callable.py +75 -0
- agentinputlab/backends/embedding/replay.py +129 -0
- agentinputlab/backends/llm/__init__.py +31 -0
- agentinputlab/backends/llm/base.py +149 -0
- agentinputlab/backends/llm/callable.py +108 -0
- agentinputlab/backends/llm/decomp_completion.py +88 -0
- agentinputlab/backends/llm/final_content_stop.py +72 -0
- agentinputlab/backends/llm/gpt_oss_final_channel.py +84 -0
- agentinputlab/backends/llm/openai_compatible.py +332 -0
- agentinputlab/backends/llm/transformers.py +171 -0
- agentinputlab/backends/retrieval/__init__.py +35 -0
- agentinputlab/backends/retrieval/base.py +50 -0
- agentinputlab/backends/retrieval/dense.py +777 -0
- agentinputlab/backends/retrieval/memory.py +119 -0
- agentinputlab/backends/retrieval/sqlite_fts.py +155 -0
- agentinputlab/backends/user/__init__.py +15 -0
- agentinputlab/backends/user/base.py +66 -0
- agentinputlab/backends/user/callable.py +54 -0
- agentinputlab/backends/user/replay.py +89 -0
- agentinputlab/backends/vector.py +38 -0
- agentinputlab/benchmarks/__init__.py +246 -0
- agentinputlab/benchmarks/acquisition.py +106 -0
- agentinputlab/benchmarks/ale.py +540 -0
- agentinputlab/benchmarks/appworld_ul.py +669 -0
- agentinputlab/benchmarks/assets.py +226 -0
- agentinputlab/benchmarks/base.py +68 -0
- agentinputlab/benchmarks/beir_archive.py +235 -0
- agentinputlab/benchmarks/beir_sample.py +269 -0
- agentinputlab/benchmarks/bfcl_native.py +245 -0
- agentinputlab/benchmarks/bfcl_v3.py +607 -0
- agentinputlab/benchmarks/cache.py +218 -0
- agentinputlab/benchmarks/clariq.py +203 -0
- agentinputlab/benchmarks/data/registry.json +321 -0
- agentinputlab/benchmarks/data/smoke_assets.json +511 -0
- agentinputlab/benchmarks/data/statebench_v0_8_1_task_ids.json +475 -0
- agentinputlab/benchmarks/data/toolsandbox_165848b_scenario_names.json +1 -0
- agentinputlab/benchmarks/execution.py +1111 -0
- agentinputlab/benchmarks/interactive.py +257 -0
- agentinputlab/benchmarks/ir_query.py +204 -0
- agentinputlab/benchmarks/longbench.py +203 -0
- agentinputlab/benchmarks/paired_replay.py +479 -0
- agentinputlab/benchmarks/preprocess.py +2313 -0
- agentinputlab/benchmarks/production.py +236 -0
- agentinputlab/benchmarks/qa.py +963 -0
- agentinputlab/benchmarks/registry.py +110 -0
- agentinputlab/benchmarks/retrieval.py +459 -0
- agentinputlab/benchmarks/runtime.py +509 -0
- agentinputlab/benchmarks/statebench.py +938 -0
- agentinputlab/benchmarks/tau3.py +725 -0
- agentinputlab/benchmarks/toolsandbox.py +626 -0
- agentinputlab/benchmarks/trec_dl_sample.py +263 -0
- agentinputlab/campaign.py +654 -0
- agentinputlab/campaign_runner.py +953 -0
- agentinputlab/cli/__init__.py +6 -0
- agentinputlab/cli/main.py +933 -0
- agentinputlab/connectors/__init__.py +46 -0
- agentinputlab/connectors/knowledge/__init__.py +4 -0
- agentinputlab/connectors/tools/__init__.py +30 -0
- agentinputlab/connectors/tools/base.py +57 -0
- agentinputlab/connectors/tools/mcp.py +222 -0
- agentinputlab/connectors/tools/memory.py +41 -0
- agentinputlab/connectors/tools/openapi.py +695 -0
- agentinputlab/connectors/tools/schema.py +102 -0
- agentinputlab/contracts/__init__.py +91 -0
- agentinputlab/contracts/availability.py +24 -0
- agentinputlab/contracts/dependency.py +58 -0
- agentinputlab/contracts/enums.py +82 -0
- agentinputlab/contracts/errors.py +63 -0
- agentinputlab/contracts/evidence.py +43 -0
- agentinputlab/contracts/intent.py +110 -0
- agentinputlab/contracts/lifecycle.py +164 -0
- agentinputlab/contracts/patch.py +167 -0
- agentinputlab/contracts/serialization.py +93 -0
- agentinputlab/contracts/state.py +127 -0
- agentinputlab/contracts/trace.py +59 -0
- agentinputlab/contracts/worker.py +42 -0
- agentinputlab/core/__init__.py +7 -0
- agentinputlab/data/__init__.py +32 -0
- agentinputlab/data/checksums.py +9 -0
- agentinputlab/data/downloader.py +235 -0
- agentinputlab/data/http.py +171 -0
- agentinputlab/data/index.py +21 -0
- agentinputlab/data/overlap.py +28 -0
- agentinputlab/data/preprocess.py +32 -0
- agentinputlab/data/storage.py +57 -0
- agentinputlab/data/trec_sample.py +427 -0
- agentinputlab/evaluation/__init__.py +5 -0
- agentinputlab/evaluation/outcomes.py +32 -0
- agentinputlab/experiments/__init__.py +278 -0
- agentinputlab/experiments/analysis.py +981 -0
- agentinputlab/experiments/artifacts.py +687 -0
- agentinputlab/experiments/automatic_measurement.py +678 -0
- agentinputlab/experiments/auxiliary_matrix.py +203 -0
- agentinputlab/experiments/bindings.py +430 -0
- agentinputlab/experiments/blueprints.py +147 -0
- agentinputlab/experiments/builders/__init__.py +45 -0
- agentinputlab/experiments/builders/executable_external_payload.py +423 -0
- agentinputlab/experiments/builders/external_process_arena.py +1018 -0
- agentinputlab/experiments/builders/registry_intervention.py +463 -0
- agentinputlab/experiments/cli.py +158 -0
- agentinputlab/experiments/controls.py +340 -0
- agentinputlab/experiments/driver_guard.py +205 -0
- agentinputlab/experiments/drivers/__init__.py +89 -0
- agentinputlab/experiments/drivers/external_arena.py +2908 -0
- agentinputlab/experiments/drivers/method_process.py +662 -0
- agentinputlab/experiments/drivers/parity_process.py +1484 -0
- agentinputlab/experiments/drivers/static_production.py +1574 -0
- agentinputlab/experiments/executor.py +448 -0
- agentinputlab/experiments/loader.py +605 -0
- agentinputlab/experiments/measurement.py +675 -0
- agentinputlab/experiments/paper_analysis.py +1818 -0
- agentinputlab/experiments/parity_identity.py +605 -0
- agentinputlab/experiments/plan.py +277 -0
- agentinputlab/experiments/production_builders.py +3739 -0
- agentinputlab/experiments/readiness.py +432 -0
- agentinputlab/experiments/schema.py +514 -0
- agentinputlab/experiments/secrets.py +177 -0
- agentinputlab/experiments/stateful_analysis.py +1738 -0
- agentinputlab/experiments/transfer_analysis.py +1316 -0
- agentinputlab/experiments/unseen_analysis.py +1025 -0
- agentinputlab/integrations/__init__.py +1 -0
- agentinputlab/integrations/action_space/__init__.py +1 -0
- agentinputlab/integrations/external_workers/__init__.py +76 -0
- agentinputlab/integrations/external_workers/ace.py +431 -0
- agentinputlab/integrations/external_workers/base.py +181 -0
- agentinputlab/integrations/external_workers/decomp_live.py +249 -0
- agentinputlab/integrations/external_workers/decomp_planner.py +30 -0
- agentinputlab/integrations/external_workers/infocqr_student.py +280 -0
- agentinputlab/integrations/external_workers/ircot.py +576 -0
- agentinputlab/integrations/external_workers/llmcompiler_live.py +360 -0
- agentinputlab/integrations/external_workers/longllmlingua.py +162 -0
- agentinputlab/integrations/external_workers/method.py +314 -0
- agentinputlab/integrations/external_workers/process.py +678 -0
- agentinputlab/integrations/external_workers/supervisor.py +1071 -0
- agentinputlab/integrations/full_architecture/__init__.py +1 -0
- agentinputlab/integrations/full_architecture/hyde.py +212 -0
- agentinputlab/integrations/full_architecture/plan_and_budget.py +188 -0
- agentinputlab/integrations/live_history.py +222 -0
- agentinputlab/integrations/prompt_optimization/__init__.py +1 -0
- agentinputlab/integrations/training/__init__.py +1 -0
- agentinputlab/metrics/__init__.py +50 -0
- agentinputlab/metrics/catalog.py +313 -0
- agentinputlab/metrics/harm.py +95 -0
- agentinputlab/metrics/paired.py +40 -0
- agentinputlab/metrics/qa.py +76 -0
- agentinputlab/metrics/text.py +33 -0
- agentinputlab/metrics/third_party.py +161 -0
- agentinputlab/models/__init__.py +4 -0
- agentinputlab/observability/__init__.py +56 -0
- agentinputlab/observability/budget.py +316 -0
- agentinputlab/observability/instrumentation.py +754 -0
- agentinputlab/observability/models.py +403 -0
- agentinputlab/observability/monitor.py +380 -0
- agentinputlab/optimizers/__init__.py +1 -0
- agentinputlab/optimizers/clarify/__init__.py +12 -0
- agentinputlab/optimizers/context/__init__.py +22 -0
- agentinputlab/optimizers/decompose/__init__.py +64 -0
- agentinputlab/optimizers/evidence/__init__.py +22 -0
- agentinputlab/optimizers/rewrite/__init__.py +30 -0
- agentinputlab/parity/__init__.py +5 -0
- agentinputlab/parity/base.py +206 -0
- agentinputlab/production_campaign.py +763 -0
- agentinputlab/py.typed +1 -0
- agentinputlab/recipes/__init__.py +333 -0
- agentinputlab/recipes/ace.py +418 -0
- agentinputlab/recipes/ace_bfcl.py +273 -0
- agentinputlab/recipes/ace_common_support.py +169 -0
- agentinputlab/recipes/ace_native_plan.py +322 -0
- agentinputlab/recipes/ace_online.py +711 -0
- agentinputlab/recipes/ace_retrieval.py +330 -0
- agentinputlab/recipes/ace_statebench.py +382 -0
- agentinputlab/recipes/ace_tau.py +463 -0
- agentinputlab/recipes/ace_toolsandbox.py +432 -0
- agentinputlab/recipes/acon_guideline.py +22 -0
- agentinputlab/recipes/adaptive_rag.py +822 -0
- agentinputlab/recipes/llmlingua2_inference.py +146 -0
- agentinputlab/recipes/llmlingua2_training.py +796 -0
- agentinputlab/recipes/mce.py +1486 -0
- agentinputlab/recipes/mce_final.py +335 -0
- agentinputlab/recipes/mce_text_fit.py +499 -0
- agentinputlab/recipes/mce_text_only.py +298 -0
- agentinputlab/recipes/qrag.py +729 -0
- agentinputlab/recipes/qrag_inference.py +364 -0
- agentinputlab/recipes/r2ag_features.py +236 -0
- agentinputlab/recipes/r2ag_inference.py +503 -0
- agentinputlab/recipes/r2ag_training.py +948 -0
- agentinputlab/recipes/recomp_abstractive.py +592 -0
- agentinputlab/recipes/recomp_extractive.py +525 -0
- agentinputlab/recipes/reformer.py +17 -0
- agentinputlab/recipes/rqrag.py +1516 -0
- agentinputlab/recipes/rqrag_common_support.py +193 -0
- agentinputlab/recipes/rqrag_completion.py +147 -0
- agentinputlab/recipes/skillopt.py +462 -0
- agentinputlab/recipes/skillopt_common_support.py +154 -0
- agentinputlab/recipes/skillopt_environment.py +165 -0
- agentinputlab/recipes/skillopt_environment_cli.py +5 -0
- agentinputlab/recipes/skillopt_retrieval.py +188 -0
- agentinputlab/recipes/smartsearch.py +897 -0
- agentinputlab/recipes/smartsearch_curriculum.py +283 -0
- agentinputlab/recipes/smartsearch_grpo_contracts.py +58 -0
- agentinputlab/recipes/smartsearch_grpo_data.py +314 -0
- agentinputlab/recipes/smartsearch_grpo_meter.py +324 -0
- agentinputlab/recipes/smartsearch_grpo_prefix.py +144 -0
- agentinputlab/recipes/smartsearch_grpo_rollout.py +119 -0
- agentinputlab/recipes/smartsearch_grpo_tools.py +364 -0
- agentinputlab/recipes/smartsearch_grpo_training.py +305 -0
- agentinputlab/recipes/smartsearch_grpo_transport.py +248 -0
- agentinputlab/recipes/smartsearch_grpo_worker.py +364 -0
- agentinputlab/recipes/smartsearch_inference.py +524 -0
- agentinputlab/recipes/smartsearch_native_data.py +172 -0
- agentinputlab/recipes/smartsearch_policy.py +616 -0
- agentinputlab/recipes/smartsearch_policy_worker.py +9 -0
- agentinputlab/recipes/smartsearch_sampling.py +232 -0
- agentinputlab/recipes/smartsearch_teacher.py +203 -0
- agentinputlab/recipes/smartsearch_training.py +265 -0
- agentinputlab/registry/__init__.py +46 -0
- agentinputlab/registry/beta.py +727 -0
- agentinputlab/registry/data/algorithms.json +1959 -0
- agentinputlab/registry/data/auxiliary_method_profiles.json +34 -0
- agentinputlab/registry/loader.py +100 -0
- agentinputlab/registry/result_manifest.py +184 -0
- agentinputlab/registry/runtime.py +195 -0
- agentinputlab/registry/schema.py +449 -0
- agentinputlab/runner/__init__.py +30 -0
- agentinputlab/runner/balance.py +248 -0
- agentinputlab/runner/cache.py +135 -0
- agentinputlab/runner/composite.py +130 -0
- agentinputlab/runner/engine.py +285 -0
- agentinputlab/runner/runtime_guard.py +268 -0
- agentinputlab/runner/worker.py +80 -0
- agentinputlab/runtime_bootstrap.py +288 -0
- agentinputlab/selectors/__init__.py +196 -0
- agentinputlab/selectors/advanced.py +1514 -0
- agentinputlab/selectors/artifacts.py +1087 -0
- agentinputlab/selectors/base.py +112 -0
- agentinputlab/selectors/campaigns.py +1893 -0
- agentinputlab/selectors/catalog.py +86 -0
- agentinputlab/selectors/discovery.py +1860 -0
- agentinputlab/selectors/evaluation.py +1348 -0
- agentinputlab/selectors/features.py +383 -0
- agentinputlab/selectors/learned.py +502 -0
- agentinputlab/selectors/no_op.py +28 -0
- agentinputlab/selectors/outcome_table.py +475 -0
- agentinputlab/selectors/producer.py +853 -0
- agentinputlab/selectors/rules.py +109 -0
- agentinputlab/selectors/runtime.py +420 -0
- agentinputlab/studies/__init__.py +16 -0
- agentinputlab/studies/design.py +165 -0
- agentinputlab/studies/paired.py +322 -0
- agentinputlab/studio/__init__.py +6 -0
- agentinputlab/studio/campaigns.py +819 -0
- agentinputlab/studio/engine.py +1408 -0
- agentinputlab/studio/model_backends.py +425 -0
- agentinputlab/studio/prepared.py +410 -0
- agentinputlab/studio/server.py +613 -0
- agentinputlab/studio/static/app.js +397 -0
- agentinputlab/studio/static/campaigns.html +175 -0
- agentinputlab/studio/static/campaigns.js +426 -0
- agentinputlab/studio/static/index.html +192 -0
- agentinputlab/studio/static/result.html +103 -0
- agentinputlab/studio/static/result.js +273 -0
- agentinputlab/studio/static/styles.css +467 -0
- agentinputlab-0.1.0a1.data/data/share/agentinputlab/CITATION.cff +22 -0
- agentinputlab-0.1.0a1.dist-info/METADATA +392 -0
- agentinputlab-0.1.0a1.dist-info/RECORD +469 -0
- agentinputlab-0.1.0a1.dist-info/WHEEL +5 -0
- agentinputlab-0.1.0a1.dist-info/entry_points.txt +6 -0
- agentinputlab-0.1.0a1.dist-info/licenses/LICENSE +21 -0
- agentinputlab-0.1.0a1.dist-info/licenses/NOTICE +31 -0
- agentinputlab-0.1.0a1.dist-info/licenses/THIRD_PARTY_NOTICES.md +94 -0
- agentinputlab-0.1.0a1.dist-info/top_level.txt +2 -0
- workers/README.md +94 -0
- workers/ace/README.md +261 -0
- workers/ace/__init__.py +1 -0
- workers/ace/compatibility_manifest.json +39 -0
- workers/ace/driver.py +1682 -0
- workers/acon/README.md +215 -0
- workers/acon/__init__.py +5 -0
- workers/acon/compatibility_manifest.json +93 -0
- workers/acon/driver.py +1859 -0
- workers/acon/fitted.py +395 -0
- workers/acon/guideline.py +470 -0
- workers/acon/guideline_source_manifest.json +20 -0
- workers/adaptive_rag/README.md +96 -0
- workers/adaptive_rag/__init__.py +15 -0
- workers/adaptive_rag/compatibility_manifest.json +61 -0
- workers/adaptive_rag/driver.py +1470 -0
- workers/adaptive_rag/fixture_runtime.py +163 -0
- workers/adaptive_rag/runtime.py +252 -0
- workers/ask_or_assume/README.md +124 -0
- workers/ask_or_assume/__init__.py +1 -0
- workers/ask_or_assume/compatibility_manifest.json +36 -0
- workers/ask_or_assume/driver.py +1227 -0
- workers/decomp/README.md +133 -0
- workers/decomp/UPSTREAM_LICENSE.Apache-2.0.txt +201 -0
- workers/decomp/__init__.py +5 -0
- workers/decomp/compatibility_manifest.json +205 -0
- workers/decomp/driver.py +1015 -0
- workers/decomp/live.py +137 -0
- workers/decomp/runtime.py +231 -0
- workers/infocqr/README.md +106 -0
- workers/infocqr/__init__.py +1 -0
- workers/infocqr/compatibility_manifest.json +84 -0
- workers/infocqr/driver.py +1766 -0
- workers/ircot/README.md +167 -0
- workers/ircot/__init__.py +7 -0
- workers/ircot/compatibility_manifest.json +121 -0
- workers/ircot/controlled.py +457 -0
- workers/ircot/driver.py +1373 -0
- workers/ircot/fixture_bindings.json +39 -0
- workers/ircot/fixture_config.json +48 -0
- workers/ircot/fixture_prompt.txt +2 -0
- workers/ircot/native_qa.py +398 -0
- workers/ircot/qa_compatibility_manifest.json +57 -0
- workers/ircot/runtime.py +97 -0
- workers/llmcompiler/README.md +160 -0
- workers/llmcompiler/__init__.py +1 -0
- workers/llmcompiler/compatibility_manifest.json +45 -0
- workers/llmcompiler/driver.py +1514 -0
- workers/llmcompiler/export_prompts.py +74 -0
- workers/llmcompiler/live.py +174 -0
- workers/llmcompiler/patch_manifest.json +147 -0
- workers/mce/README.md +198 -0
- workers/mce/__init__.py +29 -0
- workers/mce/compatibility_manifest.json +115 -0
- workers/mce/driver.py +2585 -0
- workers/mce/final_eval.py +173 -0
- workers/official_arenas/README.md +25 -0
- workers/official_arenas/__init__.py +1 -0
- workers/official_arenas/capture_records.py +110 -0
- workers/official_arenas/driver.py +619 -0
- workers/official_arenas/protocol.py +334 -0
- workers/official_arenas/providers/__init__.py +1 -0
- workers/official_arenas/providers/_live_history.py +228 -0
- workers/official_arenas/providers/_message_compat.py +77 -0
- workers/official_arenas/providers/appworld_ul.py +196 -0
- workers/official_arenas/providers/fixture.py +112 -0
- workers/official_arenas/providers/statebench.py +960 -0
- workers/official_arenas/providers/tau3.py +1672 -0
- workers/official_arenas/providers/tau_retail.py +586 -0
- workers/official_arenas/providers/toolsandbox.py +1321 -0
- workers/official_arenas/providers/tooltalk.py +699 -0
- workers/official_arenas/retail_capture.py +188 -0
- workers/official_arenas/retail_driver.py +275 -0
- workers/qrag/README.md +172 -0
- workers/qrag/__init__.py +1 -0
- workers/qrag/compatibility_manifest.json +64 -0
- workers/qrag/driver.py +673 -0
- workers/r2ag/README.md +154 -0
- workers/r2ag/__init__.py +5 -0
- workers/r2ag/compatibility_manifest.json +55 -0
- workers/r2ag/driver.py +1287 -0
- workers/r2ag/feature_schema.json +8 -0
- workers/r2ag/runtime.py +589 -0
- workers/recomp/README.md +120 -0
- workers/recomp/__init__.py +1 -0
- workers/recomp/compatibility_manifest.json +43 -0
- workers/recomp/driver.py +1653 -0
- workers/reformer/README.md +125 -0
- workers/reformer/__init__.py +1 -0
- workers/reformer/compatibility_manifest.json +68 -0
- workers/reformer/driver.py +1459 -0
- workers/reformer/induction.py +457 -0
- workers/rrr/README.md +126 -0
- workers/rrr/__init__.py +1 -0
- workers/rrr/compatibility_manifest.json +57 -0
- workers/rrr/driver.py +1133 -0
- workers/smartsearch/README.md +331 -0
- workers/smartsearch/__init__.py +1 -0
- workers/smartsearch/compatibility_manifest.json +41 -0
- workers/smartsearch/driver.py +1643 -0
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""Approved, restart-safe Retail capture and partial-inventory projection.
|
|
3
|
+
|
|
4
|
+
No real scope or authorization is manufactured here. Before enabling a scope,
|
|
5
|
+
the operator must verify actual human scope and common-model choices. Successful
|
|
6
|
+
captures become optimizer-visible inventories; capture failures remain in the
|
|
7
|
+
full denominator, without invented checkpoints or automatic retries.
|
|
8
|
+
"""
|
|
9
|
+
from __future__ import annotations
|
|
10
|
+
|
|
11
|
+
import argparse
|
|
12
|
+
import json
|
|
13
|
+
import os
|
|
14
|
+
import sys
|
|
15
|
+
from collections.abc import Mapping
|
|
16
|
+
from pathlib import Path
|
|
17
|
+
from types import SimpleNamespace
|
|
18
|
+
from typing import Any
|
|
19
|
+
|
|
20
|
+
if __package__ in {None, ""}:
|
|
21
|
+
sys.path[:0] = [str(Path(__file__).resolve().parents[2] / "src"),
|
|
22
|
+
str(Path(__file__).resolve().parents[2])]
|
|
23
|
+
|
|
24
|
+
from workers.official_arenas.capture_records import _records
|
|
25
|
+
from agentinputlab.experiments.builders import CHECKPOINT_INVENTORY_PROTOCOL
|
|
26
|
+
from workers.official_arenas.protocol import REPLAY_INVENTORY_PROTOCOL, OfficialArenaError, content_hash, sha256_file
|
|
27
|
+
from workers.official_arenas.providers.tau_retail import SOURCE_REVISION, _create_only, _saved_capture, factory
|
|
28
|
+
from workers.official_arenas.retail_driver import _read, _validate_authorizations
|
|
29
|
+
|
|
30
|
+
PROTOCOL = "agentinputlab.retail-capture-scope.v1"
|
|
31
|
+
_FIELDS = frozenset({"schema_version", "protocol", "source_revision", "phase", "execution_enabled",
|
|
32
|
+
"output_root", "provider_config", "provider_config_sha256", "source_sha256",
|
|
33
|
+
"authorizations", "expected_task_ids", "model_slot"})
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def _source_pins() -> dict[str, str]:
|
|
37
|
+
root = Path(__file__).resolve().parents[2]
|
|
38
|
+
return {relative: sha256_file(root / relative) for relative in (
|
|
39
|
+
"workers/official_arenas/retail_capture.py", "workers/official_arenas/retail_driver.py",
|
|
40
|
+
"workers/official_arenas/driver.py", "workers/official_arenas/protocol.py",
|
|
41
|
+
"workers/official_arenas/providers/tau_retail.py", "workers/official_arenas/providers/tau3.py",
|
|
42
|
+
"workers/official_arenas/capture_records.py",
|
|
43
|
+
)}
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def _validated_scope(path: Path, checksum: str, provider):
|
|
47
|
+
value = _read(path)
|
|
48
|
+
if sha256_file(path) != checksum or set(value) != _FIELDS:
|
|
49
|
+
raise OfficialArenaError("Retail capture scope fields or checksum differ")
|
|
50
|
+
if (type(value["schema_version"]) is not int or value["schema_version"] != 1
|
|
51
|
+
or value["protocol"] != PROTOCOL or value["source_revision"] != SOURCE_REVISION
|
|
52
|
+
or value["execution_enabled"] is not True or value["phase"] not in {"engineering", "formal"}):
|
|
53
|
+
raise OfficialArenaError("Retail capture scope is not enabled or valid")
|
|
54
|
+
_validate_authorizations(value["authorizations"])
|
|
55
|
+
parsed = provider._validate_config(value["provider_config"])
|
|
56
|
+
if value["provider_config_sha256"] != content_hash(parsed) or value["source_sha256"] != _source_pins():
|
|
57
|
+
raise OfficialArenaError("Retail capture source or effective config differs")
|
|
58
|
+
if parsed["task_split_name"] != ("train" if value["phase"] == "engineering" else "test"):
|
|
59
|
+
raise OfficialArenaError("Retail capture phase and official split differ")
|
|
60
|
+
ids = value["expected_task_ids"]
|
|
61
|
+
if (not isinstance(ids, list) or len(ids) != parsed["limit"]
|
|
62
|
+
or any(not isinstance(task_id, str) or not task_id.isdigit() for task_id in ids)
|
|
63
|
+
or len(ids) != len(set(ids))):
|
|
64
|
+
raise OfficialArenaError("Retail capture expected task inventory is invalid")
|
|
65
|
+
if not isinstance(value["model_slot"], str) or not value["model_slot"].strip():
|
|
66
|
+
raise OfficialArenaError("Retail capture model slot is absent")
|
|
67
|
+
root = Path(value["output_root"])
|
|
68
|
+
if (not root.is_absolute() or any(part.is_symlink() for part in (root, *root.parents))
|
|
69
|
+
or not root.is_dir() or root.stat().st_uid != os.getuid() or root.stat().st_mode & 0o077):
|
|
70
|
+
raise OfficialArenaError("Retail capture root must be an existing owned private directory")
|
|
71
|
+
return value, parsed, root
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
def project_batch(provider, config: Mapping[str, Any], batch: Mapping[str, Any], *, root: Path,
|
|
75
|
+
phase: str, model_slot: str, scope_sha256: str) -> Mapping[str, Any]:
|
|
76
|
+
"""Read retained receipts, validate them, and export without generation."""
|
|
77
|
+
binding = content_hash(provider._validate_config(config))
|
|
78
|
+
ids, dispositions, captured = batch["expected_task_ids"], batch["dispositions"], batch["records"]
|
|
79
|
+
if (batch["protocol"] != "retail-capture-batch.v1" or batch["config_binding"] != binding
|
|
80
|
+
or len(ids) != len(set(ids)) or [row["task_id"] for row in dispositions] != ids
|
|
81
|
+
or any(row["status"] not in {"captured", "capture_failed", "reserved_unresolved"}
|
|
82
|
+
or row["retry_permitted"] is not False for row in dispositions)):
|
|
83
|
+
raise OfficialArenaError("Retail capture dispositions differ from the expected inventory")
|
|
84
|
+
records_by_id = {row["checkpoint_id"]: row for row in captured}
|
|
85
|
+
if len(records_by_id) != len(captured):
|
|
86
|
+
raise OfficialArenaError("Retail capture repeats a checkpoint")
|
|
87
|
+
receipt_files = {}
|
|
88
|
+
for row in dispositions:
|
|
89
|
+
task_id = row["task_id"]
|
|
90
|
+
path = root / f"first-capture-{task_id}.json"
|
|
91
|
+
if row["status"] == "reserved_unresolved":
|
|
92
|
+
if task_id in records_by_id or path.exists() or path.is_symlink():
|
|
93
|
+
raise OfficialArenaError("Retail unresolved capture changed during projection")
|
|
94
|
+
start = root / f"first-capture-{task_id}-start.json"
|
|
95
|
+
_read(start)
|
|
96
|
+
receipt_files[start.name] = sha256_file(start)
|
|
97
|
+
continue
|
|
98
|
+
saved = _saved_capture(path, binding=binding, task_id=task_id)
|
|
99
|
+
if row["status"] != saved["terminal"] or row["receipt_sha256"] != saved["receipt_sha256"]:
|
|
100
|
+
raise OfficialArenaError("Retail capture terminal receipt differs")
|
|
101
|
+
receipt_files[path.name] = sha256_file(path)
|
|
102
|
+
if row["status"] == "captured":
|
|
103
|
+
if records_by_id.get(task_id) != saved["record"]:
|
|
104
|
+
raise OfficialArenaError("Retail projected checkpoint differs from its receipt")
|
|
105
|
+
elif task_id in records_by_id:
|
|
106
|
+
raise OfficialArenaError("Retail failed capture cannot have a fabricated checkpoint")
|
|
107
|
+
successful = [row["task_id"] for row in dispositions if row["status"] == "captured"]
|
|
108
|
+
if set(records_by_id) != set(successful):
|
|
109
|
+
raise OfficialArenaError("Retail captured checkpoint inventory differs")
|
|
110
|
+
terminal = all(row["status"] != "reserved_unresolved" for row in dispositions)
|
|
111
|
+
if batch["all_tasks_terminal"] is not terminal:
|
|
112
|
+
raise OfficialArenaError("Retail batch terminality differs")
|
|
113
|
+
output = {"protocol": "retail-capture-inventory-disposition.v1", "scope_sha256": scope_sha256,
|
|
114
|
+
"phase": phase, "benchmark_id": "tau3.retail", "source_revision": SOURCE_REVISION,
|
|
115
|
+
"model_slot": model_slot, "config_binding": binding, "expected_task_ids": ids,
|
|
116
|
+
"expected_denominator": len(ids), "captured_task_ids": successful,
|
|
117
|
+
"dispositions": dispositions, "all_tasks_terminal": terminal,
|
|
118
|
+
"retry_permitted": False, "receipt_files": receipt_files,
|
|
119
|
+
"failure_endpoints": "capture failures are unresolved environment outcomes, not invented agent zeros"}
|
|
120
|
+
artifacts = {}
|
|
121
|
+
if terminal and captured:
|
|
122
|
+
# Reuse only the existing projection/validation, never its capture or
|
|
123
|
+
# replacing writer. Protected simulator history stays in its own file.
|
|
124
|
+
proxy = SimpleNamespace(benchmark_id="tau3.retail", source_revision=SOURCE_REVISION,
|
|
125
|
+
doctor=lambda _config: (), capture=lambda _config, **kwargs: captured)
|
|
126
|
+
visible, protected, units = _records(proxy, config, split=config["task_split_name"], output_root=root)
|
|
127
|
+
artifacts = {
|
|
128
|
+
"checkpoints.json": {"schema_version": 1, "protocol": CHECKPOINT_INVENTORY_PROTOCOL,
|
|
129
|
+
"checkpoint_count": len(visible), "checkpoints": visible},
|
|
130
|
+
"replays.json": {"schema_version": 1, "protocol": REPLAY_INVENTORY_PROTOCOL,
|
|
131
|
+
"benchmark_id": "tau3.retail", "source_revision": SOURCE_REVISION,
|
|
132
|
+
"record_count": len(protected), "records": protected},
|
|
133
|
+
"units.json": units,
|
|
134
|
+
}
|
|
135
|
+
output["inventory_content_sha256"] = {name: content_hash(value) for name, value in artifacts.items()}
|
|
136
|
+
snapshot = root / ("inventory-" + content_hash(output))
|
|
137
|
+
try:
|
|
138
|
+
snapshot.mkdir(mode=0o700)
|
|
139
|
+
except FileExistsError:
|
|
140
|
+
if snapshot.is_symlink() or _read(snapshot / "dispositions.json") != output:
|
|
141
|
+
raise OfficialArenaError("Retail inventory snapshot changed or is interrupted")
|
|
142
|
+
for name, value in artifacts.items():
|
|
143
|
+
path = snapshot / name
|
|
144
|
+
if path.is_symlink() or json.loads(path.read_bytes()) != value:
|
|
145
|
+
raise OfficialArenaError("Retail retained inventory artifact differs")
|
|
146
|
+
return {"snapshot": str(snapshot), "disposition": output}
|
|
147
|
+
for name, value in artifacts.items():
|
|
148
|
+
_create_only(snapshot / name, value)
|
|
149
|
+
_create_only(snapshot / "dispositions.json", output)
|
|
150
|
+
return {"snapshot": str(snapshot), "disposition": output}
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
def run(path: Path, checksum: str) -> Mapping[str, Any]:
|
|
154
|
+
provider = factory()
|
|
155
|
+
scope, config, root = _validated_scope(path, checksum, provider)
|
|
156
|
+
blockers = provider.doctor(config)
|
|
157
|
+
if blockers:
|
|
158
|
+
raise OfficialArenaError("Retail native capture preflight did not pass")
|
|
159
|
+
from tau2.runner.helpers import get_tasks
|
|
160
|
+
ids = [str(task.id) for task in get_tasks("retail", task_split_name=config["task_split_name"], num_tasks=config["limit"])]
|
|
161
|
+
if ids != scope["expected_task_ids"]:
|
|
162
|
+
raise OfficialArenaError("Retail scoped official task order differs")
|
|
163
|
+
batch = provider.capture_batch(config, output_root=root)
|
|
164
|
+
return project_batch(provider, config, batch, root=root, phase=scope["phase"],
|
|
165
|
+
model_slot=scope["model_slot"], scope_sha256=checksum)
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
def main() -> int:
|
|
169
|
+
parser = argparse.ArgumentParser(description="Run a bound first-attempt Retail capture batch")
|
|
170
|
+
parser.add_argument("--scope", type=Path, required=True)
|
|
171
|
+
parser.add_argument("--scope-sha256", required=True)
|
|
172
|
+
args = parser.parse_args()
|
|
173
|
+
try:
|
|
174
|
+
result = run(args.scope, args.scope_sha256)
|
|
175
|
+
except Exception as error:
|
|
176
|
+
print(json.dumps({"error": type(error).__name__, "message": "Retail capture rejected; inspect owned receipts"}), file=sys.stderr)
|
|
177
|
+
return 2
|
|
178
|
+
# No protected user history or visible request contents in the console.
|
|
179
|
+
disposition = result["disposition"]
|
|
180
|
+
print(json.dumps({"snapshot": result["snapshot"], "expected": disposition["expected_denominator"],
|
|
181
|
+
"captured": len(disposition["captured_task_ids"]),
|
|
182
|
+
"all_tasks_terminal": disposition["all_tasks_terminal"],
|
|
183
|
+
"formal_inference_started": False}, sort_keys=True))
|
|
184
|
+
return 0
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
if __name__ == "__main__":
|
|
188
|
+
raise SystemExit(main())
|
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""Durable, first-attempt-only Retail atomic worker.
|
|
3
|
+
|
|
4
|
+
The original generic worker and historical providers are unchanged. This
|
|
5
|
+
worker reuses their request/budget validators but never uses TemporaryDirectory.
|
|
6
|
+
An operator must bind an immutable scope after verifying the actual human
|
|
7
|
+
scope/environment choices; hash-shaped authorization references alone are not
|
|
8
|
+
proof of consent. No enabled real scope is generated by this module.
|
|
9
|
+
"""
|
|
10
|
+
from __future__ import annotations
|
|
11
|
+
|
|
12
|
+
import argparse
|
|
13
|
+
import hashlib
|
|
14
|
+
import json
|
|
15
|
+
import os
|
|
16
|
+
import re
|
|
17
|
+
import sys
|
|
18
|
+
from collections.abc import Mapping
|
|
19
|
+
from pathlib import Path
|
|
20
|
+
from typing import Any
|
|
21
|
+
|
|
22
|
+
if __package__ in {None, ""}:
|
|
23
|
+
sys.path.insert(0, str(Path(__file__).resolve().parents[2]))
|
|
24
|
+
|
|
25
|
+
from workers.official_arenas import driver as shared
|
|
26
|
+
from workers.official_arenas.protocol import (
|
|
27
|
+
OfficialArenaError, content_hash, intervention_usage, materialized_state,
|
|
28
|
+
merge_usage, resolve_shared_budget_config, sha256_file,
|
|
29
|
+
)
|
|
30
|
+
from workers.official_arenas.providers.tau_retail import SOURCE_REVISION, _create_only
|
|
31
|
+
|
|
32
|
+
SCOPE_PATH_ENV = "AILAB_RETAIL_EXECUTION_SCOPE"
|
|
33
|
+
SCOPE_SHA256_ENV = "AILAB_RETAIL_EXECUTION_SCOPE_SHA256"
|
|
34
|
+
SCOPE_PROTOCOL = "agentinputlab.retail-execution-scope.v1"
|
|
35
|
+
PROVIDER_ENTRYPOINT = "workers.official_arenas.providers.tau_retail:factory"
|
|
36
|
+
_SHA = re.compile(r"^[0-9a-f]{64}$")
|
|
37
|
+
_SCOPE_FIELDS = frozenset({"schema_version", "protocol", "source_revision", "phase", "execution_enabled",
|
|
38
|
+
"output_root", "provider_config_sha256", "provider_source_sha256", "worker_support_sha256",
|
|
39
|
+
"worker_source_sha256", "protocol_source_sha256", "provider_helper_sha256",
|
|
40
|
+
"authorizations", "allowed_cell_ids"})
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
class RetailAttemptUnavailable(OfficialArenaError):
|
|
44
|
+
"""Existing live/interrupted/unscored attempt must be inspected, not rerun."""
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def _reject_duplicate_keys(pairs):
|
|
48
|
+
result = {}
|
|
49
|
+
for key, value in pairs:
|
|
50
|
+
if key in result:
|
|
51
|
+
raise OfficialArenaError("Retail JSON has duplicate fields")
|
|
52
|
+
result[key] = value
|
|
53
|
+
return result
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
def _read(path: Path) -> Mapping[str, Any]:
|
|
57
|
+
if path.is_symlink() or not path.is_file():
|
|
58
|
+
raise OfficialArenaError("Retail bound file is absent or symlinked")
|
|
59
|
+
try:
|
|
60
|
+
value = json.loads(path.read_bytes(), object_pairs_hook=_reject_duplicate_keys)
|
|
61
|
+
content_hash(value) # also rejects non-finite numbers
|
|
62
|
+
except (ValueError, TypeError) as error:
|
|
63
|
+
raise OfficialArenaError("Retail bound file is invalid JSON") from error
|
|
64
|
+
if not isinstance(value, Mapping):
|
|
65
|
+
raise OfficialArenaError("Retail bound file must be an object")
|
|
66
|
+
return value
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
def cell_identity(request: Mapping[str, Any]) -> Mapping[str, Any]:
|
|
70
|
+
"""Logical cell identity excludes generated text, not method/budget/locks.
|
|
71
|
+
|
|
72
|
+
If a generated payload changes, its logical identity stays occupied and
|
|
73
|
+
its full request hash conflicts instead of silently becoming a new trial.
|
|
74
|
+
Different factors/intensities require their own frozen arm parameters.
|
|
75
|
+
"""
|
|
76
|
+
arms = []
|
|
77
|
+
for arm in sorted(request["arms"], key=lambda item: item["role"]):
|
|
78
|
+
payload = arm["payload"]
|
|
79
|
+
arms.append({"role": arm["role"], "arm_id": arm["arm_id"],
|
|
80
|
+
**{name: payload[name] for name in ("release_id", "profile_kind", "model_slot", "arm_parameters")},
|
|
81
|
+
"budget": materialized_state(payload)["budget"]})
|
|
82
|
+
return {**{name: request[name] for name in ("benchmark_id", "checkpoint_id", "source_revision",
|
|
83
|
+
"origin_state_hash", "replay_identity", "seed", "locked_dependency_hashes")}, "arms": arms}
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
def _validate_authorizations(approvals: Any) -> None:
|
|
87
|
+
# These are provenance references, not automatic verification of consent.
|
|
88
|
+
# The operator must verify the actual human messages before enabling a scope.
|
|
89
|
+
if not isinstance(approvals, Mapping) or set(approvals) != {"scope", "environment_models"}:
|
|
90
|
+
raise OfficialArenaError("Retail human choice references are incomplete")
|
|
91
|
+
for approval in approvals.values():
|
|
92
|
+
if (not isinstance(approval, Mapping) or set(approval) != {"source_kind", "thread_id", "message_sha256"}
|
|
93
|
+
or approval["source_kind"] != "human_message" or not isinstance(approval["thread_id"], str)
|
|
94
|
+
or not approval["thread_id"].strip() or not isinstance(approval["message_sha256"], str)
|
|
95
|
+
or _SHA.fullmatch(approval["message_sha256"]) is None):
|
|
96
|
+
raise OfficialArenaError("Retail human choice reference is invalid")
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
def _scope(parameters: Mapping[str, Any], request: Mapping[str, Any]):
|
|
100
|
+
path_text, expected = os.environ.get(SCOPE_PATH_ENV), os.environ.get(SCOPE_SHA256_ENV)
|
|
101
|
+
if not path_text or not expected or _SHA.fullmatch(expected) is None:
|
|
102
|
+
raise OfficialArenaError("Retail requires an explicitly bound execution scope")
|
|
103
|
+
path = Path(path_text)
|
|
104
|
+
value = _read(path)
|
|
105
|
+
if sha256_file(path) != expected or set(value) != _SCOPE_FIELDS:
|
|
106
|
+
raise OfficialArenaError("Retail execution scope differs")
|
|
107
|
+
if (type(value["schema_version"]) is not int or value["schema_version"] != 1
|
|
108
|
+
or value["protocol"] != SCOPE_PROTOCOL or value["source_revision"] != SOURCE_REVISION
|
|
109
|
+
or value["phase"] not in {"engineering", "formal"} or value["execution_enabled"] is not True):
|
|
110
|
+
raise OfficialArenaError("Retail execution scope is not enabled or valid")
|
|
111
|
+
_validate_authorizations(value["authorizations"])
|
|
112
|
+
files = {"provider_source_sha256": Path(__file__).parent / "providers/tau_retail.py",
|
|
113
|
+
"worker_support_sha256": Path(shared.__file__), "worker_source_sha256": Path(__file__),
|
|
114
|
+
"protocol_source_sha256": Path(__file__).parent / "protocol.py",
|
|
115
|
+
"provider_helper_sha256": Path(__file__).parent / "providers/tau3.py"}
|
|
116
|
+
for name, source in files.items():
|
|
117
|
+
if source.is_symlink() or value[name] != sha256_file(source):
|
|
118
|
+
raise OfficialArenaError("Retail worker source closure differs")
|
|
119
|
+
config_hash = content_hash(resolve_shared_budget_config(parameters["provider_config"]))
|
|
120
|
+
if value["provider_config_sha256"] != config_hash:
|
|
121
|
+
raise OfficialArenaError("Retail frozen provider config differs")
|
|
122
|
+
allowed = value["allowed_cell_ids"]
|
|
123
|
+
if (not isinstance(allowed, list) or not allowed
|
|
124
|
+
or any(not isinstance(item, str) or _SHA.fullmatch(item) is None for item in allowed)
|
|
125
|
+
or len(allowed) != len(set(allowed))):
|
|
126
|
+
raise OfficialArenaError("Retail frozen cell inventory is invalid")
|
|
127
|
+
identity = cell_identity(request)
|
|
128
|
+
cell_id = content_hash(identity)
|
|
129
|
+
if cell_id not in allowed:
|
|
130
|
+
raise OfficialArenaError("Retail cell is outside its approved frozen inventory")
|
|
131
|
+
root = Path(value["output_root"])
|
|
132
|
+
if (not root.is_absolute() or any(part.is_symlink() for part in (root, *root.parents))
|
|
133
|
+
or not root.is_dir() or root.stat().st_uid != os.getuid() or root.stat().st_mode & 0o077):
|
|
134
|
+
raise OfficialArenaError("Retail ledger root must be an existing owned private directory")
|
|
135
|
+
return value, expected, root / cell_id, identity
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
def _sealed(value: Mapping[str, Any]) -> dict[str, Any]:
|
|
139
|
+
return {**value, "receipt_sha256": content_hash(value)}
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
def _files(root: Path) -> dict[str, str]:
|
|
143
|
+
result = {}
|
|
144
|
+
for path in sorted(root.rglob("*")):
|
|
145
|
+
if path.is_symlink():
|
|
146
|
+
raise OfficialArenaError("Retail attempt contains a symlink")
|
|
147
|
+
if path.is_file() and path != root / "terminal.json":
|
|
148
|
+
result[str(path.relative_to(root))] = sha256_file(path)
|
|
149
|
+
return result
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
def _cached(root: Path, request_hash: str, scope_sha256: str):
|
|
153
|
+
if root.is_symlink() or not root.is_dir():
|
|
154
|
+
raise OfficialArenaError("Retail logical attempt directory is invalid")
|
|
155
|
+
start = _read(root / "pair-start.json")
|
|
156
|
+
if start.get("request_hash") != request_hash or start.get("scope_sha256") != scope_sha256:
|
|
157
|
+
raise OfficialArenaError("Retail existing logical cell has a different full request or scope")
|
|
158
|
+
if not (root / "terminal.json").exists():
|
|
159
|
+
raise RetailAttemptUnavailable("Retail attempt is live or interrupted; automatic retry is forbidden")
|
|
160
|
+
terminal = _read(root / "terminal.json")
|
|
161
|
+
body = {key: value for key, value in terminal.items() if key != "receipt_sha256"}
|
|
162
|
+
if (terminal.get("receipt_sha256") != content_hash(body) or terminal.get("request_hash") != request_hash
|
|
163
|
+
or terminal.get("scope_sha256") != scope_sha256 or terminal.get("files") != _files(root)):
|
|
164
|
+
raise OfficialArenaError("Retail terminal or raw trajectory evidence differs")
|
|
165
|
+
if terminal.get("status") != "paired_scored":
|
|
166
|
+
raise RetailAttemptUnavailable("Retail failed attempt is retained and terminal; automatic retry is forbidden")
|
|
167
|
+
response = _read(root / "response.json")
|
|
168
|
+
if content_hash(response) != terminal.get("response_sha256"):
|
|
169
|
+
raise OfficialArenaError("Retail retained response differs")
|
|
170
|
+
return response
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
def run(value: Any) -> Mapping[str, Any]:
|
|
174
|
+
if not isinstance(value, Mapping) or set(value) != shared._ROOT_FIELDS:
|
|
175
|
+
raise OfficialArenaError("Retail atomic envelope fields differ")
|
|
176
|
+
if type(value["schema_version"]) is not int or value["schema_version"] != 1 or value["protocol"] != shared.REQUEST_PROTOCOL:
|
|
177
|
+
raise OfficialArenaError("Retail atomic envelope protocol differs")
|
|
178
|
+
base = {name: value[name] for name in shared._ROOT_FIELDS - {"request_hash"}}
|
|
179
|
+
if value["request_hash"] != content_hash(base):
|
|
180
|
+
raise OfficialArenaError("Retail full request hash differs")
|
|
181
|
+
parameters, request = shared._parameters(value["worker_parameters"]), shared._atomic_request(value["atomic_request"])
|
|
182
|
+
if (parameters["provider_entrypoint"] != PROVIDER_ENTRYPOINT or request["benchmark_id"] != "tau3.retail"
|
|
183
|
+
or request["source_revision"] != SOURCE_REVISION or request["seed"] != 17):
|
|
184
|
+
raise OfficialArenaError("Retail cannot run another provider, domain, source or seed")
|
|
185
|
+
records = shared._inventory(parameters)
|
|
186
|
+
replay = records.get(request["checkpoint_id"])
|
|
187
|
+
if (records["__inventory__"] != {"benchmark_id": "tau3.retail", "source_revision": SOURCE_REVISION}
|
|
188
|
+
or replay is None or any(replay[name] != request[name] for name in ("origin_state_hash", "replay_identity"))):
|
|
189
|
+
raise OfficialArenaError("Retail protected replay identity differs")
|
|
190
|
+
shared._validate_dependency_binding(request=request, parameters=parameters, replay_record=replay)
|
|
191
|
+
_, scope_sha, root, identity = _scope(parameters, request)
|
|
192
|
+
provider = shared._provider(PROVIDER_ENTRYPOINT)
|
|
193
|
+
if (provider.benchmark_id != request["benchmark_id"] or provider.source_revision != SOURCE_REVISION
|
|
194
|
+
or provider.scorer_id != parameters["scorer_id"] or provider.scorer_revision != parameters["scorer_revision"]):
|
|
195
|
+
raise OfficialArenaError("Retail provider identity differs from the worker lock")
|
|
196
|
+
blockers = provider.doctor(parameters["provider_config"])
|
|
197
|
+
if blockers:
|
|
198
|
+
raise OfficialArenaError("Retail native preflight did not pass")
|
|
199
|
+
try:
|
|
200
|
+
root.mkdir(mode=0o700)
|
|
201
|
+
except FileExistsError:
|
|
202
|
+
return _cached(root, value["request_hash"], scope_sha)
|
|
203
|
+
_create_only(root / "pair-start.json", {"request_hash": value["request_hash"], "scope_sha256": scope_sha,
|
|
204
|
+
"cell_identity": identity, "pid": os.getpid(), "uid": os.getuid(), "retry_permitted": False})
|
|
205
|
+
_create_only(root / "request.json", value)
|
|
206
|
+
results, receipts, failures, runtime_ids = [], [], [], set()
|
|
207
|
+
for arm in sorted(request["arms"], key=lambda item: item["role"]):
|
|
208
|
+
role, work = arm["role"], root / arm["role"]
|
|
209
|
+
work.mkdir(mode=0o700)
|
|
210
|
+
try:
|
|
211
|
+
result = provider.run_arm(parameters["provider_config"], replay_record=replay,
|
|
212
|
+
arm_payload=arm["payload"], seed=17, role=role, work_dir=work)
|
|
213
|
+
# Preserve raw evidence even if the following budget/runtime audit fails.
|
|
214
|
+
_create_only(work / "trace.json", dict(result.trace))
|
|
215
|
+
if result.runtime_instance_id in runtime_ids:
|
|
216
|
+
raise OfficialArenaError("Retail paired arms reused one native runtime")
|
|
217
|
+
runtime_ids.add(result.runtime_instance_id)
|
|
218
|
+
usage = merge_usage(intervention_usage(arm["payload"]), result.usage)
|
|
219
|
+
shared._validate_shared_budget_usage(arm["payload"], usage)
|
|
220
|
+
# The host process bridge accepts exactly these five public fields.
|
|
221
|
+
# Additional diagnostics belong in retained private arm evidence,
|
|
222
|
+
# not in a response that the bridge will reject as schema drift.
|
|
223
|
+
row = {"role": role, "arm_id": arm["arm_id"], "metrics": dict(result.metrics),
|
|
224
|
+
"trace_hash": content_hash(result.trace),
|
|
225
|
+
"usage": {name: usage[name] for name in shared._USAGE_FIELDS}}
|
|
226
|
+
results.append(row)
|
|
227
|
+
receipts.append({"role": role, "arm_id": arm["arm_id"], "origin_state_hash": request["origin_state_hash"],
|
|
228
|
+
"replay_identity": request["replay_identity"], "seed": 17, "locked_dependency_hashes": request["locked_dependency_hashes"],
|
|
229
|
+
"runtime_instance_id": result.runtime_instance_id, "completed": True})
|
|
230
|
+
outcome = {"status": "scored_terminal", "result": row,
|
|
231
|
+
"trace_measurement": shared._safe_trace_measurement(result.trace),
|
|
232
|
+
"intervention_failure": shared._intervention_failure(arm["payload"])}
|
|
233
|
+
except Exception as error:
|
|
234
|
+
outcome = {"status": "failed_unscored", "exception_type": type(error).__name__,
|
|
235
|
+
"exception_sha256": hashlib.sha256(str(error).encode()).hexdigest(),
|
|
236
|
+
"retry_permitted": False, "paper_endpoint": None}
|
|
237
|
+
failures.append(role)
|
|
238
|
+
_create_only(work / "arm-outcome.json", _sealed(outcome))
|
|
239
|
+
response = None
|
|
240
|
+
if not failures:
|
|
241
|
+
receipt = {**{name: request[name] for name in ("benchmark_id", "checkpoint_id", "source_revision",
|
|
242
|
+
"origin_state_hash", "replay_identity", "seed", "locked_dependency_hashes")},
|
|
243
|
+
**{name: parameters[name] for name in ("bridge_id", "bridge_revision", "scorer_id", "scorer_revision")}, "arms": receipts}
|
|
244
|
+
response = {"schema_version": 1, "protocol": shared.RESPONSE_PROTOCOL,
|
|
245
|
+
"request_hash": value["request_hash"], "receipt": receipt, "arms": results}
|
|
246
|
+
_create_only(root / "response.json", response)
|
|
247
|
+
terminal = {"protocol": "retail-pair-terminal.v1", "request_hash": value["request_hash"], "scope_sha256": scope_sha,
|
|
248
|
+
"status": "failed_unscored" if failures else "paired_scored", "failed_roles": failures,
|
|
249
|
+
"physical_arm_attempts": 2, "retry_permitted": False, "files": _files(root),
|
|
250
|
+
"response_sha256": content_hash(response) if response else None}
|
|
251
|
+
_create_only(root / "terminal.json", _sealed(terminal))
|
|
252
|
+
if failures:
|
|
253
|
+
raise RetailAttemptUnavailable("Retail arm failure retained; both arms have dispositions, no retry")
|
|
254
|
+
return response
|
|
255
|
+
|
|
256
|
+
|
|
257
|
+
def main() -> int:
|
|
258
|
+
parser = argparse.ArgumentParser(description="Execute one frozen Retail pair, retaining first attempts")
|
|
259
|
+
parser.add_argument("--doctor", action="store_true")
|
|
260
|
+
args = parser.parse_args()
|
|
261
|
+
if args.doctor:
|
|
262
|
+
print(json.dumps({"protocol": shared.WORKER_PROTOCOL, "worker_available": True,
|
|
263
|
+
"scientific_ready": False, "requires_bound_execution_scope": True}))
|
|
264
|
+
return 0
|
|
265
|
+
try:
|
|
266
|
+
response = run(json.load(sys.stdin, object_pairs_hook=_reject_duplicate_keys))
|
|
267
|
+
except Exception as error:
|
|
268
|
+
print(json.dumps({"error": type(error).__name__, "message": "Retail rejected or retained an unscored attempt; inspect owned ledger"}), file=sys.stderr)
|
|
269
|
+
return 2
|
|
270
|
+
print(json.dumps(response, sort_keys=True, ensure_ascii=False, allow_nan=False))
|
|
271
|
+
return 0
|
|
272
|
+
|
|
273
|
+
|
|
274
|
+
if __name__ == "__main__":
|
|
275
|
+
raise SystemExit(main())
|
workers/qrag/README.md
ADDED
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
# Q-RAG frozen-checkpoint sidecar
|
|
2
|
+
|
|
3
|
+
This directory is an **inference-only compatibility bridge** for
|
|
4
|
+
`griver/Q-RAG@e7598130b63eaab868469877e88bcacc59a44efb`. It does not vendor the
|
|
5
|
+
upstream checkout, checkpoint, tokenizer, base embedder, datasets, or reader.
|
|
6
|
+
It does not expose RL/PQN training.
|
|
7
|
+
|
|
8
|
+
The bounded common-support profile is executable with the repository-level
|
|
9
|
+
driver below. It uses the same six BM25 candidates for both paired arms, lets
|
|
10
|
+
the released frozen policy select exactly two real candidate documents, and
|
|
11
|
+
passes only those documents to the shared downstream LLM. This is the profile
|
|
12
|
+
used for cross-family comparison; it remains distinct from paper-result parity.
|
|
13
|
+
|
|
14
|
+
## Release boundary
|
|
15
|
+
|
|
16
|
+
- Source: user-mounted, read-only, repository license `NOASSERTION`. The
|
|
17
|
+
upstream README claims CC BY 4.0, but there is no root `LICENSE`; the source
|
|
18
|
+
acknowledgement is a risk acknowledgement, not legal clearance.
|
|
19
|
+
- Checkpoint: user-mounted
|
|
20
|
+
`Q-RAG/qrag-ft-e5-on-hotpotqa@e0e48389...`, separately acknowledged as
|
|
21
|
+
CC BY 4.0. `model_best.pt` and `config.yaml` are hash-pinned.
|
|
22
|
+
- Embedder: user-mounted
|
|
23
|
+
`intfloat/multilingual-e5-large@3d7cfbda...`; mutable `main` is rejected.
|
|
24
|
+
- Reader: a separately pinned controlled factor. The base profile records the
|
|
25
|
+
upstream QwQ-32B family, but does not claim that the paper's exact reader
|
|
26
|
+
snapshot is recoverable.
|
|
27
|
+
|
|
28
|
+
Accordingly, the public result is `controlled_adapter`, not end-to-end
|
|
29
|
+
`official_native` parity. The registry's `native_only` status means only the
|
|
30
|
+
released checkpoint treatment is eligible; it is not a parity claim.
|
|
31
|
+
|
|
32
|
+
## Preserved algorithm path
|
|
33
|
+
|
|
34
|
+
The sidecar runtime must call the official candidate/environment construction,
|
|
35
|
+
`PQN.select_action(..., random=False, evaluate=True)`, and `QAEnv.step`. Every
|
|
36
|
+
step records the available candidate indices, full finite Q-values, selected
|
|
37
|
+
index/Q-value, and accumulated selected document IDs. Q-RAG has no stop action:
|
|
38
|
+
termination is `fixed_step_budget`, `candidate_exhausted`, or
|
|
39
|
+
`empty_candidates`.
|
|
40
|
+
|
|
41
|
+
To avoid evaluation-label leakage, the runtime must construct `answer=""` and
|
|
42
|
+
`sf_idx=[]` internally and use upstream `DummyFeedbackModel`. It must never
|
|
43
|
+
load `GroundTruthFeedback`, compute EM/F1/reward, import `train_q_rag.py`, or
|
|
44
|
+
call optimizer/scheduler/update/save methods. This changes the paper's
|
|
45
|
+
ground-truth-assisted early termination and is why parity is not claimed.
|
|
46
|
+
|
|
47
|
+
## Security contract
|
|
48
|
+
|
|
49
|
+
The published 20 GB `model_best.pt` is a pickle checkpoint and upstream
|
|
50
|
+
`PQN.load` calls `torch.load(weights_only=False)`. Do **not** call that loader.
|
|
51
|
+
The dedicated runtime must use `torch.load(..., weights_only=True)`, validate
|
|
52
|
+
the expected inference keys, and call inference-module `load_state_dict` with
|
|
53
|
+
`strict=True`; optimizer and scheduler state are ignored. Run as non-root with
|
|
54
|
+
no network during selector construction, read-only mounts, no host secrets,
|
|
55
|
+
and CPU/GPU/memory/time limits. For production, a one-time isolated conversion
|
|
56
|
+
to a tensor-only artifact is preferred and must bind both source and converted
|
|
57
|
+
manifests.
|
|
58
|
+
|
|
59
|
+
The released file also serializes an OmegaConf `ListConfig` inside ignored
|
|
60
|
+
scheduler state. The common-support runtime therefore wraps the weights-only
|
|
61
|
+
load in a scoped allowlist containing only the inert OmegaConf metadata/node
|
|
62
|
+
constructors and built-in containers required by this exact pinned artifact.
|
|
63
|
+
Any other Python global still fails closed; the unsafe upstream loader is never
|
|
64
|
+
called.
|
|
65
|
+
|
|
66
|
+
`QRAGFrozenDriver` performs all license, source, checkpoint, embedder,
|
|
67
|
+
candidate order, profile, horizon, Q-value, usage, and response-attestation
|
|
68
|
+
checks before returning a successful envelope. `runtime_factory` and `reader`
|
|
69
|
+
are explicit dependency seams; the CI fake uses them without weakening the
|
|
70
|
+
production manifest.
|
|
71
|
+
|
|
72
|
+
### Reader budget configuration (protocol v3)
|
|
73
|
+
|
|
74
|
+
`QRAGControls(max_output_tokens=...)` sets the reader's per-call output ceiling;
|
|
75
|
+
4000 is the upstream default, not a hard minimum. `ExecutionBudget` independently
|
|
76
|
+
sets cumulative run limits. The effective reader cap is the smaller of the
|
|
77
|
+
configured ceiling and remaining output tokens. With no remaining tokens or
|
|
78
|
+
model calls, execution stops before constructing the selector runtime.
|
|
79
|
+
|
|
80
|
+
The reader callable has the signature
|
|
81
|
+
`reader(question, passages, artifacts, *, max_output_tokens) -> ReaderResult`.
|
|
82
|
+
It must send that effective ceiling to its actual model request, use its pinned
|
|
83
|
+
deployment, and avoid hidden retries. A legacy three-argument reader is rejected
|
|
84
|
+
before selector work. Return actual provider input/output usage, including
|
|
85
|
+
reasoning tokens where reported; do not replace missing usage with zero.
|
|
86
|
+
|
|
87
|
+
Both ends bind and verify the requested/effective budget in the v3 envelope.
|
|
88
|
+
The response records `reader_budget`, including `preset="upstream_default"` or
|
|
89
|
+
`"custom"`; actual usage above the effective ceiling is a consumed failure.
|
|
90
|
+
v2 requests/responses are not silently accepted under this changed contract.
|
|
91
|
+
No checkpoint, selector horizon, prompt or historical result changes with this
|
|
92
|
+
configuration support. End-to-end paper parity is not claimed for either budget.
|
|
93
|
+
|
|
94
|
+
### Explicit instruction-preserving QA adapter
|
|
95
|
+
|
|
96
|
+
`reader_profile="factorial_instruction_preserving_reader_transfer"` is an
|
|
97
|
+
opt-in transfer variant, with `QRAG_INSTRUCTION_PROMPT_SHA256` and protocol
|
|
98
|
+
`agentinputlab.qrag.instruction_reader.v1`. The original two question-only
|
|
99
|
+
profiles retain protocol v3 and their original prompts. They are not silently
|
|
100
|
+
converted into this adapter.
|
|
101
|
+
|
|
102
|
+
Its callback must accept `max_output_tokens`, `task_instruction` and
|
|
103
|
+
`passage_annotations` as keyword arguments. Call the shipped
|
|
104
|
+
`render_instruction_reader_prompt(question, passages, task_instruction=...,
|
|
105
|
+
passage_annotations=...)` and use `QRAG_INSTRUCTION_SYSTEM_PROMPT` in the
|
|
106
|
+
actual model request. Task instruction and visible passage annotations are
|
|
107
|
+
hash-bound, preserved in selection order, and included only in the reader;
|
|
108
|
+
the frozen selector's question/candidate input is unchanged. This variant
|
|
109
|
+
rejects conversation history and tool execution. No labels reach the policy.
|
|
110
|
+
|
|
111
|
+
The final JSON schema contains `answer` and the three string arrays
|
|
112
|
+
`support_ids`, `evidence_ids`, `evidence_texts`. The parser accepts explicit
|
|
113
|
+
final JSON, not reasoning salvage or automatic evidence inference. Score the
|
|
114
|
+
model's predictions with the original benchmark adapter, retain zero scores
|
|
115
|
+
and malformed outputs, and record actual costs without retries. This is a
|
|
116
|
+
labelled prompt/input adaptation, not upstream native parity.
|
|
117
|
+
|
|
118
|
+
IR native-query decoding is a separate opt-in postprocessor:
|
|
119
|
+
`parse_native_query_reader_answer(final_text)`, identified by
|
|
120
|
+
`QRAG_NATIVE_QUERY_DECODER_ID`/`QRAG_NATIVE_QUERY_DECODER_SHA256`. It accepts
|
|
121
|
+
exact final `{"query": "nonempty text"}` JSON, not a QA wrapper or inferred
|
|
122
|
+
query. The worker's generated text, prompts, budgets and usage stay unchanged.
|
|
123
|
+
Use the returned query with the original corpus/ranker/native scorer, retain
|
|
124
|
+
the raw output and any original QA-decoding rejection, and record the selected
|
|
125
|
+
decoder alongside the new score. This path does not retry generation.
|
|
126
|
+
|
|
127
|
+
The pinned upstream `DummyFeedbackModel` omits the abstract `reset` method and
|
|
128
|
+
therefore cannot be instantiated with current Python ABC enforcement. The
|
|
129
|
+
runtime supplies only that missing lifecycle method by delegating to the
|
|
130
|
+
upstream `AFeedbackModel.reset`; it does not alter feedback, reward,
|
|
131
|
+
termination, candidate construction, Q-values, or the two-step PQN policy.
|
|
132
|
+
|
|
133
|
+
## Installed common-support API
|
|
134
|
+
|
|
135
|
+
Install the `qrag` extra in the dedicated non-root environment. Source,
|
|
136
|
+
checkpoint and embedder mounts remain operator-provided; acknowledge their
|
|
137
|
+
separate licenses before execution. The public distribution does not include
|
|
138
|
+
research campaign scripts or previous experiment results.
|
|
139
|
+
|
|
140
|
+
The installed API is
|
|
141
|
+
`agentinputlab.algorithms.acquire.qrag.LocalQRAGFrozenPolicyRuntime`. Construct
|
|
142
|
+
it with `source_root`, `checkpoint_root`, `embedder_root`,
|
|
143
|
+
`compatibility_manifest_path`, `compatibility_manifest_sha256`,
|
|
144
|
+
`embedder_manifest_sha256` and an explicit `device` (`cpu` or the operator's
|
|
145
|
+
authorized CUDA device). Both manifest hashes use
|
|
146
|
+
`agentinputlab.contracts.serialization.content_hash` on their parsed JSON
|
|
147
|
+
objects. The compatibility policy ships as
|
|
148
|
+
`workers/qrag/compatibility_manifest.json`; the embedder manifest belongs to
|
|
149
|
+
the mounted snapshot.
|
|
150
|
+
|
|
151
|
+
Pass this runtime as `InterventionContext.external_runtime` and a real
|
|
152
|
+
candidate retriever as `InterventionContext.retriever` when running
|
|
153
|
+
`QRAGCommonSupport` through `InterventionRunner`. The runtime loads only the
|
|
154
|
+
frozen selector; the caller runs and scores its separately bound downstream
|
|
155
|
+
model. Construct one runtime per isolated process to avoid sharing upstream
|
|
156
|
+
global PyTorch device or random state with unrelated applications.
|
|
157
|
+
|
|
158
|
+
`QRAGFrozenDriver` is a separate selector-plus-reader integration class, not a
|
|
159
|
+
ready-made command-line server. `python -m workers.qrag.driver` intentionally
|
|
160
|
+
exits with deployment guidance until an operator supplies its runtime and
|
|
161
|
+
reader. Do not point users at unpublished research-only script paths.
|
|
162
|
+
|
|
163
|
+
## Checks
|
|
164
|
+
|
|
165
|
+
```bash
|
|
166
|
+
PYTHONPATH=src:. python -m pytest -q tests/workers/test_qrag_worker_driver.py
|
|
167
|
+
PYTHONPATH=src:. python -m pytest -q tests/algorithms/unit/test_remaining_runtime.py -k qrag
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
Set `AGENTINPUTLAB_RUN_REAL_QRAG_IMPORT_SMOKE=1` and
|
|
171
|
+
`AGENTINPUTLAB_QRAG_CHECKOUT=/read-only/Q-RAG` to run the opt-in symbol/hash
|
|
172
|
+
smoke. It does not deserialize or download a checkpoint.
|
workers/qrag/__init__.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""User-mounted Q-RAG frozen-checkpoint worker."""
|