ontocast.tool.atomic¶
Minimal tool contracts for atomic render/critic loops.
Classes¶
AtomicLLMProvider
¶
Bases: Protocol
Provides budget-aware LLM instances for atomic loop calls.
Source code in ontocast/tool/atomic.py
AtomicOntologyCatalog
¶
Bases: Protocol
The slice of an ontology catalog the per-unit repairs read.
A unit sees a retrieved snapshot of the catalog; the repairs that decide whether a term is real need the whole catalog, since a term the snapshot did not retrieve is still a term.
Source code in ontocast/tool/atomic.py
AtomicSearchProvider
¶
Bases: Protocol
Provides optional web-search retrieval for ontology grounding.
Source code in ontocast/tool/atomic.py
AtomicToolBox
¶
Small tool surface used by atomic render/critic paths.
Configuration arrives as config sections, never as unpacked scalars. An
earlier signature accepted both a :class:WebSearchConfig and seventeen
flat web_search_* parameters mirroring its fields, chosen between by an
if/else; production passed the section and only tests took the flat
branch, so the tested configuration path was not the one that shipped. Each
default also existed three times -- here, in settings.py, and inline at
the read sites. Now settings.py is the single source.
Source code in ontocast/tool/atomic.py
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 | |
Attributes¶
acceptance_policy = FactsAcceptancePolicy(blocking_fix_severity=facts_validation.accept_blocking_severity)
instance-attribute
¶
additional_standard_namespaces = tuple(facts_validation.additional_standard_namespaces)
instance-attribute
¶
citation_vocabulary = dict(citation_vocabulary or {})
instance-attribute
¶
code_predicates = tuple(facts_validation.code_predicates)
instance-attribute
¶
facts_completion_detached = facts_validation.completion_detached
instance-attribute
¶
facts_completion_measurements = facts_validation.completion_measurements
instance-attribute
¶
facts_completion_passes = facts_validation.completion_passes
instance-attribute
¶
facts_critic_min_triples = facts_validation.critic_min_triples
instance-attribute
¶
facts_critic_passes = facts_validation.critic_passes
instance-attribute
¶
facts_patch_policy = CriticPatchPolicy(max_delete_share=facts_validation.critic_max_delete_share, min_deletes=facts_validation.critic_min_deletes, allow_subject_rename=facts_validation.critic_allow_subject_rename)
instance-attribute
¶
facts_vocabulary = facts_validation.vocabulary
instance-attribute
¶
llm_provider = llm_provider
instance-attribute
¶
numeric_coverage_limit = facts_validation.numeric_coverage_limit
instance-attribute
¶
numeric_coverage_mandatory = facts_validation.numeric_coverage_mandatory
instance-attribute
¶
object_property_literal_check = facts_validation.object_property_literal_check
instance-attribute
¶
ontology_acceptance_policy = FactsAcceptancePolicy(blocking_finding_kinds=frozenset(ontology_validation.accept_blocking_finding_kinds), blocking_fix_severity=facts_validation.accept_blocking_severity)
instance-attribute
¶
ontology_catalog = ontology_catalog
instance-attribute
¶
ontology_critic_passes = ontology_validation.critic_passes
instance-attribute
¶
ontology_insert_only = ontology_validation.update_mode == 'insert_only'
instance-attribute
¶
ontology_max_class_depth = ontology_validation.max_class_depth
instance-attribute
¶
ontology_patch_policy = CriticPatchPolicy(max_delete_share=0.0 if self.ontology_insert_only else ontology_validation.critic_max_delete_share, min_deletes=0 if self.ontology_insert_only else ontology_validation.critic_min_deletes, allow_subject_rename=False)
instance-attribute
¶
property_alias_min_ratio = facts_validation.property_alias_min_ratio
instance-attribute
¶
quantity_fallback_vocabulary = dict(facts_validation.quantity_fallback_vocabulary)
instance-attribute
¶
search_provider = search_provider
instance-attribute
¶
validation_policy = ValidationPolicy(additional_standard_namespaces=self.additional_standard_namespaces, vocabulary=facts_validation.vocabulary, quantity_fallback_vocabulary=self.quantity_fallback_vocabulary, code_predicates=self.code_predicates, numeric_identifier_guard=facts_validation.numeric_identifier_guard, domain_adherence_min_share=facts_validation.domain_adherence_min_share, domain_adherence_min_terms=facts_validation.domain_adherence_min_terms)
instance-attribute
¶
web_search_allowed_domains = _domain_set(web_search.allowed_domains)
instance-attribute
¶
web_search_blocked_domains = _domain_set(web_search.blocked_domains)
instance-attribute
¶
web_search_config = web_search
instance-attribute
¶
web_search_enabled = web_search.enabled
instance-attribute
¶
web_search_for_facts_critic = web_search.facts_critic_enabled
instance-attribute
¶
web_search_for_facts_render = web_search.facts_render_enabled
instance-attribute
¶
web_search_for_ontology_critic = web_search.ontology_critic_enabled
instance-attribute
¶
web_search_for_ontology_render = web_search.ontology_render_enabled
instance-attribute
¶
web_search_max_snippet_chars = web_search.max_snippet_chars
instance-attribute
¶
web_search_max_total_chars = web_search.max_total_chars
instance-attribute
¶
web_search_min_snippet_chars = web_search.min_snippet_chars
instance-attribute
¶
web_search_planner_enabled = web_search.planner_enabled
instance-attribute
¶
web_search_planner_max_queries = web_search.planner_max_queries
instance-attribute
¶
web_search_planner_min_confidence = web_search.planner_min_confidence
instance-attribute
¶
web_search_planner_min_query_chars = web_search.planner_min_query_chars
instance-attribute
¶
web_search_reuse_evidence_across_attempt = web_search.reuse_evidence_across_attempt
instance-attribute
¶
web_search_top_k = web_search.top_k
instance-attribute
¶
Methods:¶
__init__(llm_provider, search_provider=None, web_search_config=None, facts_validation_config=None, ontology_validation_config=None, citation_vocabulary=None, ontology_catalog=None)
¶
Build the atomic tool surface.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
llm_provider
|
AtomicLLMProvider
|
Supplies budget-aware LLM tools. |
required |
search_provider
|
AtomicSearchProvider | None
|
Optional web-search backend. Without one, search returns no hits regardless of configuration. |
None
|
web_search_config
|
WebSearchConfig | None
|
Web-grounding settings. Defaults to
:class: |
None
|
facts_validation_config
|
FactsValidationConfig | None
|
Facts-gate settings consumed by the render
and critic paths. Defaults to :class: |
None
|
ontology_validation_config
|
OntologyValidationConfig | None
|
Ontology-delta settings, including the
ontology critic's pass budget and patch limits. Defaults to
:class: |
None
|
citation_vocabulary
|
dict[str, str] | None
|
Bibliographic terms for citation-metadata units. Configuration rather than retrieval: a reference list is not domain content, so its vocabulary never reaches the catalog. |
None
|
ontology_catalog
|
AtomicOntologyCatalog | None
|
The scope's full ontology catalog, read by the
per-unit repairs for term membership. The shared surface is
built without one; :meth: |
None
|
Source code in ontocast/tool/atomic.py
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 | |
catalog_roles()
¶
What the bound catalog says each term is; empty when none is bound.
catalog_surface_index()
¶
Labels and local names of every term of the bound catalog.
Read by the per-unit duplicate check: a term the unit's snapshot did not retrieve is still a term a render must not re-mint. Empty when no catalog is bound; memoised by the catalog, so treat it as read-only.
Source code in ontocast/tool/atomic.py
catalog_terms()
¶
Every IRI the bound catalog declares or references, across all of it.
Membership set for the per-unit repairs: a predicate present here is a real catalog term even when the unit's retrieved snapshot omits it, and must never be rewritten toward a look-alike the snapshot does carry. Empty when no catalog is bound. The catalog memoises the set on its served versions, so calling this per unit is cheap; treat the result as read-only.
Source code in ontocast/tool/atomic.py
get_llm_tool(budget_tracker)
async
¶
prefix_table()
¶
The bound scope's prefix table; an empty one when none is bound.
An empty table still shows every well-known namespace under its standard prefix.
Source code in ontocast/tool/atomic.py
scoped_to_catalog(catalog, prefix_tables=None)
¶
A shallow copy of this surface bound to catalog.
The surface is tenancy-independent and shared by every scope; a
catalog is not. Binding on a copy rather than on self keeps one
scope's catalog from being read by a unit of another scope that runs on
the same shared instance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
catalog
|
AtomicOntologyCatalog
|
The scope's ontology catalog. |
required |
prefix_tables
|
Callable[[], PrefixTable] | None
|
Returns the scope's current prefix table; read on every call, since the catalog changes while a document runs. |
None
|
Source code in ontocast/tool/atomic.py
search(query, max_results=None)
async
¶
Run optional web search and return normalized hits.
Source code in ontocast/tool/atomic.py
subject_contract()
¶
What makes a statement name its subject, over the bound catalog.
The statement classes (an observation is about its feature of
interest), the value classes (:meth:value_classes), and the
properties linking a statement and its subject in each direction.
Source code in ontocast/tool/atomic.py
value_classes()
¶
Classes whose instances are values, over the bound catalog.
The well-known value classes and the configured
FACTS_QUANTITY_FALLBACK_VOCABULARY value_class, with every
catalog class under one of them.
Source code in ontocast/tool/atomic.py
web_grounding_enabled_for_node(node)
¶
Return whether web grounding is enabled for a workflow node.
Source code in ontocast/tool/atomic.py
SearchHit
¶
Bases: BaseModel
Single web-search hit used as optional grounding context.