Skip to content

Commit

Permalink
Merge branch 'main' into chat-history
Browse files Browse the repository at this point in the history
  • Loading branch information
leila-messallem authored Dec 13, 2024
2 parents 5720a4b + c33f9c8 commit 615cea6
Show file tree
Hide file tree
Showing 83 changed files with 5,442 additions and 1,886 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@

## Next

## Added
- Integrated json-repair package to handle and repair invalid JSON generated by LLMs.
- Introduced InvalidJSONError exception for handling cases where JSON repair fails.
- 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).
- Added `OllamaLLM` and `OllamaEmbeddings` classes to make Ollama support more explicit. Implementations using the `OpenAILLM` and `OpenAIEmbeddings` classes will still work.

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

### Fixed
- Added schema functions to the documentation.

Expand Down
27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,33 @@ pip install neo4j-graphrag

### Optional Dependencies

This package has some optional features that can be enabled using
the extra dependencies described below:

- LLM providers (at least one is required for RAG and KG Builder Pipeline):
- **ollama**: LLMs from Ollama
- **openai**: LLMs from OpenAI (including AzureOpenAI)
- **google**: LLMs from Vertex AI
- **cohere**: LLMs from Cohere
- **anthropic**: LLMs from Anthropic
- **mistralai**: LLMs from MistralAI
- **sentence-transformers** : to use embeddings from the `sentence-transformers` Python package
- Vector database (to use :ref:`External Retrievers`):
- **weaviate**: store vectors in Weaviate
- **pinecone**: store vectors in Pinecone
- **qdrant**: store vectors in Qdrant
- **experimental**: experimental features such as the Knowledge Graph creation pipelines.
- Warning: this dependency group requires `pygraphviz`. See below for installation instructions.


Install package with optional dependencies with (for instance):

```shell
pip install "neo4j-graphrag[openai]"
# or
pip install "neo4j-graphrag[openai, experimental]"
```

#### pygraphviz

`pygraphviz` is used for visualizing pipelines.
Expand Down
77 changes: 68 additions & 9 deletions docs/source/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,18 @@ API Documentation
Components
**********

KGWriter
========
DataLoader
==========

.. autoclass:: neo4j_graphrag.experimental.components.kg_writer.KGWriter
:members: run
.. autoclass:: neo4j_graphrag.experimental.components.pdf_loader.DataLoader
:members: run, get_document_metadata

Neo4jWriter
===========

.. autoclass:: neo4j_graphrag.experimental.components.kg_writer.Neo4jWriter
:members: run
PdfLoader
=========

.. autoclass:: neo4j_graphrag.experimental.components.pdf_loader.PdfLoader
:members: run, load_file

TextSplitter
============
Expand Down Expand Up @@ -85,6 +86,17 @@ LLMEntityRelationExtractor
.. autoclass:: neo4j_graphrag.experimental.components.entity_relation_extractor.LLMEntityRelationExtractor
:members: run

KGWriter
========

.. autoclass:: neo4j_graphrag.experimental.components.kg_writer.KGWriter
:members: run

Neo4jWriter
===========

.. autoclass:: neo4j_graphrag.experimental.components.kg_writer.Neo4jWriter
:members: run

SinglePropertyExactMatchResolver
================================
Expand Down Expand Up @@ -112,6 +124,23 @@ SimpleKGPipeline
:members: run_async


************
Config files
************


SimpleKGPipelineConfig
======================

.. autoclass:: neo4j_graphrag.experimental.pipeline.config.template_pipeline.simple_kg_builder.SimpleKGPipelineConfig


PipelineRunner
==============

.. autoclass:: neo4j_graphrag.experimental.pipeline.config.runner.PipelineRunner


.. _retrievers-section:

**********
Expand Down Expand Up @@ -210,6 +239,12 @@ AzureOpenAIEmbeddings
.. autoclass:: neo4j_graphrag.embeddings.openai.AzureOpenAIEmbeddings
:members:

OllamaEmbeddings
================

.. autoclass:: neo4j_graphrag.embeddings.ollama.OllamaEmbeddings
:members:

VertexAIEmbeddings
==================

Expand Down Expand Up @@ -257,6 +292,12 @@ AzureOpenAILLM
:members:
:undoc-members: get_messages, client_class, async_client_class

OllamaLLM
---------

.. autoclass:: neo4j_graphrag.llm.ollama_llm.OllamaLLM
:members:


VertexAILLM
-----------
Expand Down Expand Up @@ -297,12 +338,21 @@ RagTemplate

.. autoclass:: neo4j_graphrag.generation.prompts.RagTemplate
:members:
:exclude-members: format

ERExtractionTemplate
--------------------

.. autoclass:: neo4j_graphrag.generation.prompts.ERExtractionTemplate
:members:
:exclude-members: format

Text2CypherTemplate
--------------------

.. autoclass:: neo4j_graphrag.generation.prompts.Text2CypherTemplate
:members:
:exclude-members: format


****
Expand Down Expand Up @@ -384,6 +434,8 @@ Errors

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

* :class:`neo4j_graphrag.experimental.pipeline.exceptions.InvalidJSONError`


Neo4jGraphRagError
==================
Expand Down Expand Up @@ -414,7 +466,7 @@ FilterValidationError


EmbeddingsGenerationError
========================
=========================

.. autoclass:: neo4j_graphrag.exceptions.EmbeddingsGenerationError
:show-inheritance:
Expand Down Expand Up @@ -509,3 +561,10 @@ PipelineStatusUpdateError

.. autoclass:: neo4j_graphrag.experimental.pipeline.exceptions.PipelineStatusUpdateError
:show-inheritance:


InvalidJSONError
================

.. autoclass:: neo4j_graphrag.experimental.pipeline.exceptions.InvalidJSONError
:show-inheritance:
Binary file modified docs/source/images/kg_builder_pipeline.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
31 changes: 31 additions & 0 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,37 @@ To install the latest stable version, use:

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

*********************
Optional Dependencies
*********************

Extra dependencies can be installed with:

.. code:: bash
pip install "neo4j-graphrag[openai]"
# or
pip install "neo4j-graphrag[openai, experimental]"
List of extra dependencies:

- LLM providers (at least one is required for RAG and KG Builder Pipeline):
- **ollama**: LLMs from Ollama
- **openai**: LLMs from OpenAI (including AzureOpenAI)
- **google**: LLMs from Vertex AI
- **cohere**: LLMs from Cohere
- **anthropic**: LLMs from Anthropic
- **mistralai**: LLMs from MistralAI
- **sentence-transformers** : to use embeddings from the `sentence-transformers` Python package
- Vector database (to use :ref:`External Retrievers`):
- **weaviate**: store vectors in Weaviate
- **pinecone**: store vectors in Pinecone
- **qdrant**: store vectors in Qdrant
- **experimental**: experimental features such as the Knowledge Graph creation pipelines.
- Warning: this requires `pygraphviz`. Installation instructions can be found `here <https://pygraphviz.github.io/documentation/stable/install.html>`_.


********
Examples
********
Expand Down
59 changes: 59 additions & 0 deletions docs/source/types.rst
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,62 @@ SchemaConfig
============

.. autoclass:: neo4j_graphrag.experimental.components.schema.SchemaConfig

LexicalGraphConfig
===================

.. autoclass:: neo4j_graphrag.experimental.components.types.LexicalGraphConfig


Neo4jDriverType
===============

.. autoclass:: neo4j_graphrag.experimental.pipeline.config.object_config.Neo4jDriverType


Neo4jDriverConfig
=================

.. autoclass:: neo4j_graphrag.experimental.pipeline.config.object_config.Neo4jDriverConfig


LLMType
=======

.. autoclass:: neo4j_graphrag.experimental.pipeline.config.object_config.LLMType


LLMConfig
=========

.. autoclass:: neo4j_graphrag.experimental.pipeline.config.object_config.LLMConfig


EmbedderType
============

.. autoclass:: neo4j_graphrag.experimental.pipeline.config.object_config.EmbedderType


EmbedderConfig
==============

.. autoclass:: neo4j_graphrag.experimental.pipeline.config.object_config.EmbedderConfig


ComponentType
=============

.. autoclass:: neo4j_graphrag.experimental.pipeline.config.object_config.ComponentType


ComponentConfig
===============

.. autoclass:: neo4j_graphrag.experimental.pipeline.config.object_config.ComponentConfig


ParamFromEnvConfig
==================

.. autoclass:: neo4j_graphrag.experimental.pipeline.config.param_resolver.ParamFromEnvConfig
Loading

0 comments on commit 615cea6

Please sign in to comment.