sable-sphynx 0.7.0.dev0__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.
Files changed (174) hide show
  1. sable_sphynx-0.7.0.dev0.dist-info/METADATA +152 -0
  2. sable_sphynx-0.7.0.dev0.dist-info/RECORD +174 -0
  3. sable_sphynx-0.7.0.dev0.dist-info/WHEEL +5 -0
  4. sable_sphynx-0.7.0.dev0.dist-info/top_level.txt +1 -0
  5. sphynx/__init__.py +469 -0
  6. sphynx/__init__.pyi +376 -0
  7. sphynx/_analytical_client.py +77 -0
  8. sphynx/_analytical_values.py +252 -0
  9. sphynx/_audit_client.py +173 -0
  10. sphynx/_comparison_adapters.py +113 -0
  11. sphynx/_componentized_full_rag.py +34 -0
  12. sphynx/_composed_pipeline.py +109 -0
  13. sphynx/_full_rag_grading.py +218 -0
  14. sphynx/_full_rag_trace.py +221 -0
  15. sphynx/_local_eval.py +268 -0
  16. sphynx/_pipeline_core.py +243 -0
  17. sphynx/_pr_client.py +237 -0
  18. sphynx/_rag_diagnostics_calibration.py +285 -0
  19. sphynx/_rag_diagnostics_catalog.py +39 -0
  20. sphynx/_rag_diagnostics_common.py +26 -0
  21. sphynx/_rag_diagnostics_contracts.py +186 -0
  22. sphynx/_rag_diagnostics_engine.py +243 -0
  23. sphynx/_rag_diagnostics_importers.py +242 -0
  24. sphynx/_rag_diagnostics_ranking.py +81 -0
  25. sphynx/_rag_diagnostics_semantic.py +325 -0
  26. sphynx/_rag_ranking.py +149 -0
  27. sphynx/_speech_benchmark_scoring.py +140 -0
  28. sphynx/_speech_benchmark_sources.py +275 -0
  29. sphynx/_speech_complete_scoring.py +218 -0
  30. sphynx/_speech_complete_source.py +118 -0
  31. sphynx/_speech_kido.py +294 -0
  32. sphynx/_speech_scoring.py +77 -0
  33. sphynx/_track_capture.py +213 -0
  34. sphynx/analytical_views.py +515 -0
  35. sphynx/assessment_contracts.py +378 -0
  36. sphynx/assessment_selection.py +57 -0
  37. sphynx/audit_access.py +245 -0
  38. sphynx/audit_contracts.py +204 -0
  39. sphynx/audit_requests.py +180 -0
  40. sphynx/authoring.py +188 -0
  41. sphynx/benchmarks.py +568 -0
  42. sphynx/candidates.py +62 -0
  43. sphynx/catalog.py +272 -0
  44. sphynx/chunking.py +372 -0
  45. sphynx/clickhouse_reader.py +169 -0
  46. sphynx/client.py +486 -0
  47. sphynx/comparison_core.py +149 -0
  48. sphynx/comparison_views.py +223 -0
  49. sphynx/components.py +1661 -0
  50. sphynx/contracts.py +514 -0
  51. sphynx/customer_rerank.py +299 -0
  52. sphynx/customer_retrieval.py +146 -0
  53. sphynx/data/benchmark-releases.v1.json +164 -0
  54. sphynx/data/public-benchmark-release.v1.json +354 -0
  55. sphynx/data/rag-diagnostics-synthetic.v1.json +6982 -0
  56. sphynx/data/rag-paper-references.v1.json +176 -0
  57. sphynx/data/rag-paper-schemas.v1.json +1069 -0
  58. sphynx/data/rag-rerank-v1.json +507 -0
  59. sphynx/dataset_catalog_data.py +1214 -0
  60. sphynx/dataset_readiness.py +138 -0
  61. sphynx/dataset_v3.py +999 -0
  62. sphynx/demo.py +130 -0
  63. sphynx/demo_candidates/__init__.py +1 -0
  64. sphynx/demo_candidates/dense.py +11 -0
  65. sphynx/demo_candidates/lexical.py +21 -0
  66. sphynx/diagnostics.py +207 -0
  67. sphynx/documentation.py +737 -0
  68. sphynx/documentation_candidate.py +939 -0
  69. sphynx/evals.py +538 -0
  70. sphynx/evaluation_protocols.py +124 -0
  71. sphynx/evaluator_bindings.py +370 -0
  72. sphynx/evidence.py +352 -0
  73. sphynx/execution_capabilities.py +109 -0
  74. sphynx/fast_search.py +285 -0
  75. sphynx/full_rag.py +341 -0
  76. sphynx/hosted/__init__.py +18 -0
  77. sphynx/hosted/benchmark_intake.py +218 -0
  78. sphynx/hosted/contracts.py +361 -0
  79. sphynx/hosted/model_admission.py +130 -0
  80. sphynx/hosted/model_artifacts.py +298 -0
  81. sphynx/hosted/model_contracts.py +63 -0
  82. sphynx/hosted/model_gcs.py +181 -0
  83. sphynx/hosted/model_history.py +84 -0
  84. sphynx/hosted/model_session.py +233 -0
  85. sphynx/hosted/public_suite.py +74 -0
  86. sphynx/hosted/registry.py +97 -0
  87. sphynx/hosted/revisions.py +126 -0
  88. sphynx/hosted/sandbox.py +105 -0
  89. sphynx/hosted/submission.py +287 -0
  90. sphynx/hosted_workflow.py +451 -0
  91. sphynx/http_transport.py +86 -0
  92. sphynx/integrated_rag.py +352 -0
  93. sphynx/integrated_workflow.py +552 -0
  94. sphynx/integration_contracts.py +474 -0
  95. sphynx/invocation.py +791 -0
  96. sphynx/invocation_candidates.py +392 -0
  97. sphynx/invocation_catalog_data.py +40 -0
  98. sphynx/learned_catalog_data.py +30 -0
  99. sphynx/learned_rerank.py +267 -0
  100. sphynx/legacy_full_rag.py +67 -0
  101. sphynx/lifecycle.py +885 -0
  102. sphynx/lifecycle_workflow.py +490 -0
  103. sphynx/metric_views.py +474 -0
  104. sphynx/metrics.py +282 -0
  105. sphynx/model_adapters.py +438 -0
  106. sphynx/model_catalog_data.py +30 -0
  107. sphynx/official_benchmarks.py +385 -0
  108. sphynx/packs.py +258 -0
  109. sphynx/pipeline.py +313 -0
  110. sphynx/pipeline_workflow.py +551 -0
  111. sphynx/pr_evaluations.py +560 -0
  112. sphynx/progress.py +89 -0
  113. sphynx/public_bundle.py +173 -0
  114. sphynx/public_eval.py +62 -0
  115. sphynx/public_rerank.py +355 -0
  116. sphynx/py.typed +0 -0
  117. sphynx/pytest_plugin.py +62 -0
  118. sphynx/question_robustness.py +437 -0
  119. sphynx/rag.py +329 -0
  120. sphynx/rag_diagnostics.py +309 -0
  121. sphynx/rag_papers/__init__.py +29 -0
  122. sphynx/rag_papers/__main__.py +45 -0
  123. sphynx/rag_papers/candidates.py +19 -0
  124. sphynx/rag_papers/contracts.py +282 -0
  125. sphynx/rag_papers/datasets.py +291 -0
  126. sphynx/rag_papers/experiments.py +116 -0
  127. sphynx/rag_papers/judges.py +308 -0
  128. sphynx/rag_papers/registry.py +33 -0
  129. sphynx/rag_papers/runner.py +176 -0
  130. sphynx/rag_papers/sable.py +135 -0
  131. sphynx/rag_papers/schemas.py +12 -0
  132. sphynx/rag_papers/scoring.py +249 -0
  133. sphynx/rag_papers/semantic.py +288 -0
  134. sphynx/rag_papers/trec.py +80 -0
  135. sphynx/recorded_scores.py +352 -0
  136. sphynx/records.py +124 -0
  137. sphynx/reflex_traces.py +193 -0
  138. sphynx/report_rendering.py +71 -0
  139. sphynx/rerank_family_contracts.py +150 -0
  140. sphynx/rerank_workflow.py +424 -0
  141. sphynx/research_candidate.py +190 -0
  142. sphynx/results.py +852 -0
  143. sphynx/retrieval.py +750 -0
  144. sphynx/retrieval_candidates.py +295 -0
  145. sphynx/retrieval_catalog_data.py +19 -0
  146. sphynx/retrieval_recordings.py +125 -0
  147. sphynx/reviewer_audit.py +266 -0
  148. sphynx/routing_policies.py +375 -0
  149. sphynx/runner.py +544 -0
  150. sphynx/sable_rerank.py +489 -0
  151. sphynx/score_reliability.py +393 -0
  152. sphynx/speech_benchmarks.py +204 -0
  153. sphynx/speech_campaigns.py +378 -0
  154. sphynx/speech_complete.py +236 -0
  155. sphynx/speech_contracts.py +225 -0
  156. sphynx/speech_evidence.py +429 -0
  157. sphynx/speech_listening.py +115 -0
  158. sphynx/speech_multilingual.py +71 -0
  159. sphynx/speech_tts.py +479 -0
  160. sphynx/sql/001_sync_v1.sql +30 -0
  161. sphynx/stage_contracts.py +199 -0
  162. sphynx/statistical_catalog_data.py +53 -0
  163. sphynx/statistical_rerank.py +232 -0
  164. sphynx/sync.py +797 -0
  165. sphynx/workbench.py +378 -0
  166. sphynx/workbench_catalog_data.py +13 -0
  167. sphynx/workbench_tracks.py +78 -0
  168. sphynx/workflow_async.py +197 -0
  169. sphynx/workflow_contracts.py +594 -0
  170. sphynx/workflow_decisions.py +211 -0
  171. sphynx/workflow_defaults.py +16 -0
  172. sphynx/workflow_extensions.py +212 -0
  173. sphynx/workflow_registry.py +513 -0
  174. sphynx/workflows.py +792 -0
@@ -0,0 +1,197 @@
1
+ """Optional asynchronous workflow contracts, without execution or polling.
2
+
3
+ Backends own native status, authority, and record verification. A submission is
4
+ coordination work, not a Run. A pending grading pass is not a Report. Native
5
+ references remain opaque and are excluded from public snapshots.
6
+ """
7
+ from __future__ import annotations
8
+
9
+ from dataclasses import dataclass, field
10
+ from typing import Any, Mapping, Protocol, TYPE_CHECKING, runtime_checkable
11
+
12
+ if TYPE_CHECKING:
13
+ from .progress import ProgressView
14
+
15
+ from .workflow_contracts import (
16
+ AdmissionBinding, PlanBinding, ReferenceBinding, ResolvedBinding,
17
+ WorkflowContractError, _object, _optional_text, _text, _thaw,
18
+ )
19
+
20
+
21
+ @dataclass(frozen=True)
22
+ class SubmissionIntent:
23
+ """Retain the recovery key and exact declared request before its first POST.
24
+
25
+ The key identifies one operation. Deliberate new runs need new keys. This
26
+ metadata does not authenticate source or grant submission permission.
27
+ """
28
+
29
+ idempotency_key: str
30
+ request_identity: Mapping[str, Any]
31
+
32
+ def __post_init__(self) -> None:
33
+ _text(self.idempotency_key, "idempotency_key")
34
+ object.__setattr__(self, "request_identity", _object(self.request_identity, "request_identity"))
35
+
36
+ def to_dict(self) -> dict[str, Any]:
37
+ return {"idempotency_key": self.idempotency_key,
38
+ "request_identity": _thaw(self.request_identity)}
39
+
40
+
41
+ class SubmissionError(WorkflowContractError):
42
+ """An unsuccessful submission attempt with its original recovery intent."""
43
+
44
+ def __init__(self, message: str, *, intent: SubmissionIntent, code: str = "submission_failed") -> None:
45
+ if not isinstance(intent, SubmissionIntent):
46
+ raise WorkflowContractError("submission error requires a SubmissionIntent")
47
+ _text(code, "code")
48
+ self.intent, self.code = intent, code
49
+ super().__init__(message)
50
+
51
+
52
+ def _state(complete: bool, failed: bool, error_code: str | None, reason: str | None) -> None:
53
+ if type(complete) is not bool or type(failed) is not bool or (complete and failed):
54
+ raise WorkflowContractError("complete and failed must be separate boolean states")
55
+ _optional_text(error_code, "error_code")
56
+ _optional_text(reason, "reason")
57
+
58
+
59
+ @dataclass(frozen=True)
60
+ class SubmissionSnapshot:
61
+ """Verified native coordination metadata, separate from captured records.
62
+
63
+ A reserved run/grading ID may appear before its evidence is ready. Backends
64
+ expose native_run/native_grading only when those references can be consumed
65
+ as a Run/Report. Complete execution must provide a native run reference.
66
+ """
67
+
68
+ submission_id: str
69
+ status: str
70
+ idempotency_key: str
71
+ request_identity: Mapping[str, Any]
72
+ native_ref: Any = field(repr=False, compare=False)
73
+ run_id: str | None = None
74
+ grading_id: str | None = None
75
+ native_run: Any = field(default=None, repr=False, compare=False)
76
+ native_grading: Any = field(default=None, repr=False, compare=False)
77
+ complete: bool = False
78
+ failed: bool = False
79
+ error_code: str | None = None
80
+ reason: str | None = None
81
+ trust_tier: str = "unverified"
82
+
83
+ def __post_init__(self) -> None:
84
+ for name in ("submission_id", "status", "idempotency_key", "trust_tier"):
85
+ _text(getattr(self, name), name)
86
+ for name in ("run_id", "grading_id"):
87
+ _optional_text(getattr(self, name), name)
88
+ _state(self.complete, self.failed, self.error_code, self.reason)
89
+ if self.native_run is not None and self.run_id is None:
90
+ raise WorkflowContractError("native run reference requires its run identity")
91
+ if self.native_grading is not None and self.grading_id is None:
92
+ raise WorkflowContractError("native grading reference requires its grading identity")
93
+ if self.complete and self.native_run is None:
94
+ raise WorkflowContractError("complete submission must provide a native run reference")
95
+ object.__setattr__(self, "request_identity", _object(self.request_identity, "request_identity"))
96
+
97
+ @property
98
+ def terminal(self) -> bool:
99
+ return self.complete or self.failed
100
+
101
+ @property
102
+ def progress(self) -> ProgressView:
103
+ from .progress import _progress
104
+ return _progress('submission', self.status,
105
+ {'submission_id': self.submission_id, 'idempotency_key': self.idempotency_key,
106
+ 'run_id': self.run_id, 'grading_id': self.grading_id}, terminal=self.terminal,
107
+ complete=self.complete, failed=self.failed)
108
+
109
+ def to_dict(self) -> dict[str, Any]:
110
+ return {"submission_id": self.submission_id, "status": self.status,
111
+ "idempotency_key": self.idempotency_key, "request_identity": _thaw(self.request_identity),
112
+ "run_id": self.run_id, "grading_id": self.grading_id,
113
+ "complete": self.complete, "failed": self.failed, "error_code": self.error_code,
114
+ "reason": self.reason, "trust_tier": self.trust_tier}
115
+
116
+
117
+ @dataclass(frozen=True)
118
+ class GradingSnapshot:
119
+ """Pending native grading handle and optional completed report reference."""
120
+
121
+ reference: ReferenceBinding
122
+ idempotency_key: str
123
+ request_identity: Mapping[str, Any]
124
+ native_ref: Any = field(repr=False, compare=False)
125
+ completed_ref: Any = field(default=None, repr=False, compare=False)
126
+ complete: bool = False
127
+ failed: bool = False
128
+ error_code: str | None = None
129
+ reason: str | None = None
130
+
131
+ def __post_init__(self) -> None:
132
+ if not isinstance(self.reference, ReferenceBinding) or self.reference.record_id is None:
133
+ raise WorkflowContractError("grading snapshot requires its native ReferenceBinding")
134
+ _text(self.idempotency_key, "idempotency_key")
135
+ _state(self.complete, self.failed, self.error_code, self.reason)
136
+ if self.complete != (self.completed_ref is not None):
137
+ raise WorkflowContractError("only complete grading can expose a completed reference")
138
+ object.__setattr__(self, "request_identity", _object(self.request_identity, "request_identity"))
139
+
140
+ @property
141
+ def grading_id(self) -> str:
142
+ assert self.reference.record_id is not None
143
+ return self.reference.record_id
144
+
145
+ @property
146
+ def run_id(self) -> str | None:
147
+ return self.reference.run_id
148
+
149
+ @property
150
+ def status(self) -> str:
151
+ return self.reference.status
152
+
153
+ @property
154
+ def trust_tier(self) -> str:
155
+ return self.reference.trust_tier
156
+
157
+ @property
158
+ def terminal(self) -> bool:
159
+ return self.complete or self.failed
160
+
161
+ @property
162
+ def progress(self) -> ProgressView:
163
+ from .progress import _progress
164
+ return _progress('grading', self.status,
165
+ {'grading_id': self.grading_id, 'run_id': self.run_id,
166
+ 'idempotency_key': self.idempotency_key}, terminal=self.terminal,
167
+ complete=self.complete, failed=self.failed)
168
+
169
+ def to_dict(self) -> dict[str, Any]:
170
+ return {"grading_id": self.grading_id, "run_id": self.run_id,
171
+ "status": self.status, "trust_tier": self.trust_tier,
172
+ "idempotency_key": self.idempotency_key, "request_identity": _thaw(self.request_identity),
173
+ "complete": self.complete, "failed": self.failed,
174
+ "error_code": self.error_code, "reason": self.reason}
175
+
176
+
177
+ @runtime_checkable
178
+ class AsyncWorkflowBackend(Protocol):
179
+ """Additive backend capability; old WorkflowBackend remains unchanged.
180
+
181
+ Submission and grading POSTs receive a key retained before the attempt.
182
+ Snapshot/refresh calls must never submit, execute, or start another grading
183
+ pass. Backends verify native record linkage before exposing ready refs.
184
+ """
185
+
186
+ def submit(self, plan: PlanBinding, resolved: ResolvedBinding,
187
+ admission: AdmissionBinding, idempotency_key: str) -> Any: ...
188
+
189
+ def submission_snapshot(self, native_ref: Any) -> SubmissionSnapshot: ...
190
+
191
+ def refresh_submission(self, native_ref: Any) -> Any: ...
192
+
193
+ def start_grading(self, native_run: Any, idempotency_key: str) -> Any: ...
194
+
195
+ def grading_snapshot(self, native_ref: Any) -> GradingSnapshot: ...
196
+
197
+ def refresh_grading(self, native_ref: Any) -> Any: ...