TheDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/arg-tech/xaif/llms.txt
Use this file to discover all available pages before exploring further.
AIF class provides several methods for validating, inspecting, and traversing xAIF structures without modifying them. These methods are safe to call at any point in a graph’s lifecycle and can be combined to build custom traversal or export pipelines on top of the in-memory dict.
is_valid_json_aif()
AIF section of the document contains all three required top-level keys: nodes, edges, and locutions. Returns True if all three are present, False otherwise. This is a lightweight structural check — it does not validate the content of each list.
is_json_aif_dialog()
True if any node in AIF["nodes"] has type == "L" (i.e. at least one locution node is present), indicating that the graph represents a dialogue. Returns False for monological graphs that contain only I-nodes and relation nodes.
get_speaker(node_id)
node_id. The method joins AIF["locutions"] and AIF["participants"] in memory to resolve the name.
Returns: ("Firstname Lastname", participantID) when a match is found, or ("None None", "None") when node_id is not present in any locution entry.
get_next_max_id(component_type, id_key_word)
"12_0"). Returns 0 when the list is empty.
The top-level key in
aif to scan. Use "nodes" to get the next node ID or "edges" to get the next edge ID.The key within each entry that holds the ID value. Use
"nodeID" when scanning nodes and "edgeID" when scanning edges.get_i_node_ya_nodes_for_l_node(Lnode_ID)
AIF["edges"] to find the YA-node immediately downstream of the given L-node and the I-node downstream of that YA-node. This reflects the standard L → YA → I chain created by add_component("proposition", ...).
Returns: (inode_id, ya_node_id) when the chain is found, or (None, None) if the L-node has no outgoing edges or its YA-node has no outgoing edges.
get_xAIF_arrays(aif_section, xaif_elements)
xaif_elements. Missing keys return None (the dict’s default for .get()).
Any dict conforming to the AIF section schema — typically
aif.aif or a sub-section of it.An ordered list of key names to extract. The returned tuple preserves this order.
remove_entry(Lnode_ID)
- Resolves the YA-node and I-node connected to
Lnode_IDviaget_i_node_ya_nodes_for_l_node. - Filters
AIF["nodes"]to remove the L-node, I-node, and YA-node. - Filters
AIF["locutions"]to remove the locution entry forLnode_ID. - Filters
AIF["edges"]to remove all edges that reference the L-node, I-node, or YA-node as eitherfromIDortoID.
remove_entry is called internally by _add_segment after creating replacement nodes, but it can also be called directly to delete a locution and its proposition.
remove_entry is irreversible. It modifies the in-memory dict in place and there is no undo mechanism. If you need to preserve the original graph, take a deep copy with copy.deepcopy(aif.xaif) before calling this method.create_turn_entry(...)
initilise_empty to populate node, locution, participant, and text-span lists from a single turn (or a batch of turns when dialogue=True). Returns a tuple of (nodes, locutions, participants, text_with_span, node_id, person_id) with all lists and counters updated.
When dialogue=False (the default during plain-text initialisation), propositions is treated as a single string and attributed to "Default Speaker". When dialogue=True, propositions must be a list of (speaker_name, text) tuples.
