Skip to content

Commit ff6862e

Browse files
authored
Pipeline from config file (#220)
* SimpleKGPipeline config parser * Factorize common parmeters * Fix * Fix again (ruff) * Add builder, docstrings * Adds example * Ruff * Add headers * Another header * Remove old file - more detailed example * Fix JSON * WIP * Adds more param resolvers * A bit of mypy * Add root types to allow instantiation from python object directly * Document + mypy * Add embedder config * Implement SimpleKGBuilder with this setup * Add YAML config example * Example config files for custom pipeline * Update SimpleKGPipeline * Fix UT * Fix tests * Simplify and mypy * ruff * Add missing dep * Missing import for '|' annotations * Restructure files + increase tests coverage * mypy * Refactor examples * Test runner, clean simple kg builder test (remove duplicates) * E2E tests * Use fsspec in config reader * Changelog * Fix test * Use cast to remove a type ignore comment * Also use cast here to remove type ignore * Close instantiated drivers * ruff * Adding loggers * Make close function async * Fix tests * fix UT * Write doc about SimpleKGPipeline and config files * Update api.rst * Recreate lock file after merge * Add more comments to explain Config/Type models
1 parent b2ba9a3 commit ff6862e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+3721
-551
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
## Added
66
- Integrated json-repair package to handle and repair invalid JSON generated by LLMs.
77
- Introduced InvalidJSONError exception for handling cases where JSON repair fails.
8+
- Ability to create a Pipeline or SimpleKGPipeline from a config file. See [the example](examples/build_graph/from_config_files/simple_kg_pipeline_from_config_file.py).
89

910
## Changed
1011
- Updated LLM prompts to include stricter instructions for generating valid JSON.

docs/source/api.rst

Lines changed: 37 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,18 @@ API Documentation
99
Components
1010
**********
1111

12-
KGWriter
13-
========
12+
DataLoader
13+
==========
1414

15-
.. autoclass:: neo4j_graphrag.experimental.components.kg_writer.KGWriter
16-
:members: run
15+
.. autoclass:: neo4j_graphrag.experimental.components.pdf_loader.DataLoader
16+
:members: run, get_document_metadata
1717

18-
Neo4jWriter
19-
===========
2018

21-
.. autoclass:: neo4j_graphrag.experimental.components.kg_writer.Neo4jWriter
22-
:members: run
19+
PdfLoader
20+
=========
21+
22+
.. autoclass:: neo4j_graphrag.experimental.components.pdf_loader.PdfLoader
23+
:members: run, load_file
2324

2425
TextSplitter
2526
============
@@ -85,6 +86,17 @@ LLMEntityRelationExtractor
8586
.. autoclass:: neo4j_graphrag.experimental.components.entity_relation_extractor.LLMEntityRelationExtractor
8687
:members: run
8788

89+
KGWriter
90+
========
91+
92+
.. autoclass:: neo4j_graphrag.experimental.components.kg_writer.KGWriter
93+
:members: run
94+
95+
Neo4jWriter
96+
===========
97+
98+
.. autoclass:: neo4j_graphrag.experimental.components.kg_writer.Neo4jWriter
99+
:members: run
88100

89101
SinglePropertyExactMatchResolver
90102
================================
@@ -112,6 +124,23 @@ SimpleKGPipeline
112124
:members: run_async
113125

114126

127+
************
128+
Config files
129+
************
130+
131+
132+
SimpleKGPipelineConfig
133+
======================
134+
135+
.. autoclass:: neo4j_graphrag.experimental.pipeline.config.template_pipeline.simple_kg_builder.SimpleKGPipelineConfig
136+
137+
138+
PipelineRunner
139+
==============
140+
141+
.. autoclass:: neo4j_graphrag.experimental.pipeline.config.runner.PipelineRunner
142+
143+
115144
.. _retrievers-section:
116145

117146
**********
13.2 KB
Loading

docs/source/types.rst

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,3 +82,62 @@ SchemaConfig
8282
============
8383

8484
.. autoclass:: neo4j_graphrag.experimental.components.schema.SchemaConfig
85+
86+
LexicalGraphConfig
87+
===================
88+
89+
.. autoclass:: neo4j_graphrag.experimental.components.types.LexicalGraphConfig
90+
91+
92+
Neo4jDriverType
93+
===============
94+
95+
.. autoclass:: neo4j_graphrag.experimental.pipeline.config.object_config.Neo4jDriverType
96+
97+
98+
Neo4jDriverConfig
99+
=================
100+
101+
.. autoclass:: neo4j_graphrag.experimental.pipeline.config.object_config.Neo4jDriverConfig
102+
103+
104+
LLMType
105+
=======
106+
107+
.. autoclass:: neo4j_graphrag.experimental.pipeline.config.object_config.LLMType
108+
109+
110+
LLMConfig
111+
=========
112+
113+
.. autoclass:: neo4j_graphrag.experimental.pipeline.config.object_config.LLMConfig
114+
115+
116+
EmbedderType
117+
============
118+
119+
.. autoclass:: neo4j_graphrag.experimental.pipeline.config.object_config.EmbedderType
120+
121+
122+
EmbedderConfig
123+
==============
124+
125+
.. autoclass:: neo4j_graphrag.experimental.pipeline.config.object_config.EmbedderConfig
126+
127+
128+
ComponentType
129+
=============
130+
131+
.. autoclass:: neo4j_graphrag.experimental.pipeline.config.object_config.ComponentType
132+
133+
134+
ComponentConfig
135+
===============
136+
137+
.. autoclass:: neo4j_graphrag.experimental.pipeline.config.object_config.ComponentConfig
138+
139+
140+
ParamFromEnvConfig
141+
==================
142+
143+
.. autoclass:: neo4j_graphrag.experimental.pipeline.config.param_resolver.ParamFromEnvConfig

0 commit comments

Comments
 (0)