RelikGraphTransformer#
- class langchain_experimental.graph_transformers.relik.RelikGraphTransformer(model: str = 'relik-ie/relik-relation-extraction-small', relationship_confidence_threshold: float = 0.1, model_config: Dict[str, Any] = {}, ignore_self_loops: bool = True)[source]#
A transformer class for converting documents into graph structures using the Relik library and models.
This class leverages relik models for extracting relationships and nodes from text documents and converting them into a graph format. The relationships are filtered based on a specified confidence threshold.
- For more details on the Relik library, visit their GitHub repository:
- Parameters:
model (str) β The name of the pretrained Relik model to use. Default is βrelik-ie/relik-relation-extraction-small-wikipediaβ.
relationship_confidence_threshold (float) β The confidence threshold for filtering relationships. Default is 0.1.
model_config (Dict[str, any]) β Additional configuration options for the Relik model. Default is an empty dictionary.
ignore_self_loops (bool) β Whether to ignore relationships where the source and target nodes are the same. Default is True.
Methods
__init__
([model,Β ...])convert_to_graph_documents
(documents)Convert a sequence of documents into graph documents.
process_document
(document)- __init__(model: str = 'relik-ie/relik-relation-extraction-small', relationship_confidence_threshold: float = 0.1, model_config: Dict[str, Any] = {}, ignore_self_loops: bool = True) None [source]#
- Parameters:
model (str) β
relationship_confidence_threshold (float) β
model_config (Dict[str, Any]) β
ignore_self_loops (bool) β
- Return type:
None
- convert_to_graph_documents(documents: Sequence[Document]) List[GraphDocument] [source]#
Convert a sequence of documents into graph documents.
- Parameters:
documents (Sequence[Document]) β The original documents.
kwargs β Additional keyword arguments.
- Returns:
The transformed documents as graphs.
- Return type:
Sequence[GraphDocument]
- process_document(document: Document) GraphDocument [source]#
- Parameters:
document (Document) β
- Return type: