Skip to content

Commit 99315c4

Browse files
authored
Remove misleading warning about Document node not being created (#218)
* Remove misleading warning * Update message
1 parent 4d49525 commit 99315c4

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

examples/build_graph/simple_kg_builder_from_text.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
44
This example assumes a Neo4j db is up and running. Update the credentials below
55
if needed.
6+
7+
NB: when building a KG from text, no 'Document' node is created in the Knowledge Graph.
68
"""
79

810
import asyncio
@@ -21,7 +23,7 @@
2123
# Neo4j db infos
2224
URI = "neo4j://localhost:7687"
2325
AUTH = ("neo4j", "password")
24-
DATABASE = "newdb"
26+
DATABASE = "neo4j"
2527

2628
# Text to process
2729
TEXT = """The son of Duke Leto Atreides and the Lady Jessica, Paul is the heir of House Atreides,

src/neo4j_graphrag/experimental/components/lexical_graph.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
import asyncio
16-
import warnings
16+
import logging
1717
from typing import Any, Dict, Optional
1818

1919
from pydantic import validate_call
@@ -30,6 +30,8 @@
3030
)
3131
from neo4j_graphrag.experimental.pipeline import Component
3232

33+
logger = logging.getLogger(__name__)
34+
3335

3436
class LexicalGraphBuilder(Component):
3537
"""Builds the lexical graph to be inserted into neo4j.
@@ -53,8 +55,9 @@ async def run(
5355
document_info: Optional[DocumentInfo] = None,
5456
) -> GraphResult:
5557
if document_info is None:
56-
warnings.warn(
57-
"No document metadata provided, the document node won't be created in the lexical graph"
58+
logger.info(
59+
"Document node not created in the lexical graph "
60+
"because no document metadata is provided"
5861
)
5962
graph = Neo4jGraph()
6063
document_id = None

0 commit comments

Comments
 (0)