ontocast.onto.model¶
BasePydanticModel
¶
Bases: BaseModel
Base class for Pydantic models with serialization capabilities.
Source code in ontocast/onto/model.py
__init__(**kwargs)
¶
load(file_path)
classmethod
¶
Load state from a JSON file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_path
|
str | Path
|
Path to the JSON file. |
required |
Returns:
| Type | Description |
|---|---|
|
The loaded model instance. |
Source code in ontocast/onto/model.py
serialize(file_path)
¶
Serialize the state to a JSON file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_path
|
str | Path
|
Path to save the JSON file. |
required |
Source code in ontocast/onto/model.py
ExternalEvidenceCacheEntry
¶
Bases: BaseModel
Node-scoped external evidence planning/fetch outputs.
Source code in ontocast/onto/model.py
ExternalEvidenceHit
¶
Bases: BaseModel
Normalized external evidence hit metadata.
Source code in ontocast/onto/model.py
ExternalEvidencePlan
¶
Bases: BaseModel
Structured plan for optional external evidence retrieval.
Source code in ontocast/onto/model.py
ExternalEvidenceRequest
¶
Bases: BaseModel
Node-level request for optional web search.
Nodes use this to explicitly signal whether downstream evidence planning/fetching should run for another pass.
Source code in ontocast/onto/model.py
FactsRenderReport
¶
Bases: BaseModel
Facts rendering output with optional search decision.
Source code in ontocast/onto/model.py
GraphUpdateRenderReport
¶
Bases: BaseModel
Graph update rendering output with optional search decision.
Source code in ontocast/onto/model.py
OntologyCritiqueReport
¶
Bases: BaseModel
Report from ontology update critique process.
Source code in ontocast/onto/model.py
OntologyRenderReport
¶
Bases: BaseModel
Ontology rendering output with optional search decision.
Source code in ontocast/onto/model.py
OntologySelectorReport
¶
Bases: BasePydanticModel
Base class for ontology selection report.
Note: Use create_ontology_selector_report_model() to create a model with the correct answer_index constraint.
Source code in ontocast/onto/model.py
SemanticTriplesFactsReport
¶
Bases: BaseModel
Report containing semantic triples and evaluation scores.
Graph payloads follow LLM_GRAPH_FORMAT; both wire encodings parse to RDFGraph.
Attributes:
| Name | Type | Description |
|---|---|---|
semantic_graph |
LLMGraphWire
|
Semantic triples (facts) representing the document. |
ontology_relevance_score |
float | None
|
Score 0-100 for how relevant the ontology is to the document. 0 is the worst, 100 is the best. |
triples_generation_score |
float | None
|
Score 0-100 for how well the facts extraction / triples generation was performed. 0 is the worst, 100 is the best. |
Source code in ontocast/onto/model.py
Suggestions
¶
Bases: BaseModel
Report from knowledge graph critique process.
Attributes:
| Name | Type | Description |
|---|---|---|
systemic_critique_summary |
str
|
A compilation of general improvement suggestions. |
actionable_fixes |
list[TripleFix]
|
An itemized list of concrete suggestions for improvement. |
Source code in ontocast/onto/model.py
from_critique_report(critique)
classmethod
¶
Create Suggestions from any critique report.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
critique
|
OntologyCritiqueReport | FactsCritiqueReport
|
Either an OntologyCritiqueReport or FactsCritiqueReport to convert. |
required |
Returns:
| Type | Description |
|---|---|
Suggestions
|
Suggestions object with actionable fixes and systemic critique summary. |
Source code in ontocast/onto/model.py
to_markdown()
¶
Convert actionable fixes and systemic critique summary to a unified markdown block.
Returns:
| Type | Description |
|---|---|
str
|
Markdown formatted string with both actionable fixes and systemic critique summary. |
Source code in ontocast/onto/model.py
TripleFix
¶
Bases: BaseModel
A single actionable correction to an RDF facts or ontology graph.
incorrect_value / correct_value are plain strings; encoding follows
deployment llm_graph_format and GRAPH FORMAT INSTRUCTION.
Source code in ontocast/onto/model.py
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 | |
normalize_severity(v)
classmethod
¶
Normalize severity values to accepted literals.
Maps 'major' to 'important' for backward compatibility with prompts that use 'major' terminology. This allows the LLM to use either term.
Source code in ontocast/onto/model.py
to_markdown()
¶
Convert this TripleFix to markdown format.
Returns:
| Type | Description |
|---|---|
str
|
Markdown formatted string representing this fix. |
Source code in ontocast/onto/model.py
create_ontology_selector_report_model(num_ontologies)
¶
Create a dynamic OntologySelectorReport model with answer_index constraint.
The answer_index field is constrained to be between 1 and num_ontologies + 1, where: - 1 to num_ontologies: corresponds to the ontology at that index (1-based) - num_ontologies + 1: represents "None" (no suitable ontology)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
num_ontologies
|
int
|
The number of ontologies in the selection list. |
required |
Returns:
| Type | Description |
|---|---|
type[BasePydanticModel]
|
A dynamically created Pydantic model class with the appropriate constraint. |