You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/source/user_guide_kg_builder.rst
+4-13Lines changed: 4 additions & 13 deletions
Original file line number
Diff line number
Diff line change
@@ -831,7 +831,7 @@ It can be used in this way:
831
831
The LLM to use can be customized, the only constraint is that it obeys the :ref:`LLMInterface <llminterface>`.
832
832
833
833
Schema Enforcement Behaviour
834
-
---------------
834
+
----------------------------
835
835
By default, even if a schema is provided to guide the LLM in the entity and relation extraction, the LLM response is not validated against that schema.
836
836
This behaviour can be changed by using the `enforce_schema` flag in the `LLMEntityRelationExtractor` constructor:
837
837
@@ -844,23 +844,14 @@ This behaviour can be changed by using the `enforce_schema` flag in the `LLMEnti
844
844
# ...
845
845
enforce_schema=SchemaEnforcementMode.STRICT,
846
846
)
847
-
schema = SchemaConfig(
848
-
entities={"Label": {"name": str}},
849
-
relations={"REL_TYPE": {}},
850
-
potential_schema=[("Label", "REL_TYPE", "Label")]
851
-
)
852
-
853
-
#....
854
-
result =await extractor.run(
855
-
#...
856
-
schema=schema
857
-
)
858
847
859
848
In this scenario, any extracted node/relation/property that is not part of the provided schema will be pruned.
860
849
Any relation whose start node or end node does not conform to the provided tuple in `potential_schema` will be pruned.
861
850
If a node is left with no properties, it will be also pruned.
862
851
863
-
Note that if the schema enforcement mode is on but the schema is not provided, no schema enforcement will be applied.
852
+
.. warning::
853
+
854
+
Note that if the schema enforcement mode is on but the schema is not provided, no schema enforcement will be applied.
0 commit comments