Skip to content

Commit

Permalink
Remove misleading warning about Document node not being created (#218)
Browse files Browse the repository at this point in the history
* Remove misleading warning

* Update message
  • Loading branch information
stellasia authored Nov 25, 2024
1 parent 4d49525 commit 99315c4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
4 changes: 3 additions & 1 deletion examples/build_graph/simple_kg_builder_from_text.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
This example assumes a Neo4j db is up and running. Update the credentials below
if needed.
NB: when building a KG from text, no 'Document' node is created in the Knowledge Graph.
"""

import asyncio
Expand All @@ -21,7 +23,7 @@
# Neo4j db infos
URI = "neo4j://localhost:7687"
AUTH = ("neo4j", "password")
DATABASE = "newdb"
DATABASE = "neo4j"

# Text to process
TEXT = """The son of Duke Leto Atreides and the Lady Jessica, Paul is the heir of House Atreides,
Expand Down
9 changes: 6 additions & 3 deletions src/neo4j_graphrag/experimental/components/lexical_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import asyncio
import warnings
import logging
from typing import Any, Dict, Optional

from pydantic import validate_call
Expand All @@ -30,6 +30,8 @@
)
from neo4j_graphrag.experimental.pipeline import Component

logger = logging.getLogger(__name__)


class LexicalGraphBuilder(Component):
"""Builds the lexical graph to be inserted into neo4j.
Expand All @@ -53,8 +55,9 @@ async def run(
document_info: Optional[DocumentInfo] = None,
) -> GraphResult:
if document_info is None:
warnings.warn(
"No document metadata provided, the document node won't be created in the lexical graph"
logger.info(
"Document node not created in the lexical graph "
"because no document metadata is provided"
)
graph = Neo4jGraph()
document_id = None
Expand Down

0 comments on commit 99315c4

Please sign in to comment.