owlapy.agen_kg.signatures
Classes
Module Contents
- class owlapy.agen_kg.signatures.Entity(/, **data: Any)[source]
Bases:
dspy.Signature- __doc__ = Multiline-String
Show Value
"""Given a piece of text as input identify key entities extracted form the text. The result should be a list of capitalized entities. E.g., ["ENTITY1", "ENTITY2", ...]"""
- class owlapy.agen_kg.signatures.Triple(/, **data: Any)[source]
Bases:
dspy.Signature- __doc__ = Multiline-String
Show Value
"""Given a piece of text and entities, identify triples of type source_entity-relation-target_entity where source_entity and target_entity are strictly part of the given entities."""
- class owlapy.agen_kg.signatures.TypeAssertion(/, **data: Any)[source]
Bases:
dspy.Signature- __doc__ = 'Given a list of entities, a list of types and textual contex, assign types to the entities.'
- class owlapy.agen_kg.signatures.TypeGeneration(/, **data: Any)[source]
Bases:
dspy.Signature- __doc__ = 'Given a list of entities and textual contex, assign meaningful general types to the entities.'
- class owlapy.agen_kg.signatures.Literal(/, **data: Any)[source]
Bases:
dspy.Signature- __doc__ = Multiline-String
Show Value
"""Given a piece of text as input identify key numerical values extracted form the text. The result should be a list of numerical literals. E.g., ["123", "45.67", "50%", ...]"""
- class owlapy.agen_kg.signatures.SPLTriples(/, **data: Any)[source]
Bases:
dspy.Signature- __doc__ = Multiline-String
Show Value
"""Given a piece of text, entities and numeric literals, identify triples of type source_entity-relation-target_value where source_entity is strictly part of the given entities and the target_value is strictly part of the given numeric literals."""
- class owlapy.agen_kg.signatures.Domain(/, **data: Any)[source]
Bases:
dspy.Signature- __doc__ = Multiline-String
Show Value
"""Given a piece of text, identify the primary domain or topic of the text. Example domains: 'biology', 'chemistry', 'finance', 'sports', 'politics', 'medicine', 'computer science'. """
- class owlapy.agen_kg.signatures.DomainSpecificFewShotGenerator(/, **data: Any)[source]
Bases:
dspy.Signature- __doc__ = Multiline-String
Show Value
"""Given a domain (e.g., 'biology', 'finance', 'sports'), generate few-shot examples tailored to that domain for a specific task (entity extraction, triple extraction, type assertion, etc.). The examples should follow the same format as the general few-shot examples but with domain-specific content."""
- num_examples: int = None
- class owlapy.agen_kg.signatures.EntityDeduplication(/, **data: Any)[source]
Bases:
dspy.Signature- __doc__ = Multiline-String
Show Value
"""Given a list of entities, identify and remove redundant near-duplicates that refer to the same real-world entity. Consider variations in spelling, abbreviations, and naming conventions. For example, given ['Ben Smith', 'B. Smith'], remove 'B. Smith' and keep 'Ben Smith'. Preserve most entities - only filter out those that are very closely resembled or abbreviated versions of more complete entities. Return a filtered list with redundant entities removed."""
- class owlapy.agen_kg.signatures.CoherenceChecker(/, **data: Any)[source]
Bases:
dspy.Signature- __doc__ = Multiline-String
Show Value
"""Given a batch of triples, textual context and optional instructions, evaluate the logical coherence and factual consistency of the triples. Rate each triple's coherence on a scale of 1-5, where 1 means incoherent, contradictory or trivial and 5 means highly coherent and consistent. Identify any contradictions or logical inconsistencies between triples."""
- class owlapy.agen_kg.signatures.TypeClustering(/, **data: Any)[source]
Bases:
dspy.Signature- __doc__ = Multiline-String
Show Value
"""Given a list of entity types, identify duplicates and near-duplicates that refer to the same conceptual type. Consider variations in spelling, singular/plural forms, synonyms, and different naming conventions. Return clusters of types that should be merged together, along with the canonical type name to use for each cluster."""
- class owlapy.agen_kg.signatures.RelationClustering(/, **data: Any)[source]
Bases:
dspy.Signature- __doc__ = Multiline-String
Show Value
"""Given a list of relations, identify duplicates and near-duplicates that refer to the same relationship. Consider variations in spelling, synonyms, different phrasings, and naming conventions. Return clusters of relations that should be merged together, along with the canonical relation name to use for each cluster."""
- class owlapy.agen_kg.signatures.TextSummarizer(/, **data: Any)[source]
Bases:
dspy.Signature- __doc__ = Multiline-String
Show Value
"""Given a piece of text, generate a concise summary that preserves all key entities, relationships, types, and factual information mentioned. The summary should capture the essential semantic content without losing important details needed for knowledge graph extraction."""
- class owlapy.agen_kg.signatures.ChunkSummarizer(/, **data: Any)[source]
Bases:
dspy.Signature- __doc__ = Multiline-String
Show Value
"""Given multiple text chunk summaries, combine them into a unified comprehensive summary. The combined summary should deduplicate information, preserve all unique entities and relationships, and maintain coherence across the merged content."""
- class owlapy.agen_kg.signatures.EntityDeduplicationWithSummary(/, **data: Any)[source]
Bases:
dspy.Signature- __doc__ = Multiline-String
Show Value
"""Given a list of entities and a summary of the source text, identify and remove redundant near-duplicates that refer to the same real-world entity. Consider variations in spelling, abbreviations, and naming conventions. For example, given ['Ben Smith', 'B. Smith'], remove 'B. Smith' and keep 'Ben Smith'. Preserve most entities - only filter out those that are very closely resembled or abbreviated versions of more complete entities. Return a filtered list with redundant entities removed."""
- class owlapy.agen_kg.signatures.TypeClusteringWithSummary(/, **data: Any)[source]
Bases:
dspy.Signature- __doc__ = Multiline-String
Show Value
"""Given a list of entity types and a summary of the source text, identify duplicates and near-duplicates that refer to the same conceptual type. Consider variations in spelling, singular/plural forms, synonyms, and different naming conventions. Return clusters of types that should be merged together, along with the canonical type name to use for each cluster."""
- class owlapy.agen_kg.signatures.RelationClusteringWithSummary(/, **data: Any)[source]
Bases:
dspy.Signature- __doc__ = Multiline-String
Show Value
"""Given a list of relations and a summary of the source text, identify duplicates and near-duplicates that refer to the same relationship. Consider variations in spelling, synonyms, different phrasings, and naming conventions. Return clusters of relations that should be merged together, along with the canonical relation name to use for each cluster."""
- class owlapy.agen_kg.signatures.IncrementalEntityMerger(/, **data: Any)[source]
Bases:
dspy.Signature- __doc__ = Multiline-String
Show Value
"""Given two sets of entities from different text chunks along with context, merge them into a unified list. Identify entities that refer to the same real-world entity across chunks and produce a canonical list. Consider different mentions, abbreviations, and naming conventions that may appear across chunks."""
- class owlapy.agen_kg.signatures.IncrementalTripleMerger(/, **data: Any)[source]
Bases:
dspy.Signature- __doc__ = Multiline-String
Show Value
"""Given two sets of triples from different text chunks along with context, merge them into a unified list. Identify triples that represent the same relationship (possibly with different wording) and produce a canonical list. Handle variations in entity names and relation phrasings across chunks."""
- class owlapy.agen_kg.signatures.IncrementalTypeMerger(/, **data: Any)[source]
Bases:
dspy.Signature- __doc__ = Multiline-String
Show Value
"""Given two sets of entity-type pairs from different text chunks, merge them into a unified list. Resolve any conflicting type assignments for the same entity, preferring more specific types. Handle variations in type naming across chunks."""
- class owlapy.agen_kg.signatures.PlanDecomposer(/, **data: Any)[source]
Bases:
dspy.Signature- __doc__ = Multiline-String
Show Value
"""We want to extract knowledge from text in triples format. The pipeline follows these steps: entity extraction, triple extraction, type assertion, literal extraction, triple extraction with numeric literals. Given the user's query about the knowledge graph to be extracted, decompose it into sub-tasks that can be used as instructions for each step of the pipeline."""
- class owlapy.agen_kg.signatures.BatchRdfsCommentGenerator(/, **data: Any)[source]
Bases:
dspy.Signature- __doc__ = Multiline-String
Show Value
"""We want to generate rdfs:comment annotations for OWL ontology entities. ENTITY SEMANTICS: - class: TBox concept (universal category). - property: TBox relation (no concrete values allowed). - individual: ABox instance (named individual in the ontology). CRITICAL RULES: - NEVER invent facts not present in the context or IRI. - For classes and properties: describe ONLY general meaning (TBox level). - For individuals: describe their role according to the context's content. - If no grounded description exists, return null. - For each comment, internally identify which phrases from the context support it; do not include unsupported concepts. - Keep comments concise and ontology-style, not narrative."""