Skip to content

Commit f2792ff

Browse files
Merge branch 'chat-history' of github.com:leila-messallem/neo4j-graphrag-python into chat-history
2 parents 597eff1 + 615cea6 commit f2792ff

File tree

83 files changed

+5442
-1886
lines changed

Some content is hidden

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

83 files changed

+5442
-1886
lines changed

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@
22

33
## Next
44

5+
## Added
6+
- Integrated json-repair package to handle and repair invalid JSON generated by LLMs.
7+
- 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).
9+
- Added `OllamaLLM` and `OllamaEmbeddings` classes to make Ollama support more explicit. Implementations using the `OpenAILLM` and `OpenAIEmbeddings` classes will still work.
10+
11+
## Changed
12+
- Updated LLM prompts to include stricter instructions for generating valid JSON.
13+
514
### Fixed
615
- Added schema functions to the documentation.
716

README.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,33 @@ pip install neo4j-graphrag
2727

2828
### Optional Dependencies
2929

30+
This package has some optional features that can be enabled using
31+
the extra dependencies described below:
32+
33+
- LLM providers (at least one is required for RAG and KG Builder Pipeline):
34+
- **ollama**: LLMs from Ollama
35+
- **openai**: LLMs from OpenAI (including AzureOpenAI)
36+
- **google**: LLMs from Vertex AI
37+
- **cohere**: LLMs from Cohere
38+
- **anthropic**: LLMs from Anthropic
39+
- **mistralai**: LLMs from MistralAI
40+
- **sentence-transformers** : to use embeddings from the `sentence-transformers` Python package
41+
- Vector database (to use :ref:`External Retrievers`):
42+
- **weaviate**: store vectors in Weaviate
43+
- **pinecone**: store vectors in Pinecone
44+
- **qdrant**: store vectors in Qdrant
45+
- **experimental**: experimental features such as the Knowledge Graph creation pipelines.
46+
- Warning: this dependency group requires `pygraphviz`. See below for installation instructions.
47+
48+
49+
Install package with optional dependencies with (for instance):
50+
51+
```shell
52+
pip install "neo4j-graphrag[openai]"
53+
# or
54+
pip install "neo4j-graphrag[openai, experimental]"
55+
```
56+
3057
#### pygraphviz
3158

3259
`pygraphviz` is used for visualizing pipelines.

docs/source/api.rst

Lines changed: 68 additions & 9 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
**********
@@ -210,6 +239,12 @@ AzureOpenAIEmbeddings
210239
.. autoclass:: neo4j_graphrag.embeddings.openai.AzureOpenAIEmbeddings
211240
:members:
212241

242+
OllamaEmbeddings
243+
================
244+
245+
.. autoclass:: neo4j_graphrag.embeddings.ollama.OllamaEmbeddings
246+
:members:
247+
213248
VertexAIEmbeddings
214249
==================
215250

@@ -257,6 +292,12 @@ AzureOpenAILLM
257292
:members:
258293
:undoc-members: get_messages, client_class, async_client_class
259294

295+
OllamaLLM
296+
---------
297+
298+
.. autoclass:: neo4j_graphrag.llm.ollama_llm.OllamaLLM
299+
:members:
300+
260301

261302
VertexAILLM
262303
-----------
@@ -297,12 +338,21 @@ RagTemplate
297338

298339
.. autoclass:: neo4j_graphrag.generation.prompts.RagTemplate
299340
:members:
341+
:exclude-members: format
300342

301343
ERExtractionTemplate
302344
--------------------
303345

304346
.. autoclass:: neo4j_graphrag.generation.prompts.ERExtractionTemplate
305347
:members:
348+
:exclude-members: format
349+
350+
Text2CypherTemplate
351+
--------------------
352+
353+
.. autoclass:: neo4j_graphrag.generation.prompts.Text2CypherTemplate
354+
:members:
355+
:exclude-members: format
306356

307357

308358
****
@@ -384,6 +434,8 @@ Errors
384434

385435
* :class:`neo4j_graphrag.experimental.pipeline.exceptions.PipelineStatusUpdateError`
386436

437+
* :class:`neo4j_graphrag.experimental.pipeline.exceptions.InvalidJSONError`
438+
387439

388440
Neo4jGraphRagError
389441
==================
@@ -414,7 +466,7 @@ FilterValidationError
414466

415467

416468
EmbeddingsGenerationError
417-
========================
469+
=========================
418470

419471
.. autoclass:: neo4j_graphrag.exceptions.EmbeddingsGenerationError
420472
:show-inheritance:
@@ -509,3 +561,10 @@ PipelineStatusUpdateError
509561

510562
.. autoclass:: neo4j_graphrag.experimental.pipeline.exceptions.PipelineStatusUpdateError
511563
:show-inheritance:
564+
565+
566+
InvalidJSONError
567+
================
568+
569+
.. autoclass:: neo4j_graphrag.experimental.pipeline.exceptions.InvalidJSONError
570+
:show-inheritance:
13.2 KB
Loading

docs/source/index.rst

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,37 @@ To install the latest stable version, use:
7272

7373
It is always recommended to install python packages for user space in a virtual environment.
7474

75+
*********************
76+
Optional Dependencies
77+
*********************
78+
79+
Extra dependencies can be installed with:
80+
81+
.. code:: bash
82+
83+
pip install "neo4j-graphrag[openai]"
84+
# or
85+
pip install "neo4j-graphrag[openai, experimental]"
86+
87+
88+
List of extra dependencies:
89+
90+
- LLM providers (at least one is required for RAG and KG Builder Pipeline):
91+
- **ollama**: LLMs from Ollama
92+
- **openai**: LLMs from OpenAI (including AzureOpenAI)
93+
- **google**: LLMs from Vertex AI
94+
- **cohere**: LLMs from Cohere
95+
- **anthropic**: LLMs from Anthropic
96+
- **mistralai**: LLMs from MistralAI
97+
- **sentence-transformers** : to use embeddings from the `sentence-transformers` Python package
98+
- Vector database (to use :ref:`External Retrievers`):
99+
- **weaviate**: store vectors in Weaviate
100+
- **pinecone**: store vectors in Pinecone
101+
- **qdrant**: store vectors in Qdrant
102+
- **experimental**: experimental features such as the Knowledge Graph creation pipelines.
103+
- Warning: this requires `pygraphviz`. Installation instructions can be found `here <https://pygraphviz.github.io/documentation/stable/install.html>`_.
104+
105+
75106
********
76107
Examples
77108
********

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)