Skip to content

Commit 5a93f6c

Browse files
authored
Moved schema to components/ (neo4j#96)
1 parent 632b12f commit 5a93f6c

File tree

10 files changed

+39
-6
lines changed

10 files changed

+39
-6
lines changed

examples/pipeline/kg_builder_with_schema.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
import logging
1919
from typing import Any
2020

21-
from neo4j_genai.kg_construction.schema import (
21+
from neo4j_genai.components.schema import (
2222
SchemaBuilder,
2323
SchemaEntity,
2424
SchemaRelation,
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Copyright (c) "Neo4j"
2+
# Neo4j Sweden AB [https://neo4j.com]
3+
# #
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
# #
8+
# https://www.apache.org/licenses/LICENSE-2.0
9+
# #
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.

src/neo4j_genai/components/kg_writer.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,12 @@
1818
from typing import Literal, Optional
1919

2020
import neo4j
21+
from pydantic import validate_call
22+
2123
from neo4j_genai.components.types import Neo4jGraph, Neo4jNode, Neo4jRelationship
2224
from neo4j_genai.indexes import upsert_vector, upsert_vector_on_relationship
2325
from neo4j_genai.neo4j_queries import UPSERT_NODE_QUERY, UPSERT_RELATIONSHIP_QUERY
2426
from neo4j_genai.pipeline.component import Component, DataModel
25-
from pydantic import validate_call
2627

2728

2829
class KGWriterModel(DataModel):

src/neo4j_genai/kg_construction/schema.py renamed to src/neo4j_genai/components/schema.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,10 @@
3030

3131
from typing import Any, Dict, List, Literal, Tuple
3232

33+
from pydantic import BaseModel, ValidationError, model_validator, validate_call
34+
3335
from neo4j_genai.exceptions import SchemaValidationError
3436
from neo4j_genai.pipeline import Component, DataModel
35-
from pydantic import BaseModel, ValidationError, model_validator, validate_call
3637

3738

3839
class SchemaProperty(BaseModel):

src/neo4j_genai/components/text_splitters/langchain.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
from __future__ import annotations
1616

1717
from langchain_text_splitters import TextSplitter as LangChainTextSplitter
18+
1819
from neo4j_genai.components.text_splitters.base import TextSplitter
1920
from neo4j_genai.components.types import TextChunk, TextChunks
2021

src/neo4j_genai/components/text_splitters/llamaindex.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
from __future__ import annotations
1616

1717
from llama_index.core.node_parser import TextSplitter as LlamaIndexTextSplitter
18+
1819
from neo4j_genai.components.text_splitters.base import TextSplitter
1920
from neo4j_genai.components.types import TextChunk, TextChunks
2021

src/neo4j_genai/components/types.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,10 @@
1616

1717
from typing import Any, Optional
1818

19-
from neo4j_genai.pipeline.component import DataModel
2019
from pydantic import BaseModel, field_validator
2120

21+
from neo4j_genai.pipeline.component import DataModel
22+
2223

2324
class TextChunk(BaseModel):
2425
"""A chunk of text split from a document by a text splitter.

src/neo4j_genai/pipeline/components/__init__.py

Whitespace-only changes.

tests/unit/components/__init__.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Copyright (c) "Neo4j"
2+
# Neo4j Sweden AB [https://neo4j.com]
3+
# #
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
# #
8+
# https://www.apache.org/licenses/LICENSE-2.0
9+
# #
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.

tests/unit/kg_construction/test_schema.py renamed to tests/unit/components/test_schema.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@
1515
from __future__ import annotations
1616

1717
import pytest
18-
from neo4j_genai.exceptions import SchemaValidationError
19-
from neo4j_genai.kg_construction.schema import (
18+
from neo4j_genai.components.schema import (
2019
SchemaBuilder,
2120
SchemaEntity,
2221
SchemaProperty,
2322
SchemaRelation,
2423
)
24+
from neo4j_genai.exceptions import SchemaValidationError
2525
from pydantic import ValidationError
2626

2727

0 commit comments

Comments
 (0)