castform 0.2.2.dev0__tar.gz → 0.2.3__tar.gz

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.
Files changed (239) hide show
  1. {castform-0.2.2.dev0 → castform-0.2.3}/PKG-INFO +10 -10
  2. {castform-0.2.2.dev0 → castform-0.2.3}/README.md +4 -2
  3. {castform-0.2.2.dev0 → castform-0.2.3}/pyproject.toml +6 -7
  4. {castform-0.2.2.dev0 → castform-0.2.3}/src/castform/cli/scaffold/CLAUDE.md +13 -4
  5. castform-0.2.3/src/castform/cli/scaffold/HARBOR_STARTER.md +50 -0
  6. {castform-0.2.2.dev0 → castform-0.2.3}/src/castform/cli/scaffold/STARTER.md +18 -5
  7. castform-0.2.3/src/castform/cli/scaffold/generic_env_tests.py +92 -0
  8. {castform-0.2.2.dev0 → castform-0.2.3}/src/castform/cli/scaffold/generic_main.py +60 -32
  9. castform-0.2.3/src/castform/cli/scaffold/harbor_env_tests.py +64 -0
  10. castform-0.2.3/src/castform/cli/scaffold/harbor_main.py +283 -0
  11. {castform-0.2.2.dev0 → castform-0.2.3}/src/castform/cli/scaffold/skills/design-environment/SKILL.md +19 -3
  12. {castform-0.2.2.dev0 → castform-0.2.3}/src/castform/cli/scaffold/skills/generate-data/SKILL.md +19 -9
  13. {castform-0.2.2.dev0 → castform-0.2.3}/src/castform/cli/scaffold/skills/launch-run/SKILL.md +9 -1
  14. {castform-0.2.2.dev0 → castform-0.2.3}/src/castform/cli/scaffold/skills/verify-environment/SKILL.md +10 -0
  15. {castform-0.2.2.dev0 → castform-0.2.3}/src/castform/cli/setup.py +68 -50
  16. {castform-0.2.2.dev0 → castform-0.2.3}/src/castform/model_auth.py +2 -49
  17. {castform-0.2.2.dev0 → castform-0.2.3}/src/castform/platform/client.py +8 -1
  18. castform-0.2.3/src/castform/rag/chunkers/__init__.py +1 -0
  19. {castform-0.2.2.dev0 → castform-0.2.3}/src/castform/rag/chunkers/email.py +1 -1
  20. {castform-0.2.2.dev0 → castform-0.2.3}/src/castform/rag/chunkers/inspector.py +1 -1
  21. {castform-0.2.2.dev0 → castform-0.2.3}/src/castform/rag/chunkers/markdown.py +1 -1
  22. {castform-0.2.2.dev0 → castform-0.2.3}/src/castform/rag/chunkers/models.py +1 -1
  23. {castform-0.2.2.dev0 → castform-0.2.3}/src/castform/rag/chunkers/storage.py +1 -1
  24. {castform-0.2.2.dev0 → castform-0.2.3}/src/castform/rag/corpus/chroma/client.py +2 -3
  25. {castform-0.2.2.dev0 → castform-0.2.3}/src/castform/rag/corpus/pinecone/index_client.py +2 -2
  26. {castform-0.2.2.dev0 → castform-0.2.3}/src/castform/rag/corpus/postgres/client.py +1 -2
  27. castform-0.2.3/src/castform/rag/corpus/search_schema/__init__.py +1 -0
  28. {castform-0.2.2.dev0 → castform-0.2.3}/src/castform/rag/corpus/search_schema/builders.py +1 -1
  29. {castform-0.2.2.dev0 → castform-0.2.3}/src/castform/rag/corpus/search_schema/dsl_parser.py +1 -1
  30. {castform-0.2.2.dev0 → castform-0.2.3}/src/castform/rag/corpus/search_schema/search_exceptions.py +1 -1
  31. {castform-0.2.2.dev0 → castform-0.2.3}/src/castform/rag/corpus/search_schema/search_types.py +1 -1
  32. {castform-0.2.2.dev0 → castform-0.2.3}/src/castform/rag/corpus/source.py +1 -1
  33. castform-0.2.3/src/castform/rag/example_data.py +308 -0
  34. {castform-0.2.2.dev0 → castform-0.2.3}/src/castform/rag/preprocess/email/schema.py +1 -1
  35. {castform-0.2.2.dev0 → castform-0.2.3}/src/castform/validation.py +82 -5
  36. {castform-0.2.2.dev0 → castform-0.2.3}/tests/unit/platform/test_client.py +24 -0
  37. {castform-0.2.2.dev0 → castform-0.2.3}/tests/unit/rag/chunkers/test_builders.py +1 -1
  38. {castform-0.2.2.dev0 → castform-0.2.3}/tests/unit/rag/chunkers/test_chunk_models.py +1 -1
  39. {castform-0.2.2.dev0 → castform-0.2.3}/tests/unit/rag/corpus/test_search_types.py +1 -1
  40. {castform-0.2.2.dev0 → castform-0.2.3}/tests/unit/rag/corpus/tpuf/test_content_field.py +1 -12
  41. {castform-0.2.2.dev0 → castform-0.2.3}/tests/unit/rag/test_chunkers.py +1 -1
  42. castform-0.2.3/tests/unit/rag/test_example_data.py +128 -0
  43. {castform-0.2.2.dev0 → castform-0.2.3}/tests/unit/test_cli_setup.py +53 -110
  44. castform-0.2.3/tests/unit/test_example_validation_contract.py +33 -0
  45. castform-0.2.3/tests/unit/test_harbor_scaffold_runner.py +141 -0
  46. {castform-0.2.2.dev0 → castform-0.2.3}/tests/unit/test_scaffold_runner.py +144 -25
  47. {castform-0.2.2.dev0 → castform-0.2.3}/tests/unit/test_validation.py +312 -1
  48. castform-0.2.2.dev0/src/castform/cli/scaffold/generic_env_tests.py +0 -57
  49. castform-0.2.2.dev0/src/castform/cli/scaffold/rag_eval_dataset.jsonl +0 -1
  50. castform-0.2.2.dev0/src/castform/cli/scaffold/rag_main.py +0 -401
  51. castform-0.2.2.dev0/src/castform/cli/scaffold/rag_train_dataset.jsonl +0 -2
  52. castform-0.2.2.dev0/src/castform/rag/corpus/chroma/search.py +0 -213
  53. castform-0.2.2.dev0/src/castform/rag/corpus/embed.py +0 -80
  54. castform-0.2.2.dev0/src/castform/rag/corpus/pinecone/search.py +0 -131
  55. castform-0.2.2.dev0/src/castform/rag/corpus/postgres/search.py +0 -121
  56. castform-0.2.2.dev0/src/castform/rag/corpus/search_client.py +0 -64
  57. castform-0.2.2.dev0/src/castform/rag/corpus/turbopuffer/search.py +0 -222
  58. castform-0.2.2.dev0/src/castform/rag/preprocess/email/__init__.py +0 -0
  59. castform-0.2.2.dev0/src/castform/traces/braintrust/__init__.py +0 -0
  60. castform-0.2.2.dev0/tests/unit/rag/corpus/chroma/test_search.py +0 -200
  61. castform-0.2.2.dev0/tests/unit/rag/corpus/pinecone/test_search.py +0 -114
  62. castform-0.2.2.dev0/tests/unit/rag/corpus/postgres/test_search.py +0 -147
  63. castform-0.2.2.dev0/tests/unit/rag/corpus/test_embed.py +0 -126
  64. castform-0.2.2.dev0/tests/unit/rag/corpus/test_search_client_conformance.py +0 -111
  65. castform-0.2.2.dev0/tests/unit/rag/corpus/tpuf/test_search.py +0 -79
  66. {castform-0.2.2.dev0 → castform-0.2.3}/.gitignore +0 -0
  67. {castform-0.2.2.dev0 → castform-0.2.3}/pytest.ini +0 -0
  68. {castform-0.2.2.dev0 → castform-0.2.3}/src/castform/__init__.py +0 -0
  69. {castform-0.2.2.dev0 → castform-0.2.3}/src/castform/cli/__init__.py +0 -0
  70. {castform-0.2.2.dev0 → castform-0.2.3}/src/castform/cli/_auth.py +0 -0
  71. {castform-0.2.2.dev0 → castform-0.2.3}/src/castform/cli/_client.py +0 -0
  72. {castform-0.2.2.dev0 → castform-0.2.3}/src/castform/cli/_output.py +0 -0
  73. {castform-0.2.2.dev0 → castform-0.2.3}/src/castform/cli/_preflight.py +0 -0
  74. {castform-0.2.2.dev0 → castform-0.2.3}/src/castform/cli/control.py +0 -0
  75. {castform-0.2.2.dev0 → castform-0.2.3}/src/castform/cli/doctor.py +0 -0
  76. {castform-0.2.2.dev0 → castform-0.2.3}/src/castform/cli/help.py +0 -0
  77. {castform-0.2.2.dev0 → castform-0.2.3}/src/castform/cli/runs.py +0 -0
  78. {castform-0.2.2.dev0 → castform-0.2.3}/src/castform/cli/scaffold/__init__.py +0 -0
  79. {castform-0.2.2.dev0 → castform-0.2.3}/src/castform/cli/scaffold/generic_eval_dataset.jsonl +0 -0
  80. {castform-0.2.2.dev0 → castform-0.2.3}/src/castform/cli/scaffold/generic_train_dataset.jsonl +0 -0
  81. {castform-0.2.2.dev0 → castform-0.2.3}/src/castform/cli/scaffold/skills/view-progress/SKILL.md +0 -0
  82. {castform-0.2.2.dev0 → castform-0.2.3}/src/castform/cli/scaffold/tests_conftest.py +0 -0
  83. {castform-0.2.2.dev0 → castform-0.2.3}/src/castform/config.py +0 -0
  84. {castform-0.2.2.dev0 → castform-0.2.3}/src/castform/platform/__init__.py +0 -0
  85. {castform-0.2.2.dev0 → castform-0.2.3}/src/castform/platform/browser.py +0 -0
  86. {castform-0.2.2.dev0 → castform-0.2.3}/src/castform/platform/config.py +0 -0
  87. {castform-0.2.2.dev0 → castform-0.2.3}/src/castform/platform/credentials.py +0 -0
  88. {castform-0.2.2.dev0 → castform-0.2.3}/src/castform/platform/device_auth.py +0 -0
  89. {castform-0.2.2.dev0 → castform-0.2.3}/src/castform/platform/environment_assets.py +0 -0
  90. {castform-0.2.2.dev0 → castform-0.2.3}/src/castform/platform/exceptions.py +0 -0
  91. {castform-0.2.2.dev0 → castform-0.2.3}/src/castform/platform/login.py +0 -0
  92. {castform-0.2.2.dev0 → castform-0.2.3}/src/castform/platform/model_session.py +0 -0
  93. {castform-0.2.2.dev0 → castform-0.2.3}/src/castform/profile_config.py +0 -0
  94. {castform-0.2.2.dev0 → castform-0.2.3}/src/castform/rag/corpus/__init__.py +0 -0
  95. {castform-0.2.2.dev0/src/castform/rag/chunkers → castform-0.2.3/src/castform/rag/corpus/chroma}/__init__.py +0 -0
  96. {castform-0.2.2.dev0 → castform-0.2.3}/src/castform/rag/corpus/chroma/files.py +0 -0
  97. {castform-0.2.2.dev0 → castform-0.2.3}/src/castform/rag/corpus/chroma/filter_mapper.py +0 -0
  98. {castform-0.2.2.dev0 → castform-0.2.3}/src/castform/rag/corpus/chroma/source.py +0 -0
  99. {castform-0.2.2.dev0/src/castform/rag/corpus/chroma → castform-0.2.3/src/castform/rag/corpus/pinecone}/__init__.py +0 -0
  100. {castform-0.2.2.dev0 → castform-0.2.3}/src/castform/rag/corpus/pinecone/files.py +0 -0
  101. {castform-0.2.2.dev0 → castform-0.2.3}/src/castform/rag/corpus/pinecone/filter_mapper.py +0 -0
  102. {castform-0.2.2.dev0 → castform-0.2.3}/src/castform/rag/corpus/pinecone/source.py +0 -0
  103. {castform-0.2.2.dev0/src/castform/rag/corpus/pinecone → castform-0.2.3/src/castform/rag/corpus/postgres}/__init__.py +0 -0
  104. {castform-0.2.2.dev0 → castform-0.2.3}/src/castform/rag/corpus/postgres/exceptions.py +0 -0
  105. {castform-0.2.2.dev0 → castform-0.2.3}/src/castform/rag/corpus/postgres/filter_mapper.py +0 -0
  106. {castform-0.2.2.dev0 → castform-0.2.3}/src/castform/rag/corpus/postgres/models.py +0 -0
  107. {castform-0.2.2.dev0 → castform-0.2.3}/src/castform/rag/corpus/postgres/source.py +0 -0
  108. {castform-0.2.2.dev0/src/castform/rag/corpus/postgres → castform-0.2.3/src/castform/rag/corpus/turbopuffer}/__init__.py +0 -0
  109. {castform-0.2.2.dev0 → castform-0.2.3}/src/castform/rag/corpus/turbopuffer/files.py +0 -0
  110. {castform-0.2.2.dev0 → castform-0.2.3}/src/castform/rag/corpus/turbopuffer/filter_mapper.py +0 -0
  111. {castform-0.2.2.dev0 → castform-0.2.3}/src/castform/rag/corpus/turbopuffer/namespace.py +0 -0
  112. {castform-0.2.2.dev0 → castform-0.2.3}/src/castform/rag/corpus/turbopuffer/source.py +0 -0
  113. {castform-0.2.2.dev0/src/castform/rag/corpus/search_schema → castform-0.2.3/src/castform/rag/preprocess}/__init__.py +0 -0
  114. {castform-0.2.2.dev0/src/castform/rag/corpus/turbopuffer → castform-0.2.3/src/castform/rag/preprocess/email}/__init__.py +0 -0
  115. {castform-0.2.2.dev0 → castform-0.2.3}/src/castform/rag/preprocess/email/clean_bodies.py +0 -0
  116. {castform-0.2.2.dev0 → castform-0.2.3}/src/castform/rag/preprocess/email/dedupe.py +0 -0
  117. {castform-0.2.2.dev0 → castform-0.2.3}/src/castform/rag/preprocess/email/filter_automated_email_qas.py +0 -0
  118. {castform-0.2.2.dev0 → castform-0.2.3}/src/castform/rag/preprocess/email/filter_automated_emails.py +0 -0
  119. {castform-0.2.2.dev0 → castform-0.2.3}/src/castform/rag/preprocess/email/mbox.py +0 -0
  120. {castform-0.2.2.dev0 → castform-0.2.3}/src/castform/rag/qa_generation/__init__.py +0 -0
  121. {castform-0.2.2.dev0 → castform-0.2.3}/src/castform/rag/qa_generation/anchor_selector.py +0 -0
  122. {castform-0.2.2.dev0 → castform-0.2.3}/src/castform/rag/qa_generation/auto_tune.py +0 -0
  123. {castform-0.2.2.dev0 → castform-0.2.3}/src/castform/rag/qa_generation/batch_processor.py +0 -0
  124. {castform-0.2.2.dev0 → castform-0.2.3}/src/castform/rag/qa_generation/checkpoint.py +0 -0
  125. {castform-0.2.2.dev0 → castform-0.2.3}/src/castform/rag/qa_generation/corpus_capabilities.py +0 -0
  126. {castform-0.2.2.dev0 → castform-0.2.3}/src/castform/rag/qa_generation/corpus_profile.py +0 -0
  127. {castform-0.2.2.dev0 → castform-0.2.3}/src/castform/rag/qa_generation/filters/__init__.py +0 -0
  128. {castform-0.2.2.dev0 → castform-0.2.3}/src/castform/rag/qa_generation/filters/deterministic_guards.py +0 -0
  129. {castform-0.2.2.dev0 → castform-0.2.3}/src/castform/rag/qa_generation/filters/grounding_llm.py +0 -0
  130. {castform-0.2.2.dev0 → castform-0.2.3}/src/castform/rag/qa_generation/filters/hop_count_validity.py +0 -0
  131. {castform-0.2.2.dev0 → castform-0.2.3}/src/castform/rag/qa_generation/filters/quality_gate.py +0 -0
  132. {castform-0.2.2.dev0 → castform-0.2.3}/src/castform/rag/qa_generation/filters/retrieval_llm.py +0 -0
  133. {castform-0.2.2.dev0 → castform-0.2.3}/src/castform/rag/qa_generation/formatters/__init__.py +0 -0
  134. {castform-0.2.2.dev0 → castform-0.2.3}/src/castform/rag/qa_generation/formatters/train_eval.py +0 -0
  135. {castform-0.2.2.dev0 → castform-0.2.3}/src/castform/rag/qa_generation/generated_qa.py +0 -0
  136. {castform-0.2.2.dev0 → castform-0.2.3}/src/castform/rag/qa_generation/generators/__init__.py +0 -0
  137. {castform-0.2.2.dev0 → castform-0.2.3}/src/castform/rag/qa_generation/generators/direct_llm.py +0 -0
  138. {castform-0.2.2.dev0 → castform-0.2.3}/src/castform/rag/qa_generation/helpers.py +0 -0
  139. {castform-0.2.2.dev0 → castform-0.2.3}/src/castform/rag/qa_generation/metadata_linker.py +0 -0
  140. {castform-0.2.2.dev0 → castform-0.2.3}/src/castform/rag/qa_generation/metrics.py +0 -0
  141. {castform-0.2.2.dev0 → castform-0.2.3}/src/castform/rag/qa_generation/models.py +0 -0
  142. {castform-0.2.2.dev0 → castform-0.2.3}/src/castform/rag/qa_generation/pipeline.py +0 -0
  143. {castform-0.2.2.dev0 → castform-0.2.3}/src/castform/rag/qa_generation/pipeline_config.py +0 -0
  144. {castform-0.2.2.dev0 → castform-0.2.3}/src/castform/rag/qa_generation/protocols.py +0 -0
  145. {castform-0.2.2.dev0 → castform-0.2.3}/src/castform/rag/qa_generation/query_rewriter.py +0 -0
  146. {castform-0.2.2.dev0 → castform-0.2.3}/src/castform/rag/qa_generation/response_parsers.py +0 -0
  147. {castform-0.2.2.dev0 → castform-0.2.3}/src/castform/rag/qa_generation/retrieval_query.py +0 -0
  148. {castform-0.2.2.dev0 → castform-0.2.3}/src/castform/rag/qa_generation/scoring.py +0 -0
  149. {castform-0.2.2.dev0 → castform-0.2.3}/src/castform/rag/qa_generation/storage.py +0 -0
  150. {castform-0.2.2.dev0 → castform-0.2.3}/src/castform/rag/qa_generation/style_controls.py +0 -0
  151. {castform-0.2.2.dev0 → castform-0.2.3}/src/castform/rag/qa_generation/transformers/__init__.py +0 -0
  152. {castform-0.2.2.dev0 → castform-0.2.3}/src/castform/rag/qa_generation/transformers/base.py +0 -0
  153. {castform-0.2.2.dev0 → castform-0.2.3}/src/castform/rag/qa_generation/transformers/dedup.py +0 -0
  154. {castform-0.2.2.dev0 → castform-0.2.3}/src/castform/rag/qa_generation/wiki_builder.py +0 -0
  155. {castform-0.2.2.dev0 → castform-0.2.3}/src/castform/rag/qa_generation/wiki_chunk_linker.py +0 -0
  156. {castform-0.2.2.dev0 → castform-0.2.3}/src/castform/traces/__init__.py +0 -0
  157. {castform-0.2.2.dev0 → castform-0.2.3}/src/castform/traces/adapter.py +0 -0
  158. {castform-0.2.2.dev0/src/castform/rag/preprocess → castform-0.2.3/src/castform/traces/braintrust}/__init__.py +0 -0
  159. {castform-0.2.2.dev0 → castform-0.2.3}/src/castform/traces/braintrust/adapter.py +0 -0
  160. {castform-0.2.2.dev0 → castform-0.2.3}/src/castform/traces/braintrust/message_extraction.py +0 -0
  161. {castform-0.2.2.dev0 → castform-0.2.3}/src/castform/traces/http.py +0 -0
  162. {castform-0.2.2.dev0 → castform-0.2.3}/src/castform/traces/pipeline.py +0 -0
  163. {castform-0.2.2.dev0 → castform-0.2.3}/src/castform/traces/pivot.py +0 -0
  164. {castform-0.2.2.dev0 → castform-0.2.3}/src/castform/traces/processing.py +0 -0
  165. {castform-0.2.2.dev0 → castform-0.2.3}/src/castform/traces/registry.py +0 -0
  166. {castform-0.2.2.dev0 → castform-0.2.3}/src/castform/utils/__init__.py +0 -0
  167. {castform-0.2.2.dev0 → castform-0.2.3}/src/castform/utils/checkpoint.py +0 -0
  168. {castform-0.2.2.dev0 → castform-0.2.3}/tests/conftest.py +0 -0
  169. {castform-0.2.2.dev0 → castform-0.2.3}/tests/integration/harbor/README.md +0 -0
  170. {castform-0.2.2.dev0 → castform-0.2.3}/tests/integration/harbor/test_harbor_modal_live.py +0 -0
  171. {castform-0.2.2.dev0 → castform-0.2.3}/tests/integration/platform/test_rollout_reads.py +0 -0
  172. {castform-0.2.2.dev0 → castform-0.2.3}/tests/integration/test_async_corpus_client.py +0 -0
  173. {castform-0.2.2.dev0 → castform-0.2.3}/tests/integration/test_diversity_llm.py +0 -0
  174. {castform-0.2.2.dev0 → castform-0.2.3}/tests/integration/test_rubric_auth_retry.py +0 -0
  175. {castform-0.2.2.dev0 → castform-0.2.3}/tests/integration/traces/test_braintrust_e2e.py +0 -0
  176. {castform-0.2.2.dev0 → castform-0.2.3}/tests/unit/_scaffold.py +0 -0
  177. {castform-0.2.2.dev0 → castform-0.2.3}/tests/unit/cli_help.golden +0 -0
  178. {castform-0.2.2.dev0 → castform-0.2.3}/tests/unit/platform/test_credentials.py +0 -0
  179. {castform-0.2.2.dev0 → castform-0.2.3}/tests/unit/platform/test_device_auth.py +0 -0
  180. {castform-0.2.2.dev0 → castform-0.2.3}/tests/unit/platform/test_environment_assets.py +0 -0
  181. {castform-0.2.2.dev0 → castform-0.2.3}/tests/unit/platform/test_keyless_public_api.py +0 -0
  182. {castform-0.2.2.dev0 → castform-0.2.3}/tests/unit/platform/test_model_session.py +0 -0
  183. {castform-0.2.2.dev0 → castform-0.2.3}/tests/unit/rag/conftest.py +0 -0
  184. {castform-0.2.2.dev0 → castform-0.2.3}/tests/unit/rag/corpus/chroma/test_configurations.py +0 -0
  185. {castform-0.2.2.dev0 → castform-0.2.3}/tests/unit/rag/corpus/chroma/test_filter_mapper.py +0 -0
  186. {castform-0.2.2.dev0 → castform-0.2.3}/tests/unit/rag/corpus/chroma/test_search_related.py +0 -0
  187. {castform-0.2.2.dev0 → castform-0.2.3}/tests/unit/rag/corpus/pinecone/test_configurations.py +0 -0
  188. {castform-0.2.2.dev0 → castform-0.2.3}/tests/unit/rag/corpus/pinecone/test_filter_mapper.py +0 -0
  189. {castform-0.2.2.dev0 → castform-0.2.3}/tests/unit/rag/corpus/pinecone/test_search_related.py +0 -0
  190. {castform-0.2.2.dev0 → castform-0.2.3}/tests/unit/rag/corpus/pinecone/test_sparse_and_sampling.py +0 -0
  191. {castform-0.2.2.dev0 → castform-0.2.3}/tests/unit/rag/corpus/postgres/test_async_client.py +0 -0
  192. {castform-0.2.2.dev0 → castform-0.2.3}/tests/unit/rag/corpus/postgres/test_filter_mapper.py +0 -0
  193. {castform-0.2.2.dev0 → castform-0.2.3}/tests/unit/rag/corpus/postgres/test_search_related.py +0 -0
  194. {castform-0.2.2.dev0 → castform-0.2.3}/tests/unit/rag/corpus/postgres/test_source.py +0 -0
  195. {castform-0.2.2.dev0 → castform-0.2.3}/tests/unit/rag/corpus/test_dsl_parser.py +0 -0
  196. {castform-0.2.2.dev0 → castform-0.2.3}/tests/unit/rag/corpus/test_protocol_conformance.py +0 -0
  197. {castform-0.2.2.dev0 → castform-0.2.3}/tests/unit/rag/corpus/tpuf/test_configurations.py +0 -0
  198. {castform-0.2.2.dev0 → castform-0.2.3}/tests/unit/rag/corpus/tpuf/test_filter_mapper.py +0 -0
  199. {castform-0.2.2.dev0 → castform-0.2.3}/tests/unit/rag/corpus/tpuf/test_hybrid_search.py +0 -0
  200. {castform-0.2.2.dev0 → castform-0.2.3}/tests/unit/rag/corpus/tpuf/test_namespace.py +0 -0
  201. {castform-0.2.2.dev0 → castform-0.2.3}/tests/unit/rag/corpus/tpuf/test_search_related.py +0 -0
  202. {castform-0.2.2.dev0 → castform-0.2.3}/tests/unit/rag/fakes/chroma.py +0 -0
  203. {castform-0.2.2.dev0 → castform-0.2.3}/tests/unit/rag/fakes/pinecone.py +0 -0
  204. {castform-0.2.2.dev0 → castform-0.2.3}/tests/unit/rag/qa_generation/test_async_cleanup.py +0 -0
  205. {castform-0.2.2.dev0 → castform-0.2.3}/tests/unit/rag/qa_generation/test_batch_processor_async.py +0 -0
  206. {castform-0.2.2.dev0 → castform-0.2.3}/tests/unit/rag/qa_generation/test_filter_and_sample_seeds.py +0 -0
  207. {castform-0.2.2.dev0 → castform-0.2.3}/tests/unit/rag/qa_generation/test_grounding_batch_isolation.py +0 -0
  208. {castform-0.2.2.dev0 → castform-0.2.3}/tests/unit/rag/qa_generation/test_grounding_removed_chunks.py +0 -0
  209. {castform-0.2.2.dev0 → castform-0.2.3}/tests/unit/rag/test_auto_tune.py +0 -0
  210. {castform-0.2.2.dev0 → castform-0.2.3}/tests/unit/rag/test_checkpoint_base.py +0 -0
  211. {castform-0.2.2.dev0 → castform-0.2.3}/tests/unit/rag/test_corpus_profile.py +0 -0
  212. {castform-0.2.2.dev0 → castform-0.2.3}/tests/unit/rag/test_dedup.py +0 -0
  213. {castform-0.2.2.dev0 → castform-0.2.3}/tests/unit/rag/test_deterministic_guards.py +0 -0
  214. {castform-0.2.2.dev0 → castform-0.2.3}/tests/unit/rag/test_entity_quality.py +0 -0
  215. {castform-0.2.2.dev0 → castform-0.2.3}/tests/unit/rag/test_hop_count_validity.py +0 -0
  216. {castform-0.2.2.dev0 → castform-0.2.3}/tests/unit/rag/test_keybert_extraction.py +0 -0
  217. {castform-0.2.2.dev0 → castform-0.2.3}/tests/unit/rag/test_metadata_linker.py +0 -0
  218. {castform-0.2.2.dev0 → castform-0.2.3}/tests/unit/rag/test_micro_batch.py +0 -0
  219. {castform-0.2.2.dev0 → castform-0.2.3}/tests/unit/rag/test_relabel_qa_types.py +0 -0
  220. {castform-0.2.2.dev0 → castform-0.2.3}/tests/unit/rag/test_wiki_builder.py +0 -0
  221. {castform-0.2.2.dev0 → castform-0.2.3}/tests/unit/rag/test_wiki_chunk_linker.py +0 -0
  222. {castform-0.2.2.dev0 → castform-0.2.3}/tests/unit/test_cli.py +0 -0
  223. {castform-0.2.2.dev0 → castform-0.2.3}/tests/unit/test_cli_control.py +0 -0
  224. {castform-0.2.2.dev0 → castform-0.2.3}/tests/unit/test_cli_doctor.py +0 -0
  225. {castform-0.2.2.dev0 → castform-0.2.3}/tests/unit/test_cli_help.py +0 -0
  226. {castform-0.2.2.dev0 → castform-0.2.3}/tests/unit/test_cli_help_render.py +0 -0
  227. {castform-0.2.2.dev0 → castform-0.2.3}/tests/unit/test_cli_output.py +0 -0
  228. {castform-0.2.2.dev0 → castform-0.2.3}/tests/unit/test_cli_preflight.py +0 -0
  229. {castform-0.2.2.dev0 → castform-0.2.3}/tests/unit/test_cli_runs.py +0 -0
  230. {castform-0.2.2.dev0 → castform-0.2.3}/tests/unit/test_config.py +0 -0
  231. {castform-0.2.2.dev0 → castform-0.2.3}/tests/unit/test_model_auth.py +0 -0
  232. {castform-0.2.2.dev0 → castform-0.2.3}/tests/unit/test_profile_config.py +0 -0
  233. {castform-0.2.2.dev0 → castform-0.2.3}/tests/unit/traces/test_adapter.py +0 -0
  234. {castform-0.2.2.dev0 → castform-0.2.3}/tests/unit/traces/test_braintrust_adapter.py +0 -0
  235. {castform-0.2.2.dev0 → castform-0.2.3}/tests/unit/traces/test_braintrust_extraction.py +0 -0
  236. {castform-0.2.2.dev0 → castform-0.2.3}/tests/unit/traces/test_http.py +0 -0
  237. {castform-0.2.2.dev0 → castform-0.2.3}/tests/unit/traces/test_pivot.py +0 -0
  238. {castform-0.2.2.dev0 → castform-0.2.3}/tests/unit/traces/test_processing.py +0 -0
  239. {castform-0.2.2.dev0 → castform-0.2.3}/tests/unit/traces/test_registry.py +0 -0
@@ -1,18 +1,19 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: castform
3
- Version: 0.2.2.dev0
3
+ Version: 0.2.3
4
4
  Summary: SDK and CLI for the Castform training platform
5
5
  Author: castie@castform.com
6
6
  Classifier: Operating System :: OS Independent
7
7
  Classifier: Programming Language :: Python :: 3
8
8
  Requires-Python: ==3.12.*
9
- Requires-Dist: benchmax==0.2.2.dev0
9
+ Requires-Dist: benchmax==0.2.3
10
10
  Requires-Dist: httpx[http2]>=0.27.0
11
+ Requires-Dist: tqdm>=4.66.0
11
12
  Provides-Extra: chroma
12
- Requires-Dist: chromadb>=1.0.0; extra == 'chroma'
13
+ Requires-Dist: chromadb<2,>=1.5.9; extra == 'chroma'
13
14
  Requires-Dist: snowballstemmer>=2.2.0; extra == 'chroma'
14
15
  Provides-Extra: pinecone
15
- Requires-Dist: pinecone>=5.0.0; extra == 'pinecone'
16
+ Requires-Dist: pinecone<10,>=9.1.0; extra == 'pinecone'
16
17
  Provides-Extra: rag
17
18
  Requires-Dist: keybert>=0.8; extra == 'rag'
18
19
  Requires-Dist: langchain-text-splitters>=0.3.0; extra == 'rag'
@@ -22,11 +23,8 @@ Requires-Dist: pydantic>=2.0.0; extra == 'rag'
22
23
  Requires-Dist: ruamel-yaml>=0.19.1; extra == 'rag'
23
24
  Requires-Dist: scikit-learn>=1.8.0; extra == 'rag'
24
25
  Requires-Dist: sentence-transformers>=5.2.3; extra == 'rag'
25
- Requires-Dist: tqdm>=4.66.0; extra == 'rag'
26
- Provides-Extra: traces
27
- Requires-Dist: tqdm>=4.66.0; extra == 'traces'
28
26
  Provides-Extra: turbopuffer
29
- Requires-Dist: turbopuffer>=1.16.2; extra == 'turbopuffer'
27
+ Requires-Dist: turbopuffer<3,>=2.6.0; extra == 'turbopuffer'
30
28
  Description-Content-Type: text/markdown
31
29
 
32
30
  # Castform
@@ -91,13 +89,15 @@ The CLI does not duplicate that orchestration. Use it for `login`, `setup`,
91
89
 
92
90
  ## Optional libraries
93
91
 
94
- Add only the features the project uses:
92
+ Add only the optional features the project uses:
95
93
 
96
94
  ```bash
97
95
  uv add 'castform[rag]'
98
- uv add 'castform[traces]'
99
96
  ```
100
97
 
98
+ Trace adapters and `castform.traces.TracesPipeline` ship with the base
99
+ `castform` package; no trace-specific extra is required.
100
+
101
101
  Vector-store integrations ship as their own extras: `castform[chroma]`,
102
102
  `castform[pinecone]`, `castform[turbopuffer]`.
103
103
 
@@ -60,13 +60,15 @@ The CLI does not duplicate that orchestration. Use it for `login`, `setup`,
60
60
 
61
61
  ## Optional libraries
62
62
 
63
- Add only the features the project uses:
63
+ Add only the optional features the project uses:
64
64
 
65
65
  ```bash
66
66
  uv add 'castform[rag]'
67
- uv add 'castform[traces]'
68
67
  ```
69
68
 
69
+ Trace adapters and `castform.traces.TracesPipeline` ship with the base
70
+ `castform` package; no trace-specific extra is required.
71
+
70
72
  Vector-store integrations ship as their own extras: `castform[chroma]`,
71
73
  `castform[pinecone]`, `castform[turbopuffer]`.
72
74
 
@@ -1,13 +1,14 @@
1
1
  [project]
2
2
  name = "castform"
3
- version = "0.2.2.dev0"
3
+ version = "0.2.3"
4
4
  description = "SDK and CLI for the Castform training platform"
5
5
  readme = "README.md"
6
6
  authors = [{ name = "castie@castform.com" }]
7
7
  requires-python = "==3.12.*"
8
8
  dependencies = [
9
- "benchmax==0.2.2.dev0",
9
+ "benchmax==0.2.3",
10
10
  "httpx[http2]>=0.27.0",
11
+ "tqdm>=4.66.0",
11
12
  ]
12
13
  classifiers = [
13
14
  "Programming Language :: Python :: 3",
@@ -34,12 +35,10 @@ rag = [
34
35
  "ruamel-yaml>=0.19.1",
35
36
  "scikit-learn>=1.8.0",
36
37
  "sentence-transformers>=5.2.3",
37
- "tqdm>=4.66.0",
38
38
  ]
39
- traces = ["tqdm>=4.66.0"]
40
- chroma = ["chromadb>=1.0.0", "snowballstemmer>=2.2.0"]
41
- pinecone = ["pinecone>=5.0.0"]
42
- turbopuffer = ["turbopuffer>=1.16.2"]
39
+ chroma = ["chromadb>=1.5.9,<2", "snowballstemmer>=2.2.0"]
40
+ pinecone = ["pinecone>=9.1.0,<10"]
41
+ turbopuffer = ["turbopuffer>=2.6.0,<3"]
43
42
 
44
43
  [dependency-groups]
45
44
  dev = [
@@ -53,6 +53,14 @@ completed zero reward is valid, while an empty result with a failure termination
53
53
  reason is not. Hosted validation uses the exact uploaded assets that launch would
54
54
  consume.
55
55
 
56
+ Model sampling is trainer-owned. Harness code may request only an output ceiling
57
+ with `max_tokens` or `max_completion_tokens`; validation prints a warning because
58
+ the effective cap may be lower. Do not set `temperature`, `top_p`, `top_k`,
59
+ penalties, `seed`, or `stop` in harness model kwargs. Static validation rejects
60
+ those controls and unsupported response options. Tracked local and hosted
61
+ validation also rejects sampling conflicts, changed tools, overlapping calls,
62
+ and rewritten multi-turn history. Never launch with a contract error.
63
+
56
64
  ## Bundle and launch boundary
57
65
 
58
66
  The launch stage must remain visibly ordered:
@@ -90,10 +98,11 @@ that data at runtime. Passing `[]` explicitly uploads an empty JSONL file.
90
98
  <!-- rag:start -->
91
99
  For the RAG template, inspect retrieval separately from answer correctness. Verify
92
100
  that reference source IDs and model citations use the same canonicalization, and
93
- test a known query against the configured corpus before validation. Keep corpus
94
- ingestion or QA generation in `generate_data` using public `castform.rag` library
95
- interfaces; the rollout environment should depend only on the search client and
96
- other code it actually imports.
101
+ test a known query against the configured corpus before validation. Start from the
102
+ matching provider example under
103
+ https://github.com/castform-ai/benchmax/tree/main/examples. Keep corpus ingestion
104
+ or QA generation in the data stage using public `castform.rag` interfaces; the
105
+ rollout environment should depend only on its search adapter and runtime SDKs.
97
106
  <!-- rag:end -->
98
107
 
99
108
  The Castform CLI is for login, setup, doctor, guide, run inspection and run
@@ -0,0 +1,50 @@
1
+ # Get started with Harbor
2
+
3
+ This project is shaped for a Harbor package: Harbor resolves the task dataset,
4
+ creates the sandbox, runs the harness, and executes the verifier. Castform uploads
5
+ the environment bundle and supplies the model session used by the harness.
6
+
7
+ ```bash
8
+ uv sync
9
+ uv run python main.py data --dataset <org/package>
10
+ uv run python main.py validate --dataset <org/package> \
11
+ --modal-token-id <id> --modal-token-secret <secret>
12
+ uv run python main.py launch --dataset <org/package> \
13
+ --modal-token-id <id> --modal-token-secret <secret>
14
+ ```
15
+
16
+ If the packaged verifier needs credentials, inspect its configuration and pass
17
+ each requirement explicitly, for example
18
+ `--verifier-env OPENAI_API_KEY=<key>`. Do not read ambient environment variables
19
+ inside the environment constructor.
20
+
21
+ ## Work with your agent
22
+
23
+ Ask your agent to inspect the task package, then start from the closest maintained
24
+ example under <https://github.com/castform-ai/benchmax/tree/main/examples>.
25
+
26
+ Use Harbor when the source is a Harbor package or its records describe executable
27
+ tasks with sandbox/build configuration, a named harness, and an in-sandbox
28
+ verifier. Use `BaseEnv` when the records are ordinary prompts/examples and your
29
+ Python environment owns the model loop and reward directly.
30
+
31
+ Keep the stock `TrialAgentConfig(name="mini-swe-agent")` when it fits. AIME shows
32
+ an offline-installed Mini-SWE variant for unreliable per-sandbox installation;
33
+ Harvey shows a task-specific native harness. Add custom harness code only for a
34
+ similarly concrete reason.
35
+
36
+ The script follows the maintained example shape:
37
+
38
+ - `_constructor_args(args)` builds explicit, serializable configuration once;
39
+ - the same dictionary constructs the local env and the uploaded bundle;
40
+ - Harbor data remains runtime-managed, so `upload_assets` gets no JSONL dataset;
41
+ - validation prints static, local, and remote warnings/errors before launch.
42
+
43
+ Harnesses may request `max_tokens` or `max_completion_tokens`, but validation warns
44
+ because Castform can clamp the effective cap. Do not set trainer-owned sampling
45
+ controls such as `temperature`, `top_p`, penalties, `seed`, or `stop`. A green
46
+ validation also requires real model calls, compatible tracked history, verifier
47
+ execution, and scorable rewards—not merely a completed process.
48
+
49
+ Run `uv run pytest tests` for the structural seed tests, then add task-specific
50
+ tests for required verifier environment, sandbox configuration, and reward output.
@@ -29,16 +29,19 @@ Point your coding agent at the real task and ask it to load the matching skill i
29
29
 
30
30
  ```
31
31
  Build a Castform environment for <task>. Start with a small representative train
32
- and eval set, define an explicit reward shape, validate two sibling rollouts, and
33
- show me the result before proposing a launch.
32
+ set and add an eval set when available. Use the closest maintained example under
33
+ https://github.com/castform-ai/benchmax/tree/main/examples as the starting point,
34
+ define an explicit reward shape, validate two sibling rollouts, and show me the
35
+ result before proposing a launch.
34
36
  ```
35
37
 
36
38
  **RAG environment:**
37
39
 
38
40
  ```
39
- Build a Castform search environment over <corpus>. Keep corpus preparation in the
40
- data stage, test retrieval and reward behavior locally, and show me validation
41
- results before proposing a launch.
41
+ Build a Castform RAG environment over <corpus>. Use the matching provider example
42
+ under https://github.com/castform-ai/benchmax/tree/main/examples as the starting
43
+ point, test retrieval and reward behavior locally, and show me validation results
44
+ before proposing a launch.
42
45
  ```
43
46
 
44
47
  Use these skills in order:
@@ -59,6 +62,16 @@ can be a valid completed result. An operational failure instead has a
59
62
  non-`finished` `termination_reason`, empty rewards, an `error` message on the
60
63
  outcome, and a corresponding log entry.
61
64
 
65
+ Validation smoke-tests the required train split. Eval data is optional and remains
66
+ the right source for measuring generalization when the task provides it.
67
+
68
+ Validation checks model-request ownership before running and checks tracked
69
+ sampling and history behavior at runtime. Harnesses may request `max_tokens` or
70
+ `max_completion_tokens`, but the scorecard emits a warning when Castform can
71
+ clamp the effective ceiling. Do not set trainer-owned controls such as
72
+ `temperature`, `top_p`, `top_k`, penalties, `seed`, or `stop`; fix any static or
73
+ runtime contract error before launch.
74
+
62
75
  After a green baseline, decide deliberately:
63
76
 
64
77
  - iterate on the environment, data or reward and validate again; or
@@ -0,0 +1,92 @@
1
+ """Unit tests for the dataset and reward. Grow these alongside main.py: cover
2
+ malformed rows plus empty, wrong, partial and correct answers.
3
+
4
+ Plain `asyncio.run` keeps the suite dependency-free; run with `uv run pytest tests`.
5
+ """
6
+
7
+ import asyncio
8
+ import json
9
+
10
+ import pytest
11
+ from benchmax.envs.base import BaseRollout
12
+ from main import CustomEnv
13
+
14
+
15
+ def _rollout(answer: str, ground_truth: str) -> BaseRollout:
16
+ return BaseRollout(
17
+ rollout_id="rollout-1",
18
+ termination_reason="stop",
19
+ messages=[
20
+ {"role": "user", "content": "prompt"},
21
+ {"role": "assistant", "content": answer},
22
+ ],
23
+ example_args={"ground_truth": ground_truth},
24
+ )
25
+
26
+
27
+ def _reward(answer: str, ground_truth: str) -> dict[str, float]:
28
+ return asyncio.run(CustomEnv().compute_reward(_rollout(answer, ground_truth)))
29
+
30
+
31
+ def test_empty_answer_is_incorrect() -> None:
32
+ assert _reward("", "Paris") == {"correctness": 0.0}
33
+
34
+
35
+ def test_exact_answer_is_correct() -> None:
36
+ assert _reward("Paris", "Paris") == {"correctness": 1.0}
37
+
38
+
39
+ def test_case_and_outer_whitespace_are_normalized() -> None:
40
+ assert _reward(" PARIS\n", "Paris") == {"correctness": 1.0}
41
+
42
+
43
+ def test_wrong_answer_is_incorrect() -> None:
44
+ assert _reward("Berlin", "Paris") == {"correctness": 0.0}
45
+
46
+
47
+ def test_verbose_answer_containing_gold_is_not_an_exact_answer() -> None:
48
+ assert _reward("The capital of France is Paris.", "Paris") == {"correctness": 0.0}
49
+
50
+
51
+ @pytest.mark.parametrize(
52
+ "row",
53
+ [
54
+ {},
55
+ {"prompt": "", "ground_truth": "Paris"},
56
+ {"prompt": "Capital of France?"},
57
+ {"prompt": "Capital of France?", "ground_truth": ""},
58
+ ],
59
+ )
60
+ def test_malformed_rows_fail_loudly(row) -> None:
61
+ with pytest.raises((TypeError, ValueError)):
62
+ CustomEnv()._example_from_row(row)
63
+
64
+
65
+ def test_semantic_payload_has_stable_identity() -> None:
66
+ env = CustomEnv()
67
+ row = {"prompt": "Capital of France?", "ground_truth": "Paris"}
68
+
69
+ assert env._example_from_row(row).id == env._example_from_row(dict(row)).id
70
+ assert (
71
+ env._example_from_row(row).id != env._example_from_row({**row, "ground_truth": "Lyon"}).id
72
+ )
73
+
74
+
75
+ def test_split_order_and_identity_are_preserved(tmp_path) -> None:
76
+ train_rows = [
77
+ {"prompt": "first", "ground_truth": "one"},
78
+ {"prompt": "second", "ground_truth": "two"},
79
+ ]
80
+ eval_rows = [{"prompt": "third", "ground_truth": "three"}]
81
+ for split, rows in (("train", train_rows), ("eval", eval_rows)):
82
+ (tmp_path / f"{split}.jsonl").write_text(
83
+ "".join(f"{json.dumps(row)}\n" for row in rows),
84
+ encoding="utf-8",
85
+ )
86
+
87
+ env = CustomEnv()
88
+ train = asyncio.run(env.create_dataset("train", tmp_path))
89
+ eval_ = asyncio.run(env.create_dataset("eval", tmp_path))
90
+
91
+ assert [example.payload["ground_truth"] for example in train] == ["one", "two"]
92
+ assert {example.id for example in train}.isdisjoint(example.id for example in eval_)
@@ -17,11 +17,12 @@ from __future__ import annotations
17
17
  import argparse
18
18
  import asyncio
19
19
  import dataclasses
20
- import difflib
21
20
  import json
22
21
  from pathlib import Path
23
22
  from typing import Any
24
23
 
24
+ from benchmax.envs.base import resolve_dataset_path
25
+
25
26
  from benchmax.bundle import dump_bundle
26
27
  from benchmax.envs import (
27
28
  BaseEnv,
@@ -34,7 +35,6 @@ from benchmax.envs import (
34
35
  canonical_example_id,
35
36
  )
36
37
  from benchmax.rewards import extract_completion_text
37
-
38
38
  from castform import validate_environment
39
39
  from castform.platform.client import TrainerClient
40
40
  from castform.platform.environment_assets import upload_assets
@@ -44,12 +44,12 @@ from castform.platform.login import ensure_session
44
44
  class CustomEnv(BaseEnv):
45
45
  """A single-turn env: the model answers a prompt, scored against ground_truth.
46
46
 
47
- No tools and no LLM judge — the reward itself is deterministic string overlap
47
+ No tools and no LLM judge — the reward is normalized exact-match correctness
48
48
  and needs no separate judge call. Swap in your own reward / tools / judge.
49
49
  """
50
50
 
51
51
  # Advertised to the model each rollout (optional; default ""). Keep it short.
52
- system_prompt = "Answer the question concisely and directly."
52
+ system_prompt = "Return only the answer, without explanation."
53
53
  max_turns = 1
54
54
 
55
55
  async def create_dataset(
@@ -60,7 +60,7 @@ class CustomEnv(BaseEnv):
60
60
  max_examples: int | None = None,
61
61
  ) -> JsonlDataset[JsonRow]:
62
62
  return JsonlDataset(
63
- base_dir / f"{split}.jsonl",
63
+ resolve_dataset_path(base_dir, f"{split}.jsonl"),
64
64
  row_to_example=self._example_from_row,
65
65
  max_examples=max_examples,
66
66
  )
@@ -69,12 +69,25 @@ class CustomEnv(BaseEnv):
69
69
  prompt = row.get("prompt")
70
70
  if not isinstance(prompt, str):
71
71
  raise TypeError("dataset rows require a string 'prompt'")
72
+ if not prompt.strip():
73
+ raise ValueError("dataset rows require a non-empty 'prompt'")
74
+ ground_truth = row.get("ground_truth")
75
+ if not isinstance(ground_truth, str):
76
+ raise TypeError("dataset rows require a string 'ground_truth'")
77
+ if not ground_truth.strip():
78
+ raise ValueError("dataset rows require a non-empty 'ground_truth'")
79
+ extra = {
80
+ key: value
81
+ for key, value in row.items()
82
+ if key not in ("prompt", "ground_truth", "prompt_messages")
83
+ }
72
84
  payload: JsonRow = {
85
+ **extra,
73
86
  "prompt_messages": [
74
87
  {"role": "system", "content": self.system_prompt},
75
88
  {"role": "user", "content": prompt},
76
89
  ],
77
- **{key: value for key, value in row.items() if key != "prompt"},
90
+ "ground_truth": ground_truth,
78
91
  }
79
92
  return Example(id=canonical_example_id(payload), payload=payload)
80
93
 
@@ -82,25 +95,14 @@ class CustomEnv(BaseEnv):
82
95
  self,
83
96
  rollout: BaseRollout,
84
97
  ) -> dict[str, float]:
85
- """Score the answer against `ground_truth`. Return positive scores only; all
86
- components are SUMMED into one scalar — this is your whole training signal,
87
- so edit it. (Deterministic overlap here; swap in an LLM judge for open-ended
88
- answers — see the design-environment skill.)
89
- """
90
- t = rollout.example_args
98
+ """Score a normalized exact answer against the required ground truth."""
91
99
  answer = extract_completion_text(rollout.messages).strip()
92
- gold = str(t.get("ground_truth") or t.get("answer") or "").strip()
93
- if not answer:
94
- return {"overlap": 0.0, "contains_gold": 0.0, "answered": 0.0}
95
- overlap = (
96
- difflib.SequenceMatcher(None, answer.lower(), gold.lower()).ratio() if gold else 0.0
97
- )
98
- contains = 1.0 if gold and gold.lower() in answer.lower() else 0.0
99
- return {
100
- "overlap": overlap, # fuzzy match with the gold answer, in [0, 1]
101
- "contains_gold": 0.5 * contains, # the gold string appears verbatim
102
- "answered": 0.1, # small shaping: produced a non-empty answer
103
- }
100
+ gold = rollout.example_args.get("ground_truth")
101
+ if not isinstance(gold, str) or not gold.strip():
102
+ raise ValueError("rollout requires a non-empty string 'ground_truth'")
103
+ normalized_answer = " ".join(answer.casefold().split())
104
+ normalized_gold = " ".join(gold.casefold().split())
105
+ return {"correctness": float(normalized_answer == normalized_gold)}
104
106
 
105
107
 
106
108
  # ── Run config — validate/launch read these so the run reproduces from this
@@ -112,6 +114,7 @@ VALIDATE_CONFIG = {
112
114
  }
113
115
 
114
116
  LAUNCH_CONFIG = {
117
+ "model": "Qwen/Qwen3.5-4B",
115
118
  # Total prompt + response tokens across the WHOLE rollout. Single-turn answers
116
119
  # are short; raise it if your task needs longer prompts or tool transcripts.
117
120
  "max_context_tokens": 4096,
@@ -135,7 +138,6 @@ LAUNCH_CONFIG = {
135
138
 
136
139
  TRAIN_FILE = "train.jsonl"
137
140
  EVAL_FILE = "eval.jsonl"
138
- ENV_ARGS: dict[str, Any] = {} # CustomEnv constructor kwargs (none by default)
139
141
 
140
142
  # Dependencies installed in the remote rollout runtime. Keep this declaration at
141
143
  # the script boundary: add only packages imported by your env/reward/tool code.
@@ -172,6 +174,16 @@ def _run_name() -> str:
172
174
  return str(LAUNCH_CONFIG.get("name") or CustomEnv.__name__.lower())
173
175
 
174
176
 
177
+ def _constructor_args(args: argparse.Namespace) -> dict[str, Any]:
178
+ """Build explicit, serializable kwargs shared by local and remote envs.
179
+
180
+ Add task configuration and credentials as CLI arguments, then translate them
181
+ here instead of reading ambient environment variables inside ``CustomEnv``.
182
+ """
183
+ del args
184
+ return {}
185
+
186
+
175
187
  def generate_data(force: bool = False) -> bool:
176
188
  """Produce `train.jsonl` / `eval.jsonl`.
177
189
 
@@ -180,17 +192,32 @@ def generate_data(force: bool = False) -> bool:
180
192
  the gen code here so the dataset stays reproducible from this file. Re-run with
181
193
  --force to regenerate; skip-if-exists otherwise.
182
194
  """
183
- have = Path(TRAIN_FILE).exists() and Path(EVAL_FILE).exists()
184
- if have and not force:
195
+ datasets = (
196
+ (Path(TRAIN_FILE), _SEED_TRAIN),
197
+ (Path(EVAL_FILE), _SEED_EVAL),
198
+ )
199
+ pending = (
200
+ list(datasets) if force else [(path, rows) for path, rows in datasets if not path.exists()]
201
+ )
202
+ if not pending:
185
203
  print(f"data: {TRAIN_FILE} / {EVAL_FILE} present — skipping (--force to redo)")
186
204
  return True
187
- _write_jsonl(TRAIN_FILE, _SEED_TRAIN)
188
- _write_jsonl(EVAL_FILE, _SEED_EVAL)
189
- print(f"data: wrote {len(_SEED_TRAIN)} train / {len(_SEED_EVAL)} eval rows")
205
+ for path, rows in pending:
206
+ _write_jsonl(str(path), rows)
207
+ written = ", ".join(f"{path} ({len(rows)} rows)" for path, rows in pending)
208
+ print(f"data: wrote {written}")
190
209
  return True
191
210
 
192
211
 
193
212
  def _print_validation(report: Any) -> None:
213
+ for location in ("static", "local", "remote"):
214
+ warnings = getattr(report, f"{location}_warnings", {}) or {}
215
+ for item, messages in warnings.items():
216
+ values = messages if isinstance(messages, list) else [messages]
217
+ for message in values:
218
+ print(f"⚠️ {location} {item}: {message}")
219
+ for item, error in (getattr(report, "static_errors", {}) or {}).items():
220
+ print(f"❌ static {item}: {error}")
194
221
  for location in ("local", "remote"):
195
222
  outcomes = getattr(report, location)
196
223
  if outcomes is None:
@@ -287,11 +314,12 @@ def main(argv: list[str] | None = None) -> int:
287
314
  if args.action == "data":
288
315
  return 0
289
316
 
317
+ constructor_args = _constructor_args(args)
290
318
  ensure_session() # data preparation stays usable without platform login
291
319
  print(f"[stage 2/{total_stages}] bundling environment")
292
320
  bundled_environment = dump_bundle(
293
321
  CustomEnv,
294
- constructor_args=ENV_ARGS,
322
+ constructor_args=constructor_args,
295
323
  pip_dependencies=RUNTIME_DEPENDENCIES,
296
324
  )
297
325
  print(f"[stage 3/{total_stages}] uploading environment and dataset")
@@ -305,7 +333,7 @@ def main(argv: list[str] | None = None) -> int:
305
333
  print(f" env_metadata_path: {uploaded_assets.env_metadata_path}")
306
334
  print(f" dataset_path: {uploaded_assets.dataset_path}")
307
335
  print(f"[stage 4/{total_stages}] validating environment")
308
- report = validate(CustomEnv(**ENV_ARGS), uploaded_assets)
336
+ report = validate(CustomEnv(**constructor_args), uploaded_assets)
309
337
  if not report.ok:
310
338
  return 1
311
339
  if args.action == "launch":
@@ -0,0 +1,64 @@
1
+ """Structural tests for the Harbor seed. Add task-specific verifier tests here."""
2
+
3
+ import argparse
4
+
5
+ import pytest
6
+ from benchmax.envs.harbor import HarborEnv, ModalCredentials
7
+ from main import (
8
+ CustomHarborEnv,
9
+ _constructor_args,
10
+ _parse_verifier_env,
11
+ )
12
+
13
+
14
+ def _args(**overrides):
15
+ values = {
16
+ "dataset": "org/task-package",
17
+ "dataset_ref": "latest",
18
+ "modal_token_id": "modal-id",
19
+ "modal_token_secret": "modal-secret",
20
+ "verifier_env": ["OPENAI_API_KEY=judge-key"],
21
+ }
22
+ values.update(overrides)
23
+ return argparse.Namespace(**values)
24
+
25
+
26
+ def test_constructor_args_are_explicit_and_build_the_stock_harness() -> None:
27
+ constructor_args = _constructor_args(_args())
28
+ env = CustomHarborEnv(**constructor_args)
29
+
30
+ assert isinstance(env, HarborEnv)
31
+ assert constructor_args["dataset_name"] == "org/task-package"
32
+ assert constructor_args["dataset_ref"] == "latest"
33
+ assert isinstance(constructor_args["sandbox_credentials"], ModalCredentials)
34
+ assert constructor_args["verifier_env"] == {"OPENAI_API_KEY": "judge-key"}
35
+ assert env._trial.agent.name == "mini-swe-agent"
36
+ assert env._trial.agent.model_name is None
37
+ assert env._trial.agent.kwargs == {}
38
+
39
+
40
+ def test_stock_harness_has_no_static_model_contract_errors() -> None:
41
+ env = CustomHarborEnv(**_constructor_args(_args()))
42
+
43
+ assert env.validation_diagnostics() == ()
44
+
45
+
46
+ def test_verifier_env_accepts_repeated_name_value_arguments() -> None:
47
+ assert _parse_verifier_env(["OPENAI_API_KEY=key", "OPENAI_BASE_URL=https://host/v1"]) == {
48
+ "OPENAI_API_KEY": "key",
49
+ "OPENAI_BASE_URL": "https://host/v1",
50
+ }
51
+
52
+
53
+ @pytest.mark.parametrize(
54
+ "assignments",
55
+ [
56
+ ["OPENAI_API_KEY"],
57
+ ["OPENAI_API_KEY="],
58
+ ["BAD-NAME=value"],
59
+ ["OPENAI_API_KEY=one", "OPENAI_API_KEY=two"],
60
+ ],
61
+ )
62
+ def test_verifier_env_rejects_ambiguous_values(assignments: list[str]) -> None:
63
+ with pytest.raises(ValueError):
64
+ _parse_verifier_env(assignments)