ontocast.agent
¶
Agent module for OntoCast.
This module provides a collection of agents that handle various aspects of ontology processing, including document conversion, text chunking, fact aggregation, and ontology management. Each agent is designed to perform a specific task in the ontology processing pipeline.
aggregate_serialize(state, tools)
¶
Create a node that saves the knowledge graph.
Source code in ontocast/agent/aggregate_facts.py
check_chunks_empty(state)
¶
Check if chunks are available and manage chunk processing state.
This function checks if there are remaining chunks to process and manages the state transitions accordingly. If chunks are available, it sets up the next chunk for processing. If no chunks remain, it signals completion of the workflow.
The function performs the following operations: 1. Adds the current chunk to the processed list if it exists 2. Checks if there are remaining chunks to process 3. Sets up the next chunk and resets node visits if chunks remain 4. Sets appropriate status for workflow routing
Parameters:
Name | Type | Description | Default |
---|---|---|---|
state
|
AgentState
|
The current agent state containing chunks and processing status. |
required |
Returns:
Name | Type | Description |
---|---|---|
AgentState |
AgentState
|
Updated agent state with chunk processing information. |
Example
state = AgentState(chunks=[chunk1, chunk2], current_chunk=None) updated_state = check_chunks_empty(state) print(updated_state.current_chunk) # chunk1 print(updated_state.status) # Status.FAILED
Source code in ontocast/agent/check_chunks.py
render_onto_triples(state, tools)
¶
Render ontology triples into a human-readable format.
This function takes the triples from the current ontology and renders them into a more accessible format, making the ontological knowledge easier to understand.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
state
|
AgentState
|
The current agent state containing the ontology to render. |
required |
tools
|
ToolBox
|
The toolbox instance providing utility functions. |
required |
Returns:
Name | Type | Description |
---|---|---|
AgentState |
AgentState
|
Updated state with rendered triples. |