Skip to content

Commit b2ba9a3

Browse files
authored
Document extra dependencies (#232)
* Add documentation for the "extra" dependency groups * Use multiline strings instead of mixing '' and ""
1 parent 0ac06b7 commit b2ba9a3

File tree

13 files changed

+77
-21
lines changed

13 files changed

+77
-21
lines changed

README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,32 @@ 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+
- **openai**: LLMs from OpenAI (including AzureOpenAI)
35+
- **google**: LLMs from Vertex AI
36+
- **cohere**: LLMs from Cohere
37+
- **anthropic**: LLMs from Anthropic
38+
- **mistralai**: LLMs from MistralAI
39+
- **sentence-transformers** : to use embeddings from the `sentence-transformers` Python package
40+
- Vector database (to use :ref:`External Retrievers`):
41+
- **weaviate**: store vectors in Weaviate
42+
- **pinecone**: store vectors in Pinecone
43+
- **qdrant**: store vectors in Qdrant
44+
- **experimental**: experimental features such as the Knowledge Graph creation pipelines.
45+
- Warning: this dependency group requires `pygraphviz`. See below for installation instructions.
46+
47+
48+
Install package with optional dependencies with (for instance):
49+
50+
```shell
51+
pip install "neo4j-graphrag[openai]"
52+
# or
53+
pip install "neo4j-graphrag[openai, experimental]"
54+
```
55+
3056
#### pygraphviz
3157

3258
`pygraphviz` is used for visualizing pipelines.

docs/source/api.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ FilterValidationError
416416

417417

418418
EmbeddingsGenerationError
419-
========================
419+
=========================
420420

421421
.. autoclass:: neo4j_graphrag.exceptions.EmbeddingsGenerationError
422422
:show-inheritance:

docs/source/index.rst

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,36 @@ 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+
- **openai**: LLMs from OpenAI (including AzureOpenAI)
92+
- **google**: LLMs from Vertex AI
93+
- **cohere**: LLMs from Cohere
94+
- **anthropic**: LLMs from Anthropic
95+
- **mistralai**: LLMs from MistralAI
96+
- **sentence-transformers** : to use embeddings from the `sentence-transformers` Python package
97+
- Vector database (to use :ref:`External Retrievers`):
98+
- **weaviate**: store vectors in Weaviate
99+
- **pinecone**: store vectors in Pinecone
100+
- **qdrant**: store vectors in Qdrant
101+
- **experimental**: experimental features such as the Knowledge Graph creation pipelines.
102+
- Warning: this requires `pygraphviz`. Installation instructions can be found `here <https://pygraphviz.github.io/documentation/stable/install.html>`_.
103+
104+
75105
********
76106
Examples
77107
********

src/neo4j_graphrag/embeddings/cohere.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ class CohereEmbeddings(Embedder):
2828
def __init__(self, model: str = "", **kwargs: Any) -> None:
2929
if cohere is None:
3030
raise ImportError(
31-
"Could not import cohere python client. "
32-
"Please install it with `pip install cohere`."
31+
"""Could not import cohere python client.
32+
Please install it with `pip install "neo4j-graphrag[cohere]"`."""
3333
)
3434
self.model = model
3535
self.client = cohere.Client(**kwargs)

src/neo4j_graphrag/embeddings/mistral.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ class MistralAIEmbeddings(Embedder):
3939
def __init__(self, model: str = "mistral-embed", **kwargs: Any) -> None:
4040
if Mistral is None:
4141
raise ImportError(
42-
"Could not import mistralai. "
43-
"Please install it with `pip install mistralai`."
42+
"""Could not import mistralai.
43+
Please install it with `pip install "neo4j-graphrag[mistralai]"`."""
4444
)
4545
api_key = kwargs.pop("api_key", None)
4646
if api_key is None:

src/neo4j_graphrag/embeddings/openai.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ def __init__(self, model: str = "text-embedding-ada-002", **kwargs: Any) -> None
3636
import openai
3737
except ImportError:
3838
raise ImportError(
39-
"Could not import openai python client. "
40-
"Please install it with `pip install openai`."
39+
"""Could not import openai python client.
40+
Please install it with `pip install "neo4j-graphrag[openai]"`."""
4141
)
4242
self.openai = openai
4343
self.model = model

src/neo4j_graphrag/embeddings/sentence_transformers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ def __init__(
2828
import torch
2929
except ImportError:
3030
raise ImportError(
31-
"Could not import sentence_transformers python package. "
32-
"Please install it with `pip install sentence-transformers`."
31+
"""Could not import sentence_transformers python package.
32+
Please install it with `pip install "neo4j-graphrag[sentence-transformers]"`."""
3333
)
3434
self.torch = torch
3535
self.np = np

src/neo4j_graphrag/embeddings/vertexai.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ class VertexAIEmbeddings(Embedder):
3636
def __init__(self, model: str = "text-embedding-004") -> None:
3737
if vertexai is None:
3838
raise ImportError(
39-
"Could not import Vertex AI Python client. "
40-
"Please install it with `pip install google-cloud-aiplatform`."
39+
"""Could not import Vertex AI Python client.
40+
Please install it with `pip install "neo4j-graphrag[google]"`."""
4141
)
4242
self.vertexai_model = (
4343
vertexai.language_models.TextEmbeddingModel.from_pretrained(model)

src/neo4j_graphrag/llm/anthropic_llm.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ def __init__(
5555
import anthropic
5656
except ImportError:
5757
raise ImportError(
58-
"Could not import Anthropic Python client. "
59-
"Please install it with `pip install anthropic`."
58+
"""Could not import Anthropic Python client.
59+
Please install it with `pip install "neo4j-graphrag[anthropic]"`."""
6060
)
6161
super().__init__(model_name, model_params)
6262
self.anthropic = anthropic

src/neo4j_graphrag/llm/cohere_llm.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ def __init__(
5353
import cohere
5454
except ImportError:
5555
raise ImportError(
56-
"Could not import cohere python client. "
57-
"Please install it with `pip install cohere`."
56+
"""Could not import cohere python client.
57+
Please install it with `pip install "neo4j-graphrag[cohere]"`."""
5858
)
5959

6060
self.cohere = cohere

src/neo4j_graphrag/llm/mistralai_llm.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ def __init__(
5353
"""
5454
if Mistral is None:
5555
raise ImportError(
56-
"Could not import Mistral Python client. "
57-
"Please install it with `pip install mistralai`."
56+
"""Could not import Mistral Python client.
57+
Please install it with `pip install "neo4j-graphrag[mistralai]"`."""
5858
)
5959
super().__init__(model_name, model_params)
6060
api_key = kwargs.pop("api_key", None)

src/neo4j_graphrag/llm/openai_llm.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ def __init__(
5050
import openai
5151
except ImportError:
5252
raise ImportError(
53-
"Could not import openai Python client. "
54-
"Please install it with `pip install openai`."
53+
"""Could not import openai Python client.
54+
Please install it with `pip install "neo4j-graphrag[openai]"`."""
5555
)
5656
self.openai = openai
5757
super().__init__(model_name, model_params)

src/neo4j_graphrag/llm/vertexai_llm.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ def __init__(
5959
):
6060
if GenerativeModel is None or ResponseValidationError is None:
6161
raise ImportError(
62-
"Could not import Vertex AI Python client. "
63-
"Please install it with `pip install google-cloud-aiplatform`."
62+
"""Could not import Vertex AI Python client.
63+
Please install it with `pip install "neo4j-graphrag[google]"`."""
6464
)
6565
super().__init__(model_name, model_params)
6666
self.model = GenerativeModel(model_name=model_name, **kwargs)

0 commit comments

Comments
 (0)